[systemd-devel] Odd /proc/$pid/fd symlinks in nspawn container

Lennart Poettering lennart at poettering.net
Mon Jul 27 10:57:08 PDT 2015


On Fri, 17.07.15 10:22, Ben Gamari (ben at smart-cactus.org) wrote:

> I have been having quite some trouble getting nspawn give me a shell
> with proper job control in a CentOS 6.6 guest. The problem appears to be
> that the nodes representing the std{out,err,in} fds in /proc are
> malformed,

Hmm, such an old container payload is always problematic. Old distros
are not prepared to run in a container context, the differences are
too big.

In fact, I'd recommend running no OSes in contaienrs which do not
support this spec:

https://wiki.freedesktop.org/www/Software/systemd/ContainerInterface/

> 
>     $ sudo strace -f -obad systemd-nspawn -D$(realpath centos6.5-amd64)
>     Spawning container centos6.5-amd64 on /home/ben/vm/centos6.5-amd64.
>     Press ^] three times within 1s to kill container.
>     Failed to create directory /home/ben/vm/centos6.5-amd64/sys/fs/selinux: Read-only file system
>     Failed to create directory /home/ben/vm/centos6.5-amd64/sys/fs/selinux: Read-only file system
>     /etc/localtime is not a symlink, not updating container timezone.
>     -bash: cannot set terminal process group (-1): Inappropriate ioctl for device
>     -bash: no job control in this shell
>     -bash-4.1# ls -lh /proc/self/fd
>     total 0
>     lrwx------ 1 root root 64 Jul 17 04:14 0 -> /7
>     lrwx------ 1 root root 64 Jul 17 04:14 1 -> /7
>     lrwx------ 1 root root 64 Jul 17 04:14 2 -> /7
>     lr-x------ 1 root root 64 Jul 17 04:14 3 -> /proc/13/fd
> 
> Note that fds 0, 1, and 2 all point to a non-existent /7 file. I believe
> this should instead point to /dev/pts/7, although strangely this does
> not exist either despite /dev/pts being mounted. I am running a very
> recent (4.1) kernel.

Humm, this sounds like serious bug. Which nspawn version are you
running on the host? Note that upstream we focus on more recent
upstream versions of systemd only, please report issues with older
systemd versions downstream only.

Can you strace nspawn to see where the /7 comes from?

> Am I correct in assuming that this is not expected behavior? What am I
> missing here?

Nope, certainly not. It should point to /dev/pts/1.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list