Linux's getdents gets /.. inode number from host system under LXC

Bug #1094019 reported by Ahmed Kamal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Won't Fix
Medium
Unassigned

Bug Description

Calling getdents on "/" gets the host system's inode number for /.., which is different from /. unlike real (non lxc) systems.
This causes flexlm to fail

More info at http://foss-boss.blogspot.com/2012/12/LXC-lies-about-..-inode-number-making-flexlm-unhappy.html

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: lxc 0.7.5-3ubuntu65
ProcVersionSignature: User Name 3.2.0-34.53-virtual 3.2.33
Uname: Linux 3.2.0-34-virtual x86_64
ApportVersion: 2.0.1-0ubuntu15
Architecture: amd64
Date: Thu Dec 27 13:13:46 2012
Ec2AMI: ami-2737b74e
Ec2AMIManifest: (unknown)
Ec2AvailabilityZone: us-east-1d
Ec2InstanceType: t1.micro
Ec2Kernel: aki-825ea7eb
Ec2Ramdisk: unavailable
KernLog:

MarkForUpload: True
ProcEnviron:
 TERM=xterm
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: lxc
UpgradeStatus: No upgrade log present (probably fresh install)
lxcsyslog:

modified.conffile..etc.lxc.lxc.conf: [modified]
mtime.conffile..etc.lxc.lxc.conf: 2012-12-04T17:17:14.072195

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

I can't reproduce this on my raring laptop.

ubuntu@r2:~$ ls -lid / /..
2783189 drwxr-xr-x 22 root root 4096 Jan 2 15:58 /
2783189 drwxr-xr-x 22 root root 4096 Jan 2 15:58 /..

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

Nor can I reproduce it on a precise instance running 3.2.0-35-virtual #55-Ubuntu:

ubuntu@p1:~$ ls -lid / /..
139754 drwxr-xr-x 22 root root 4096 Jan 2 16:09 /
139754 drwxr-xr-x 22 root root 4096 Jan 2 16:09 /..

Changed in lxc (Ubuntu):
importance: Undecided → Critical
importance: Critical → Medium
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Ok, sorry, I see now. Yes i can reproduce this with getdents of course.

This has nothing to do with lxc lying, and yes if you need to work around this you'll need to use blockdev-backed rootfs for the containers.

The container is set up with the tasks pivot_root'd into the container's /, which in your case is a bind mount. Resolution of '..' respects the fact that the /var/lib/lxc/container/rootfs should be root, and returns itself. However, there is only one actual directory entry for /var/lib/lxc/container/rootfs in all the kernel, and it's '..' (d_parent) points to /var/lib/lxc/container. Lxc can't do anything about that. The kernel's flexible mounts, bind mounts, and mounts namespaces provide different *views* of the filesystems, don't change what is in the actual filesystems.

Changed in lxc (Ubuntu):
status: New → Won't Fix
Revision history for this message
Ahmed Kamal (kim0) wrote : Re: [Bug 1094019] Re: Linux's getdents gets /.. inode number from host system under LXC

Hi Serge,

You need to compile the C code on
http://www.kernel.org/doc/man-pages/online/pages/man2/getdents.2.html
and run it to see this issue. It's "getdent" sys-call that sees different
numbers. Please confirm

On Wed, Jan 2, 2013 at 6:10 PM, Serge Hallyn <email address hidden>wrote:

