View previous topic :: View next topic |
Author |
Message |
Moasat n00b
Joined: 24 Apr 2005 Posts: 17
|
Posted: Tue May 10, 2011 2:07 pm Post subject: [SOLVED] openrc / baselayout-2 / udev / aoe / diskless |
|
|
I have a diskless machine that boots over AoE. I have a custom initrd that simply discovers the aoe device, then mounts it read-only and does a chroot to it. After the upgrade to baselayout2/openrc, udev complains about not starting correctly because /dev/zero does not exist. If I interrupt the startup after udev, I see the /dev contains only very few actual devices. It seems udev started but mounted over my initial /dev that had way more devices in it.
I've tried updating udev to the latest ~amd64 but it did not help. I'm running 2.6.37-gentoo-r4 and have the deprecated sysfs options disabled. Everything worked before the upgrade so I'm not sure what might have broken.
[edit] Interrupting the startup yields a rootfs that appears to be mounted rw but when I try to edit a file, it says that it is read-only. Maybe the roots is not getting remounting properly? I have root, procfs, swap, fsck and mtab in my boot runlevel.
Can anyone offer some ideas or point to a direction to start looking? I'm really not familiar with baselayout, openrc or udev and I considered myself lucky in getting the initrd to work correctly.
Thanks for any and all suggestions.
Last edited by Moasat on Thu May 12, 2011 1:37 pm; edited 1 time in total |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Tue May 10, 2011 3:19 pm Post subject: |
|
|
Is /etc/mtab a symlink to /proc/self/mounts? Is devtmpfs enabled in the kernel? |
|
Back to top |
|
|
Moasat n00b
Joined: 24 Apr 2005 Posts: 17
|
Posted: Tue May 10, 2011 3:29 pm Post subject: |
|
|
mtab is not a symlink. devtmpfs is not enabled in the kernel. I see two options: Enable and Automount. Should both of these be on? The help for automount says something about possibly needing to mount /dev in an initramfs environment which is pretty much what I'm in.
I enabled both options and the system seems to be running correctly. (I'm testing in a VM since I don't have physical access to the hardware at the moment).
Thanks for the pointer though. I knew nothing about devtmpfs and it possibly being required for udev to work in a diskless environment. |
|
Back to top |
|
|
Moasat n00b
Joined: 24 Apr 2005 Posts: 17
|
Posted: Thu May 12, 2011 1:37 pm Post subject: |
|
|
It turns out devtmpfs was not needed and actually caused some weird issues with the nvidia binary driver. When the driver loaded, it would not create the /dev/nvidia* nodes. Even creating them by hand didn't help.
I managed to get my initramfs working without requiring devtmpfs. I was using chroot at the end of the script and instead I changed it to use switch_root (and busybox). Here is the final init script for anyone interested.
#!/bin/busybox sh
# Mount /proc and /sys
/bin/echo Mounting /proc filesystem
/bin/mount -t proc none /proc
/bin/echo Mounting sysfs
/bin/mount -t sysfs none /sys
# Bring the network interface up
/bin/echo Bringing up eth0
/bin/ifconfig eth0 up
/bin/dhcpcd eth0
# Find real_root
for cmd in $(cat /proc/cmdline) ; do
case $cmd in
root=*)
REAL_ROOT=$(echo $cmd | cut -d= -f2)
;;
esac
done
/bin/echo Making AoE devices
/bin/mkdir -p /dev/etherd
/bin/aoe-mkdevs /dev/etherd
/bin/echo Telling AoE to discover.
/bin/echo omgdiscover > /dev/etherd/discover
/bin/echo "Waiting for ${REAL_ROOT} to appear"
for cc in `seq 0 300`; do
if [ -b "${REAL_ROOT}" ]; then
break
fi
/bin/sleep 0.1
done
# Wait for things to settle a bit
/bin/sleep 1
/bin/echo "Mounting ${REAL_ROOT}"
/bin/mount -o ro ${REAL_ROOT} /sysroot
if [ "$?" -ne "0" ]; then
echo "Error mounting root"
echo "I'm going to try rebooting"
/bin/shutdown -r now
exit 1
fi
/bin/echo Creating ramdisks
mount -n -t tmpfs tmpfs /sysroot/tmp
mount -n -t tmpfs tmpfs /sysroot/var/lib/init.d
mount -n -t tmpfs tmpfs /sysroot/var/lib/xkb
mount -n -t tmpfs tmpfs /sysroot/var/lib/dbus
mount -n -t tmpfs tmpfs /sysroot/var/lib/dhcpcd
mount -n -t tmpfs tmpfs /sysroot/var/log
mount -n -t tmpfs tmpfs /sysroot/var/run
mkdir -p /sysroot/var/run/lirc
mount -n -t tmpfs tmpfs /sysroot/var/run/lirc
mount -n -t tmpfs tmpfs /sysroot/var/lock
mount -n -t tmpfs tmpfs /sysroot/var/cache/hald
# Clean up.
umount /proc
umount /sys
# Boot the real thing.
exec switch_root /sysroot /sbin/init |
|
Back to top |
|
|
SlashBeast Retired Dev
Joined: 23 May 2006 Posts: 2922
|
Posted: Thu May 12, 2011 6:01 pm Post subject: |
|
|
If you use devtmpfs, you should do mount --move /dev /newroot/dev. nvidia nodes are created when nvidia module is loaded. Here I am using nvidia binary drivers and my initramfs (which use devtmpfs) as I have rootfs over encrypted lvm.
Also, use [code] tags.
FWIW instead of mounting so many tmpfs you could just use aufs/unionfs-fuse and store rw branch on tmpfs. |
|
Back to top |
|
|
pi3.14 n00b
Joined: 25 May 2011 Posts: 5
|
Posted: Wed May 25, 2011 10:59 am Post subject: |
|
|
Hello,
I upgraded Gentoo to OpenRC/baselayout-1, but I am using 2.6.32 OpenVZ kernel, where CONFIG_DEVTMPFS option is missing.
Without it gentoo won't boot. When I use newer kernel, where devtmpfs is available it boots normaly.
Any ideas how to get it work without devtmpfs? |
|
Back to top |
|
|
pablolibo n00b
Joined: 29 May 2011 Posts: 5
|
Posted: Mon May 30, 2011 12:08 am Post subject: |
|
|
pi3.14 wrote: | Hello,
I upgraded Gentoo to OpenRC/baselayout-1, but I am using 2.6.32 OpenVZ kernel, where CONFIG_DEVTMPFS option is missing.
Without it gentoo won't boot. When I use newer kernel, where devtmpfs is available it boots normaly.
Any ideas how to get it work without devtmpfs? |
Pi3.14
you can enable the DEVTMPFS in kernel option from:
/usr/src/linux-2.6.32-openvz-feoktistov.1/drivers/Kconfig
chenge:
config DEVTMPFS
bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
depends on HOTPLUG && SHMEM && TMPFS && !VE
to:
config DEVTMPFS
bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
depends on HOTPLUG && SHMEM && TMPFS
and now, you can enable the DEVTMPFS from openvz-source
but, it is bad idea, because it feature was disable for an report bug.
anyway, i am testing it bug |
|
Back to top |
|
|
pi3.14 n00b
Joined: 25 May 2011 Posts: 5
|
Posted: Mon May 30, 2011 5:10 am Post subject: |
|
|
I figured it without DEVTMPFS.
When using DEVTMPFS dev directory can be empty. When there isn't DEVTMPFS enabled it is necessary create
mknod -m 660 /dev/console c 5 1
mknod -m 660 /dev/null c 1 3
and then booting fine. |
|
Back to top |
|
|
|