lxc-create fails: cp: will not create hard link...

Bug #913877 reported by Robie Basak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
debootstrap (Ubuntu)
Invalid
Undecided
Unassigned
lxc (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Steps to reproduce:

1. Start with a machine running a fresh Precise cloud image
2. apt-get update && apt-get dist-upgrade
3. apt-get install lxc
4. cat > lxc.conf <<EOF
lxc.network.type=veth
lxc.network.link=test_network
lxc.network.flags=up
EOF
5. lxc-create -n test_container -t ubuntu -f lxc.conf -- -r oneiric

Command fails with:
Download complete
Copy /var/cache/lxc/oneiric/rootfs-amd64 to /var/lib/lxc/test_container/rootfs ...
Copying rootfs to /var/lib/lxc/test_container/rootfs ...cp: will not create hard link `/var/lib/lxc/test_container/rootfs/run/shm' to directory `/var/lib/lxc/test_container/rootfs/dev/shm'
Failed to copy rootfs
failed to install ubuntu oneiric
failed to execute template 'ubuntu'

Oddly, note the inode numbers below:

ubuntu@precise-test2:/var/cache/lxc/oneiric/rootfs-amd64$ stat dev/shm run/shm
  File: `dev/shm'
  Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd01h/64769d Inode: 136776 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-01-09 16:24:07.142185754 +0000
Modify: 2012-01-09 16:23:29.494185766 +0000
Change: 2012-01-09 16:23:29.494185766 +0000
 Birth: -
  File: `run/shm'
  Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd01h/64769d Inode: 136776 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-01-09 16:24:07.142185754 +0000
Modify: 2012-01-09 16:23:29.494185766 +0000
Change: 2012-01-09 16:23:29.494185766 +0000
 Birth: -

dev and run appear to be independent directories:

ubuntu@precise-test2:/var/cache/lxc/oneiric/rootfs-amd64$ ls -ld dev run
drwxr-xr-x 4 root root 4096 Jan 9 16:23 dev
drwxr-xr-x 5 root root 4096 Jan 9 16:24 run
ubuntu@precise-test2:/var/cache/lxc/oneiric/rootfs-amd64$ stat dev run
  File: `dev'
  Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd01h/64769d Inode: 131566 Links: 4
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-01-09 16:23:48.418185766 +0000
Modify: 2012-01-09 16:23:29.494185766 +0000
Change: 2012-01-09 16:23:29.494185766 +0000
 Birth: -
  File: `run'
  Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd01h/64769d Inode: 131572 Links: 5
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-01-09 16:24:08.302185766 +0000
Modify: 2012-01-09 16:24:04.106185766 +0000
Change: 2012-01-09 16:24:04.106185766 +0000
 Birth: -

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: lxc 0.7.5-3ubuntu4
ProcVersionSignature: User Name 3.2.0-8.14-virtual 3.2.0
Uname: Linux 3.2.0-8-virtual x86_64
ApportVersion: 1.90-0ubuntu1
Architecture: amd64
Date: Mon Jan 9 16:38:10 2012
Ec2AMI: ami-00000129
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: m1.small
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
ProcEnviron:
 LC_COLLATE=C
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: lxc
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Robie Basak (racb) wrote :
Revision history for this message
Robie Basak (racb) wrote :

It looks like debootstrap is leaving bind mounts around.

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

Turns out it's not debootstrap. It's the subsequent apt-get dist-upgrade with oneiric-updates and oneiric-security added to /etc/apt/sources.list that's leaving the mount behind.

Changed in debootstrap (Ubuntu):
status: New → Invalid
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

A simple but ugly way we could work around this would be to do the apt-get dist-upgrade inside a private mounts namespace (using lxc-unshare -s MOUNT -- chroot "$1/partial-${arch}" apt-get dist-upgrade -y)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.7.5-3ubuntu5

---------------
lxc (0.7.5-3ubuntu5) precise; urgency=low

  [ Robie Basak ]
  * debian/patches/0015-ubuntu-templ-use-updates.patch: use ports.ubuntu.com
    in sources.list for alternative architectures (LP: #820715).
  * debian/patches/0015-ubuntu-templ-use-updates.patch: dist-upgrade in an
    isolated environment to avoid leaving a bind mount behind (LP: #913877).
  * debian/lxc.{default,init}: call ifconfig with explicit netmask
    (LP: #913727).

  [ Serge Hallyn ]
  * debian/lxc.default: update the MIRROR example - using 'localhost'
    fails for updates after the container has been started.
  * debian/lxcguest.console.upstart: pass 'console' not '/dev/console' to
    getty. (LP: #913952)
  * debian/patches/0015-ubuntu-templ-use-updates.patch: at post_process(),
    copy host's /etc/resolv.conf (which may have changed) into chroot before
    apt-get actions, and always do a apt-get update before installing lxcguest,
    as the package version may have changed in the archive. (LP: #914155)
  * 0016-nested-cgroups.patch: nest container cgroups under the host's
    init cgroup. (LP: #901482)
  * 0017-pull-upstream-fedora-template.patch: move to the upstream
    lxc-fedora template (LP: #881903)
  * 0018-make-lxc-ps-search-proc.patch: work when cgroups are mounted with
    '-n'.
  * debian/patches/0019-fix-lxc-ls-nested-cgroups.patch: fix lxc-ls to
    handle the support for nested cgroups. (pull this into previous
    commit msg before pushing)
 -- Serge Hallyn <email address hidden> Tue, 10 Jan 2012 18:51:45 +0000

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