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
Task Type Bug Report
Category System
Status Closed
Assigned To Tobias Powalowski (tpowa)
Thomas Bächler (brain0)
Architecture All
Severity Low
Priority Normal
Reported Version 0.8 Voodoo
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

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

Closed by  Aaron Griffin (phrakture)
Tuesday, 13 May 2008, 14:10 GMT
Reason for closing:  Not a bug
Comment by Roman Kyrylych (Romashka) - Friday, 13 April 2007, 09:40 GMT
I remember some issues about /proc and USB were mentioned in ML long time ago.
Changing this should be thought-out very carefully.
Comment by Andrew Fyfe (space-m0nkey) - Friday, 13 April 2007, 12:58 GMT
Both solutions are wrong. There's no need to unmount/mount the filesystems to record them in /rtc/mtab, you should use 'mount -f' to write already mounted filesystems to mtab.

/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
Comment by Ingmar Steen (hyriand) - Friday, 13 April 2007, 13:05 GMT
mount -f still depends on knowing what exactly is mounted already, which is the original problem. udev can cause mounts to happen before rm -f /etc/mtab*, so those mounts will never show up in mtab.
Comment by Andrew Fyfe (space-m0nkey) - Friday, 13 April 2007, 13:17 GMT
Sorry i didn't realise you were talking about udev, (let me go put my glasses on :p)

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.
Comment by Roman Kyrylych (Romashka) - Saturday, 09 February 2008, 16:07 GMT
did someone investigate this issue?
Comment by Thomas Bächler (brain0) - Saturday, 09 February 2008, 16:57 GMT
I think I changed the mtab code a long time ago, so this shouldn't be an issue anymore.
Comment by Tobias Powalowski (tpowa) - Monday, 24 March 2008, 09:44 GMT
can we close this now?
Comment by Danny Arnold (despairblue) - Monday, 12 May 2008, 13:19 GMT
can it be closed?

Loading...