On Wed, Nov 17, 2010 at 11:04:15PM +0100, Goswin von Brederlow wrote: > I recently installed a squeeze system. The generated /etc/fstab > contains the following line: > > # <file system> <mount point> <type> <options> <dump> <pass> > proc /proc proc defaults 0 0 > > But in /usr/share/initramfs-tools/init you have: > > mount -t proc -o nodev,noexec,nosuid none /proc > > This causes mount to return an error when mounting all local > filesystems because "proc" and "none" are different divices and it > can't mount /proc again over an existing mountpoint. The > /etc/init.d/mountall.sh script reports a red FAILED because of that. > > Node: /etc/mtab is a link to /proc/mounts here. That might affect this > issue. It certainly does. I've attached a patch which fixes this for all filesystems handed over to the host from the initramfs so that read-only root works correctly. This matches up the mount options with those used by initscripts so that everything works whether you're using /etc/mtab as a file or as a symlink to /proc/mounts (as will occur soon; see #620710 and http://people.debian.org/~rleigh/util-linux_2.19.1-1.dsc). The new mount uses libmount and /run/mount/utab which makes a /proc/mounts symlink work correctly. Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
From f990eb9b7e1c4f50d4c4022bb4b582bcb7a9db18 Mon Sep 17 00:00:00 2001 From: Roger Leigh <email@example.com> Date: Tue, 10 May 2011 22:19:07 +0100 Subject: [PATCH] init: Don't use "none" as a mount fsname When mounting kernel filesystems and tmpfs filesystems, "none" is unsuitable as the filesystem name. This is because it causes breakage when /etc/mtab is a symlink to /proc/mounts. This is needed so that we can switch /etc/mtab to be a symlink when util-linux is updated to use libmount (#620710). When /etc/mtab is a file updated by mount, the initscripts mountkernfs.sh, mountdevsubfs.sh and mtab.sh initialise the mtab at boot using values other than "none". For example, /proc uses "proc", /dev/pts uses "devpts" and /sys uses "sysfs". The mtab entries are created from defaults, plus any user customisations added to /etc/fstab. When /etc/mtab is a symlink to /proc/mounts, the values set when the filesystems were mounted by init in the initramfs are now visible, and these differ from values in /etc/fstab. The initscripts are now no longer able to update the mtab file, and this causes problems mounting local filesystems. The most visible issue is /proc. The default fstab entry is: proc /proc proc defaults 0 0 while init is using mount -t proc -o nodev,noexec,nosuid none /proc rather than mount -t proc -o nodev,noexec,nosuid proc /proc which results in "mount -a" failing with an exit code of 32 (mount failure). While altering "proc" to "none" in the fstab file corrects this boot failure, this is present by default in the fstab file of every installed system, and so is not easy to update. Additionally, the /dev/pts and /sys mounts may also have been added using the "devpts" and "sysfs" names, and so these should ideally also be corrected to use these names in the initramfs. This behaviour may be easily verified by changing the fsname for /proc in /etc/fstab and checking the exit status of "mount -a". I also fixed an inconsistency in the udev /dev fsname. It might use "none" or "udev"; it now always uses "udev". Signed-off-by: Roger Leigh <firstname.lastname@example.org> --- init | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/init b/init index ac67214..445c354 100755 --- a/init +++ b/init @@ -8,8 +8,8 @@ echo "Loading, please wait..." [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp mkdir -p /var/lock -mount -t sysfs -o nodev,noexec,nosuid none /sys -mount -t proc -o nodev,noexec,nosuid none /proc +mount -t sysfs -o nodev,noexec,nosuid sysfs /sys +mount -t proc -o nodev,noexec,nosuid proc /proc # Note that this only becomes /dev on the real filesystem if udev's scripts # are used; which they will be, but it's worth pointing out @@ -17,14 +17,14 @@ tmpfs_size="10M" if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf fi -if ! mount -t devtmpfs -o mode=0755 none /dev; then +if ! mount -t devtmpfs -o mode=0755 udev /dev; then echo "W: devtmpfs not available, falling back to tmpfs for /dev" mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev [ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1 [ -e /dev/null ] || mknod /dev/null c 1 3 fi mkdir /dev/pts -mount -t devpts -o noexec,nosuid,gid=5,mode=0620 none /dev/pts || true +mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run mkdir /run/initramfs -- 184.108.40.206
Description: Digital signature