FS#6897 - missing entries in /etc/mtab after boot
Attached to Project:
Arch Linux
Opened by Ingmar Steen (hyriand) - Friday, 13 April 2007, 07:51 GMT
Last edited by Aaron Griffin (phrakture) - Tuesday, 13 May 2008, 14:10 GMT
Opened by Ingmar Steen (hyriand) - Friday, 13 April 2007, 07:51 GMT
Last edited by Aaron Griffin (phrakture) - Tuesday, 13 May 2008, 14:10 GMT
|
Details
/etc/rc.sysinit deletes /etc/mtab and then manually remounts
some mounts to make sure they are listed in /etc/mtab again.
This works fairly nice unless you use udev directly to
automatically mount devices that may or may not be attached
(think USB storage). There might be other scenerio's when
mounts may not appear in /etc/mtab.
A better solution imo would be to use /proc/mounts to initialise /etc/mtab after deleting it. This prevents unnecessary remounts and makes sure it's actually correct. Attached patch is a diff between rc.sysinit from initscript-0.8-6 and my version that uses /proc/mounts. It filters out /dev because that'll cause a message on shutdown that /dev is busy. |
This task depends upon
rc-sysinit-mtab-from-proc-mou...
Changing this should be thought-out very carefully.
/bin/mount -n -o remount,rw /
/bin/rm -f /etc/mtab*
/bin/mount -f /
[ -f /proc/mounts ] && /bin/mount -f /proc
grep -qw /sys /proc/mounts && /bin/mount -f /sys
if grep -qw /proc/bus/usb /proc/mounts; then
if grep -qw /proc/bus/usb /etc/fstab; then
mount -f /ptoc/bus/usb
else
mount -f -t usbfs none /proc/bus/usb
fi
fi
But I've noticed something a little worrying in rc.sysinit, if I'm following it right initramfs passes root rw, does various tasks, then mounts it ro for fsck, then back to rw, creates mtab and carries on with the rest of the boot. root should be read-only until fsck has been run. If that rule is going to be ignored might as well create a clean mtab at the start of rc.sysinit and remove '-n' from all the mount commands.