I have just added a cgroup mount to /etc/fstab and my system appears to hang after mounting my root partition

Asked by James Hunt on 2010-11-29

I have just installed the cgroup-bin package:

  sudo apt-get install cgroup-bin

... and added a cgroup mount to /etc/fstab:

    none /cgroup cgroup defaults 0 0

However, on boot the system fails to boot to the desktop. In fact, Plymouth doesn't even start.
If you remove the "quiet" argument from the kernel command-line via group, the last line you see on screen is:

EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu mountall Edit question
Assignee:
No assignee Edit question
Solved by:
James Hunt
Solved:
2010-11-29
Last query:
2010-11-29
Last reply:
James Hunt (jamesodhunt) said : #1

This issue is rather interesting and is caused by a combination of the cgroup-bin, upstart and mountall packages. Note that the issue was caused by user error, but the explanation may be instructive.

Firstly, I should have RTFM for cgroup-bin since it mounts cgroups *itself* using info from /etc/cgconfig.conf. So, what was happening was:

- init (upstart) starts and starts jobs for the two job config files:
  - /etc/init/mountall.conf
  - /etc/init/rc.conf

The jobs representing mountall.conf and rc.conf run simulaneously (both are started on the "startup" event), but on my system it appears that rc.conf generally runs first. Thus, rc.conf runs "/etc/init.d/rc 2" which in turns runs "/etc/init.d/cgconfig". This script invokes cgconfigparser(8), which in turn calls mount(2) (via libcgroup.so.1).

At some *later* point, mountall(8) gets invoked by mountall.conf. This parses /etc/fstab and attempts to mount all entries. However, unbeknownst to mountall the cgroup mounts have _already_ been mounted (they show up in /proc/mounts, but *not* in /etc/mtab) and it is not legitimate to remount cgroup entries.

SOLUTIONS:

- remove the erroneous cgroup mount from /etc/fstab
- remove/comment out all entries in /etc/cgconfig.conf

THOUGHTS:

- consider increasing amount of user feedback provided by mountall
- change rc.conf to only run sysv service scripts when mountall has finished?

  start on (runlevel [0123456] and stopped mountall)

  This should confusing mountall and also avoid /etc/mtab from differing significantly from /proc/mounts.

OTHER INFO:

- This took a while to trace through since at the point mountall was having issues attempting to remount a cgroup mount, the root fs was mounted read-only. The solution I used was to create a ramfs.conf job which mounted a ramfs. I then modified mountall.conf to run mountall via strace, logging to the ramfs. Booting the system without "quiet" and then invoking "sysrq-F" killed mountall and dropped me back to a shell. I could then remount the root fs read-write and copy the ramfs data to it.