cannot run maas-import-ephemerals inside lxc container
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Invalid
|
High
|
Unassigned | ||
lxc (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
maas (Ubuntu) |
Invalid
|
High
|
Unassigned |
Bug Description
by default lxc containers do not allow mounting ext4 filesystems.
during 'maas-import-
In the end, try to do this, and you'll see something like:
Tue, 03 Dec 2013 17:17:57 +0000: converting /var/lib/
mount: Could not find any loop device. Maybe this kernel does not know
about the loop device? (If so, recompile or `modprobe loop'.)
Tue, 03 Dec 2013 17:17:57 +0000: failed to mount /var/lib/
http://
describes how to modify a container to allow mount.
It is possible that lxc could allow mount of ext4 filesytems inside a container by default. I will open a task for lxc for that. However, even if it did, the user-namespace'd lxc container that we should have in 14.04 will not work with that.
Attached is instructions on how to recreate this on 12.04 (using cloud-archive). The same should basically work on trusty (using trusty).
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: maas-cluster-
ProcVersionSign
Uname: Linux 3.12.0-4-generic x86_64
ApportVersion: 2.12.7-0ubuntu1
Architecture: amd64
Date: Tue Dec 3 17:34:18 2013
Ec2AMI: ami-00000611
Ec2AMIManifest: FIXME
Ec2Availability
Ec2InstanceType: m1.tiny
Ec2Kernel: aki-00000548
Ec2Ramdisk: ari-00000548
PackageArchitec
ProcEnviron:
TERM=screen
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: maas
UpgradeStatus: No upgrade log present (probably fresh install)
modified.
# UUID identifying the running cluster controller.
CLUSTER_UUID = '5ccc848a-
mtime.conffile.
mtime.conffile.
upstart.
Related branches
Changed in maas: | |
status: | Confirmed → Triaged |
importance: | Undecided → High |
tags: | added: patch |
Changed in maas (Ubuntu): | |
importance: | Undecided → High |
Changed in maas: | |
status: | Triaged → Invalid |
Changed in maas (Ubuntu): | |
status: | Confirmed → Invalid |
In the interest of having all the info ccontained in this bug, below is what I had written in the ask-ubuntu response.
You can allow your lxc container to do mounts of ext2, ext3, or ext4 filesystems in one of 2 ways. The simplist is to just add the following to the lxc config (/var/lib/ lxc/$NAME/ config) :
lxc.aa_profile = unconfined devices. allow = b 7:* rwm devices. allow = c 10:237 rwm
lxc.cgroup.
lxc.cgroup.
A much more restrictive solution that still grants the necessary permissions is to do the following:
$ sudo tee /etc/apparmor. d/lxc/lxc- custom- mounts <<EOF d/lxc/lxc- default extx-mounts flags=( attach_ disconnected, mediate_ deleted) { lxc/container- base>
# copied and modified from /etc/apparmor.
profile lxc-container-
#include <abstractions/
mount fstype=ext4 -> /**,
mount fstype=ext3 -> /**,
mount fstype=ext2 -> /**,
}
EOF
# reload the lxc-containers profile d/lxc-container s
$ sudo apparmor_parser --replace /etc/apparmor.
$ sudo lxc-create -t ubuntu-cloud -n source-saucy-amd64 -- --release=saucy --arch=amd64
$ name="test1" lib/lxc/ $name/config;
$ cfg=/var/
$ sudo lxc-clone -o source-saucy-amd64 -n "$name"
## modify the config to use the profile created above extx-mounts devices. allow = b 7:* rwm devices. allow = c 10:237 rwm
$ sudo grep "#allow-loop" "$cfg" || sudo tee -a "$cfg" <<EOF
#allow-loop
lxc.aa_profile = lxc-container-
lxc.cgroup.
lxc.cgroup.
EOF