Public bug reported:

mountall / Upstart handles /dev mounting badly on trusty (14.04) when no
initrd is used. This is a regression from  Precise (12.04).

This bug occurs when an Ubuntu image is produced using debootstrap and a
separate initrd is not used. More precisely, I am using debootstrap to
produce a root filing system which I am running as an initrd from RAM
entirely, i.e. no pivitroot, and upstart (as init) is the first thing
run by the kernel.

If an essentially empty (apart from /proc) /etc/fstab is used, /dev will
be on the root (RAM) filing system and will be as produced by
debootstrap. This means udev gets confused about addition of device
nodes. Specifically, /dev/net/tun never gets created.

If /etc/fstab has a devtmpfs /dev in, things go better from a udev point
of view, but there are no pty's in the system as /dev/pts doesn't exist.

If /etc/fstab has a devtmpfs /dev in AND a devpts fs mounted on
/dev/pts, the same happens because /dev/pts (the directory) does not
exist when mountall runs (because it needs to be within the newly
mounted /dev), and hence devpts does not get mounted and the
pseudoterminals still do not work.

I suspect this works when you do have a separate initrd as something has
already mounted /dev and/or /dev/pts

A workaround is to run a tiny shell script before init like this, which
is deeply horrible.

        mv ${DIR}/sbin/init ${DIR}/sbin/init.real
        cat >> ${DIR}/sbin/init <<'__END__'
#!/bin/sh
/bin/mount -t proc -o rw,noexec,nosuid,nodev proc /proc
/bin/mount -t sysfs -o rw,noexec,nosuid,nodev sysfs /sys
/bin/mount -t devtmpfs -o rw,mode=0755 udev /dev
/bin/mkdir -p /dev/pts
/bin/mount -t devpts -o rw,noexec,nosuid,gid=5,mode=0620 devpts /dev/pts
/bin/mv /sbin/init.real /sbin/init && exec /sbin/init "$@"
__END__
        chmod 755 ${DIR}/sbin/init

I think the easiest fix to this is probably in mountall rather than
upstart (though I think it's an upstart bug). This would be that if the
mount point is within a tmpfs style filing system AND has already been
mounted by mountall, it should mkdir -p the mountpoint. This is
relatively harmless as such tmpfs style filing systems are (as far as I
know) pretty much guaranteed not to have directories in, and clearly the
user's intent is that the directory is used.

** Affects: mountall (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1336674

Title:
  mountall / upstart handles /dev mounting badly

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mountall/+bug/1336674/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to