8.2-RELEASE/ Ports / "Cannot fork: Resource unavailable" directly after make

Hi,
i'm installing FreeBSD 8.2-RELEASE on a amd64 PC.

Basic configuration is
/boot on UFS2
/ (and other) on ZFS v15

To install FreeBSD on this configuration, i do this manually through a howto (HowTo in the FreeBSD Wiki)

I would like to use Grub2 as Bootloader.
To install Grub2 i chroot in the target and cd to /usr/ports/sysutils/grub2 and run make.
Directly after this i got the
Error: "Cannot fork: Resource temporarily unavailable"

With no further information.

Search this forum, google and asking on irc does not result in any help.

Thanks in advance for any help, that can be given.

Greetings
paraqles
 
paraqles said:
Is there a reason why?
I don't see any.
Because the kernel needs to read /etc/fstab before it knows what filesystems to mount. It can't do that if it's on a filesystem that isn't mounted.
 
SirDice said:
/boot/ and / cannot be on different filesystems.

Actually they can be, however /boot still needs to be in /boot :D
Then in /boot/loader.conf you need to set vfs.root.mountfrom=...

What you wanted to say, is probably that /boot/ itself can't bee on root of filesystem (that is content of /boot/* can't be in /*). Tricky to explain

EDIT:
Remember?: ZFS boot from ufs flash. GELI boot from unencrypted flash etc :)
 
killasmurf86 said:
Actually they can be, however /boot still needs to be in /boot :D
Then in /boot/loader.conf you need to set vfs.root.mountfrom=...
Still not possible. Even /boot/ needs to be mounted. And it can't be mounted because the root filesystem / doesn't exist yet. If you do manage this the /boot/ directory on the root filesystem / will overlap with the previously mounted /boot/ filesystem.
 
How the heck then do you think I boot my encrypted system form flash?

The only thing, you don't need to mount fs that contains only /boot/ (or mount it somewhere else, however it's pretty pointless) and need to remember to update it when you update kernel
 
killasmurf86 said:
Actually they can be, however /boot still needs to be in /boot :D
Then in /boot/loader.conf you need to set vfs.root.mountfrom=...

What you wanted to say, is probably that /boot/ itself can't bee on root of filesystem (that is content of /boot/* can't be in /*). Tricky to explain

thats what i think i should be. the only thing the kernel needs to boot is the / and that can passed to the kernel through the vfs.root.mountfrom=... from that on it can get the fstab and mount all over devices to the approriate mountpoints.

Do you think it is a limitation of the kernel or of the bootloader?

Greetings,
paraqles
 
I'm not sure you understand me correct. Ok, lets make some examples.

/dev/da0 - This will be flash that we boot from (using GPT, I prefer GPT over MBR)
/dev/da0s1 - contains bootcode
/dev/da0s2 - contains: /boot/ ( so if you mount it as root, and do ls /, then you'll see boot)

/dev/ad4 - is disk where we have OS
/dev/ad4s1 (/dev/da0p1a in case of MBR) where we have root partition
/dev/ad4s2 contains /usr/local for example

now to be able to boot OS, wee need to edit file /boot/loader.conf on /dev/da0s1
Code:
vfs.root.mountfrom="ufs:/dev/ad4s1"

This will boot, but wee also need to mount /usr/local, so now on OS disk we edit /etc/fstab on /dev/da4s1
Code:
/dev/ad4s1  /           ufs rw  1 1
/dev/ad4s2  /usr/local  ufs rw  1 2
note: I don't remember what last 2 args mean, so I just set some numbers.... heck I don't even remember if it was supposed to be ufs or ufs2.


Now everything will boot and work fine

More or less this should work, I wrote it off my memory, so you my expect bugs
 
killasmurf86 said:
How the heck then do you think I boot my encrypted system form flash?
Yep, you're right. I was mistaken :r

The only thing, you don't need to mount fs that contains only /boot/ (or mount it somewhere else, however it's pretty pointless) and need to remember to update it when you update kernel
Yes, that would be tricky as you'd need to update the kernel in the /boot/ filesystem and not the one on the root filesystem.

I don't see the point of a seperate /boot/ (UFS) filesystem though (I understand why it's needed for an encrypted root filesystem). You can boot straight off a ZFS filesystem. Which would also save you the hassle when updating the kernel.

Code:
dice@williscorto:~>gpart show
=>       34  488397101  ad4  GPT  (232G)
         34        128    1  freebsd-boot  (64k)
        162    8388608    2  freebsd-swap  (4.0G)
    8388770  480008365    3  freebsd-zfs  (228G)

dice@williscorto:~>zfs list
NAME             USED  AVAIL  REFER  MOUNTPOINT
zroot           6.93G   218G   620M  legacy
zroot/usr       6.27G   218G  2.87G  /usr
zroot/usr/home  3.40G   218G  3.40G  /usr/home
zroot/var       46.5M   218G  35.1M  /var
zroot/var/log   11.4M   218G  11.4M  /var/log
dice@williscorto:~>cat /etc/fstab
/dev/gpt/corto-swap             none                    swap            sw              0       0
tmpfs                           /tmp                    tmpfs           rw,mode=1777    0       0
proc                            /proc                   procfs          rw              0       0
fdesc                           /dev/fd                 fdescfs         rw              0       0
linprocfs                       /compat/linux/proc      linprocfs       rw              0       0
dice@williscorto:~>cat /boot/loader.conf
nvidia_load="YES"
zfs_load="YES"
tmpfs_load="YES"
vfs.root.mountfrom="zfs:zroot"
kern.maxfiles="25000"
snd_via8233_load="YES"
dice@williscorto:~>
 
It certainly is possible to have /boot residing on a different device, separate to the rest of the root filesystem.

I have my ZFS fileserver set up with /boot on a bsdlabeled USB flash drive (plugged into an internal USB port on the motherboard) and the rest of the system on a zpool comprised of whole disk vdevs, not partitions.

The USB flash drive must still contain the /boot directory, as the boot code expects to find the loader binary at /boot/loader, likewise, loader(8) expects to find the kernel in /boot/kernel/kernel. Just copying the contents of /boot to the root of the USB flash drive won't work without additional effort.

As for making sure the separate /boot directory on the flash drive stays up to date, I still have a /boot subdirectory in my root filesystem on the zpool and manually sync it to the flash drive whenever it changes.

My method differs from Killasmurf's a little in that I use a bsdlabeled flash drive, where he uses an MBR sliced drive. My system boots from da0a, not da0s1.
 
SirDice said:
I don't see the point of a seperate /boot/ (UFS) filesystem though (I understand why it's needed for an encrypted root filesystem). You can boot straight off a ZFS filesystem. Which would also save you the hassle when updating the kernel.
That's true now, but in not so long time ago, there was no other way to boot from zfs

jem said:
The USB flash drive must still contain the /boot directory, as the boot code expects to find the loader binary at /boot/loader, likewise, loader(8) expects to find the kernel in /boot/kernel/kernel. Just copying the contents of /boot to the root of the USB flash drive won't work without additional effort.

This gives me idea of hacking FreeBSDs loader to be able to find kernel in /kernel/. That would be nice. I wouldn't need to sync /boot/ on my zfs and flash :D Instead I could mount flash on /boot :D
 
killasmurf86 said:
This gives me idea of hacking FreeBSDs loader to be able to find kernel in /kernel/. That would be nice. I wouldn't need to sync /boot/ on my zfs and flash :D Instead I could mount flash on /boot :D

I had the USB drive mounting under /usbboot with /boot in my ZFS root filesystem being a symlink to /usbboot/boot.

Problem is, when there was a powercut, the UFS filesystem on the stick was marked dirty and it stopped the system fully booting after the power was restored until I did a manual fsck on the stick. That's why I reverted to mounting the stick only when needed and manually syncing.

If you want the bootcode and loader to look elsewhere for the loader and kernel, respectively, take a look at boot.config(5) and loader.conf(5).
 
jem said:
I had the USB drive mounting under /usbboot with /boot in my ZFS root filesystem being a symlink to /usbboot/boot.

Problem is, when there was a powercut, the UFS filesystem on the stick was marked dirty and it stopped the system fully booting after the power was restored until I did a manual fsck on the stick.

I don't keep my USB flash plugged in.
As soon as PC boots I plug it out.

It would just be nice to be able mount it under /boot when I update system...
I'll get working on this as soon as I return from shop.

It looks pretty simple, I already found most files, that I will need to edit
 
This discussion is nice and clears some questions.
But does not solve my problem.

Maybe my way was to fancy.

Installing FreeBSD / on zfs and /boot on ext2 and then booting with grub2.

I don't have gettin it to work.
So i back to the standard bootloader.

Greetings
paraqles
 
Back
Top