"lxc-create -B best" fails on non-btrfs/zfs system

Bug #1750654 reported by Martin Pitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

As per documentation, the `-B best` option should automatically select the best backingstore, falling back all the way to dir.

But apparently it doesn't, at least not in artful's 2.1.0-0ubuntu1:

$ sudo lxc-create -B best --name=autopkgtest-xenial -t ubuntu -- -r xenial
lxc-create: autopkgtest-xenial: storage/btrfs.c: btrfs_create: 860 Inappropriate ioctl for device - Failed to create btrfs subvolume "/var/lib/lxc/autopkgtest-xenial/rootfs"
lxc-create: autopkgtest-xenial: storage/zfs.c: zfs_create: 758 Failed to create zfs dataset "zfs:lxc/autopkgtest-xenial": lxc-create: autopkgtest-xenial: utils.c: run_command: 2326 failed to exec command
lxc-create: autopkgtest-xenial: storage/zfs.c: zfs_mount: 256 No such file or directory - Failed to mount "lxc/autopkgtest-xenial" on "/usr/lib/x86_64-linux-gnu/lxc"
lxc-create: autopkgtest-xenial: lxccontainer.c: create_run_template: 1294 Failed to mount rootfs
lxc-create: autopkgtest-xenial: lxccontainer.c: create_run_template: 1473 container creation template for autopkgtest-xenial failed
lxc-create: autopkgtest-xenial: storage/zfs.c: zfs_destroy: 613 Failed to detect zfs dataset "lxc/autopkgtest-xenial": lxc-create: autopkgtest-xenial:
lxc-create: autopkgtest-xenial: lxccontainer.c: container_destroy: 2653 Error destroying rootfs for autopkgtest-xenial
lxc-create: autopkgtest-xenial: tools/lxc_create.c: main: 326 Error creating container autopkgtest-xenial

Moreover, it creates cruft which is hard to clean up again:

$ sudo lxc-ls -f
NAME STATE AUTOSTART GROUPS IPV4 IPV6
autopkgtest-xenial STOPPED 0 - - -

$ sudo lxc-destroy -n autopkgtest-xenial
lxc-destroy: autopkgtest-xenial: storage/zfs.c: zfs_destroy: 613 Failed to detect zfs dataset "lxc/autopkgtest-xenial": lxc-destroy: autopkgtest-xenial: utils.c: run_command: 2326 failed to exec command
lxc-destroy: autopkgtest-xenial: lxccontainer.c: container_destroy: 2653 Error destroying rootfs for autopkgtest-xenial
Destroying autopkgtest-xenial failed

$ sudo ls -lR /var/lib/lxc/autopkgtest-xenial
/var/lib/lxc/autopkgtest-xenial:
total 8
-rw-r--r-- 1 root root 149 Feb 20 20:41 config
drwxr-xr-x 2 root root 4096 Feb 20 20:41 rootfs

/var/lib/lxc/autopkgtest-xenial/rootfs:
total 0

This can only be cleaned up with `sudo rm -r`.

autopkgtest-build-lxc uses this option to get performant containers out of the box. Arguably `-B best` is a sort of "unbreak my containers" option and should always implicitly be used, but is there something else that I should do here?

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: lxc 2.1.0-0ubuntu1
ProcVersionSignature: Ubuntu 4.13.0-32.35-generic 4.13.13
Uname: Linux 4.13.0-32-generic x86_64
NonfreeKernelModules: zfs zunicode zavl zcommon znvpair
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
Date: Tue Feb 20 20:38:55 2018
JournalErrors:
 Error: command ['journalctl', '-b', '--priority=warning', '--lines=1000'] failed with exit code 1: Hint: You are currently not seeing messages from other users and the system.
       Users in the 'systemd-journal' group can see all messages. Pass -q to
       turn off this notice.
 No journal files were opened due to insufficient permissions.
PackageArchitecture: all
SourcePackage: lxc
UpgradeStatus: No upgrade log present (probably fresh install)
defaults.conf:
 lxc.net.0.type = veth
 lxc.net.0.link = lxcbr0
 lxc.net.0.flags = up
 lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
lxcsyslog:

Revision history for this message
Martin Pitt (pitti) wrote :
Revision history for this message
Christian Brauner (cbrauner) wrote : Re: [Bug 1750654] [NEW] "lxc-create -B best" fails on non-btrfs/zfs system

On Tue, Feb 20, 2018 at 08:43:41PM -0000, Martin Pitt wrote:
> Public bug reported:
>
> As per documentation, the `-B best` option should automatically select
> the best backingstore, falling back all the way to dir.
>
> But apparently it doesn't, at least not in artful's 2.1.0-0ubuntu1:

Hm, is it possible for you to try and reproduce with current master.
Works fine for me:

chb@conventiont|~
> sudo lxc-create -B best --name=autopkgtest-xenial -t ubuntu -- -r xenial
lxc-create: autopkgtest-xenial: storage/btrfs.c: btrfs_create: 861 Inappropriate ioctl for device - Failed to create btrfs subvolume "/var/lib/lxc/autopkgtest-xenial/rootfs"
lxc-create: autopkgtest-xenial: storage/zfs.c: zfs_create: 762 Failed to create zfs dataset "zfs:default/lxc/autopkgtest-xenial": The ZFS modules are not loaded.
Try running '/sbin/modprobe zfs' as root to load them.
lxc-create: autopkgtest-xenial: storage/lvm.c: do_lvm_create: 183 Failed to create logical volume "autopkgtest-xenial": Volume group "lvm_img" not found
lxc-create: autopkgtest-xenial: storage/lvm.c: lvm_create: 655 Error creating new logical volume "lvm:/dev/lvm_img/autopkgtest-xenial" of size "1073741824 bytes"
Checking cache download in /var/cache/lxc/xenial/rootfs-amd64 ...
Installing packages in template: apt-transport-https,ssh,vim,language-pack-en
Downloading ubuntu xenial minimal ...
W: Target architecture is the same as host architecture; disabling QEMU support
I: Running command: debootstrap --arch amd64 --verbose --components=main,universe --include=apt-transport-https,ssh,vim,language-pack-en xenial /var/cache/lxc/xenial/partial-amd64 http://archive.ubuntu.com/ubuntu
I: Retrieving InRelease
I: Checking Release signature
I: Valid Release signature (key id 790BC7277767219C42C86F933B4FE6ACC0B21F32)
I: Retrieving Packages
I: Validating Packages
I: Retrieving Packages

Changed in lxc (Ubuntu):
status: New → Fix Released
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.