> Nor can I reproduce it on a precise instance running 3.2.0-35-virtual
> #55-Ubuntu:
>
> ubuntu@p1:~$ ls -lid / /..
> 139754 drwxr-xr-x 22 root root 4096 Jan 2 16:09 /
> 139754 drwxr-xr-x 22 root root 4096 Jan 2 16:09 /..
>
>
> ** Changed in: lxc (Ubuntu)
> Importance: Undecided => Critical
>
> ** Changed in: lxc (Ubuntu)
> Importance: Critical => Medium
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1094019
>
> Title:
> Linux's getdents gets /.. inode number from host system under LXC
>
> Status in “lxc” package in Ubuntu:
> New
>
> Bug description:
> Calling getdents on "/" gets the host system's inode number for /..,
> which is different from /. unlike real (non lxc) systems.
> This causes flexlm to fail
>
> More info at http://foss-boss.blogspot.com/2012/12/LXC-lies-about
> -..-inode-number-making-flexlm-unhappy.html
>
> ProblemType: Bug
> DistroRelease: Ubuntu 12.04
> Package: lxc 0.7.5-3ubuntu65
> ProcVersionSignature: User Name 3.2.0-34.53-virtual 3.2.33
> Uname: Linux 3.2.0-34-virtual x86_64
> ApportVersion: 2.0.1-0ubuntu15
> Architecture: amd64
> Date: Thu Dec 27 13:13:46 2012
> Ec2AMI: ami-2737b74e
> Ec2AMIManifest: (unknown)
> Ec2AvailabilityZone: us-east-1d
> Ec2InstanceType: t1.micro
> Ec2Kernel: aki-825ea7eb
> Ec2Ramdisk: unavailable
> KernLog:
>
> MarkForUpload: True
> ProcEnviron:
> TERM=xterm
> LANG=en_US.UTF-8
> SHELL=/bin/bash
> SourcePackage: lxc
> UpgradeStatus: No upgrade log present (probably fresh install)
> lxcsyslog:
>
> modified.conffile..etc.lxc.lxc.conf: [modified]
> mtime.conffile..etc.lxc.lxc.conf: 2012-12-04T17:17:14.072195
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1094019/+subscriptions
>

Revision history for this message
Ahmed Kamal (kim0) wrote :

Ok I see, will use block backed lxc then. Thanks

On Wed, Jan 2, 2013 at 6:32 PM, Serge Hallyn <email address hidden>wrote:

> Ok, sorry, I see now. Yes i can reproduce this with getdents of course.
>
> This has nothing to do with lxc lying, and yes if you need to work
> around this you'll need to use blockdev-backed rootfs for the
> containers.
>
> The container is set up with the tasks pivot_root'd into the container's
> /, which in your case is a bind mount. Resolution of '..' respects the
> fact that the /var/lib/lxc/container/rootfs should be root, and returns
> itself. However, there is only one actual directory entry for
> /var/lib/lxc/container/rootfs in all the kernel, and it's '..'
> (d_parent) points to /var/lib/lxc/container. Lxc can't do anything
> about that. The kernel's flexible mounts, bind mounts, and mounts
> namespaces provide different *views* of the filesystems, don't change
> what is in the actual filesystems.
>
> ** Changed in: lxc (Ubuntu)
> Status: New => Won't Fix
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1094019
>
> Title:
> Linux's getdents gets /.. inode number from host system under LXC
>
> Status in “lxc” package in Ubuntu:
> Won't Fix
>
> Bug description:
> Calling getdents on "/" gets the host system's inode number for /..,
> which is different from /. unlike real (non lxc) systems.
> This causes flexlm to fail
>
> More info at http://foss-boss.blogspot.com/2012/12/LXC-lies-about
> -..-inode-number-making-flexlm-unhappy.html
>
> ProblemType: Bug
> DistroRelease: Ubuntu 12.04
> Package: lxc 0.7.5-3ubuntu65
> ProcVersionSignature: User Name 3.2.0-34.53-virtual 3.2.33
> Uname: Linux 3.2.0-34-virtual x86_64
> ApportVersion: 2.0.1-0ubuntu15
> Architecture: amd64
> Date: Thu Dec 27 13:13:46 2012
> Ec2AMI: ami-2737b74e
> Ec2AMIManifest: (unknown)
> Ec2AvailabilityZone: us-east-1d
> Ec2InstanceType: t1.micro
> Ec2Kernel: aki-825ea7eb
> Ec2Ramdisk: unavailable
> KernLog:
>
> MarkForUpload: True
> ProcEnviron:
> TERM=xterm
> LANG=en_US.UTF-8
> SHELL=/bin/bash
> SourcePackage: lxc
> UpgradeStatus: No upgrade log present (probably fresh install)
> lxcsyslog:
>
> modified.conffile..etc.lxc.lxc.conf: [modified]
> mtime.conffile..etc.lxc.lxc.conf: 2012-12-04T17:17:14.072195
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1094019/+subscriptions
>

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.