[Bug 1013619] New: lvm in docker unusable because no device nodes gets created
http://bugzilla.suse.com/show_bug.cgi?id=1013619 Bug ID: 1013619 Summary: lvm in docker unusable because no device nodes gets created Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Virtualization:Other Assignee: virt-bugs@suse.de Reporter: ms@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- For building images in kiwi I have setup a docker container. If the container is used to build lvm based images the build fails because the lvm commands never creates any device nodes. device node creation is normally handled by udev, however there was always a device mapper fallback which created nodes below /dev/mapper. None of these works anymore. I have tried many tests which I'll summarize here and also provide a way how to reproduce the problem. It is also unclear if this is a docker or lvm or both problem. Thus please do not blindly re-assign this to the lvm area from where we can start the ping pong game :) Thanks. Here is how it can be reproduced quickly 1. osc co Virtualization:Appliances:Images/dice-image-docker 2. osc getbinaries images x86_64 3. cat binaries/Docker-Tumbleweed.x86_64-42.2.0-Build5.1.docker.tar.xz | docker import - opensuse/dice:latest 4. docker run --privileged -ti opensuse/dice:latest bash ==> I'm using the btrfs storage backend 5. qemu-img create mydisk 20g fdisk mydisk ==> create lvm partition type is 8e n p . . . t 8e w q kpartx -sa mydisk ==> kpartx works and creates the partition node in my case in /dev/mapper/loop1p1 vgcreate systemVG /dev/mapper/loop1p1 ==> indicates it has worked, the volume group exists but no device node is created which failed on trying to create a volume lvcreate -v -L 268 -n var systemVG Archiving volume group "systemVG" metadata (seqno 1). Creating logical volume var Creating volume group backup "/etc/lvm/backup/systemVG" (seqno 2). Activating logical volume systemVG/var. activation/volume_list configuration setting not defined: Checking only host tags for systemVG/var. Creating systemVG-var Loading systemVG-var table (254:1) Resuming systemVG-var (254:1) /dev/systemVG/var: not found: device not cleared Aborting. Failed to wipe start of new LV. Removing systemVG-var (254:1) Creating volume group backup "/etc/lvm/backup/systemVG" (seqno 3). here we go, I haven't found any way to fix this -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1013619
Marcus Schaefer
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c1
--- Comment #1 from Marcus Schaefer
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c2
--- Comment #2 from Marcus Schaefer
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c3
--- Comment #3 from Marcus Schaefer
http://bugzilla.suse.com/show_bug.cgi?id=1013619
Aleksa Sarai
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c4
--- Comment #4 from Aleksa Sarai
@Flavio: I wasn't sure how to contact the entire docker team via bugzilla. Thus feel free to send this to your team. If you can make sure this is not a docker but lvm problem also feel free to hand it over to the lvm team (if something like that exists)
Thanks
I've assigned it to containers-bugowner (which is the mailing list we have for the containers team). I'll take a quick look at this later today. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c5
--- Comment #5 from Marcus Schaefer
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c6
--- Comment #6 from Aleksa Sarai
lvcreate -v -L 268 -n var systemVG
Archiving volume group "systemVG" metadata (seqno 1). Creating logical volume var Creating volume group backup "/etc/lvm/backup/systemVG" (seqno 2). Activating logical volume systemVG/var. activation/volume_list configuration setting not defined: Checking only host tags for systemVG/var. Creating systemVG-var Loading systemVG-var table (254:1) Resuming systemVG-var (254:1) /dev/systemVG/var: not found: device not cleared Aborting. Failed to wipe start of new LV. Removing systemVG-var (254:1) Creating volume group backup "/etc/lvm/backup/systemVG" (seqno 3).
Alright, so the reason this is happening is because /dev inside a Docker container is quite different to /dev on your host. /dev inside a Docker container is actually a tmpfs which has a bunch of things bindmounted into it (rather than being a full-on devtmpfs mount). This means that the /dev/systemVG directory won't be created in the container (it's just a tmpfs). Now, there are a couple of ways to handle this. To be honest, I'm not sure which is the safest. You can just straight-up bindmount /dev from your host into the container. While this might seem risky, /dev isn't namespaced in the kernel so AFAIK this should actually not affect how "safe" these operations are -- not to mention this is running in a privileged container anyway (which is only slightly better than chroot(2) in terms of separation from the host system). So you could try this: % docker run --privileged -ti -v /dev:/dev opensuse/dice:latest bash Another potential option would be to mount /dev as read-only and then only read-write the parts you want. But that wouldn't be automatic and you'd have to mess around with things quite a bit. The other option is to see whether Docker upstream will change --privileged containers to use a full devtmpfs. Unfortunately I don't think they'd like this change -- purely because of the security implications. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1013619
Balázs Németh
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c7
--- Comment #7 from Marcus Schaefer
http://bugzilla.suse.com/show_bug.cgi?id=1013619
http://bugzilla.suse.com/show_bug.cgi?id=1013619#c8
Flavio Castelli
participants (1)
-
bugzilla_noreply@novell.com