Wrong device for the / mount point

Bug #1096984 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
New
Undecided
Unassigned

Bug Description

quantal
lxc 0.8.0~rc1-4ubuntu39
kernel 3.5.0-21-generic
using lvm on the host

I came back from holidays and found this problem. Not sure if it's related to a recent update of the system, I was updating it regularly in the past 3 weeks I was away but I haven't tried any LXC creation during that time, until today.

If I create a container with the following command:

lxc-create -n precise-test -t ubuntu -- -b andreas -r precise

Then start it and login, the device for / is incorrect:

andreas@precise-test:~$ mount
/dev/mapper/vg0-var on / type ext4 (rw)

That device does not exist:
andreas@precise-test:~$ ls -la /dev/mapper
ls: cannot access /dev/mapper: No such file or directory
andreas@precise-test:~$

It's in fact my external device for the /var mount point. On the host:
root@nsn7:~# mount|grep /var
/dev/mapper/vg0-var on /var type ext4 (rw)
/dev/mapper/vg0-postgresql on /var/lib/postgresql type ext4 (rw)
/dev/mapper/vg0-virt on /var/lib/libvirt/images type ext4 (rw)

If I create the container with this command, however:
lxc-create -n precise-test -t ubuntu -B lvm --vgname vg0 --lvname lxc-precise-test -- -b andreas -r precise

Then it works:
andreas@precise-test:~$ mount
/dev/dm-16 on / type ext4 (rw)

The consequence I saw so far is that installing or updating or installing grub-pc inside the container breaks, because it can't find the device where the root filesystem is mounted from:
2013-01-07 16:15:07,835 unit:mysql/1: hook.output INFO: Setting up grub-pc (1.99-21ubuntu3.7) ...

2013-01-07 16:15:08,293 unit:mysql/1: hook.output INFO: /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).

2013-01-07 16:15:08,500 unit:mysql/1: hook.output INFO: dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 1

(example above from a juju deploy command)

The default precise container does not have grub-pc installed, so something else must be pulling it in (maybe the mysql charm from my example).

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for filing this bug.

I believe the grub part of this bug is covered in bug 1060404 (which is not fixed in Precise).

I don't believe the first part should be deemed a bug. lxc is not actually involved, and even without containers there is absolutely no guarantee that any results in 'mount' will be paths which are currently accessible to you. Moreover, note that if mount were returning a valid path (and grub succeeded in installing itself there) you would be destroying the grub install for the host :)

Therefore grub-install simply needs to not run in the container.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks a lot for the explanation :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.