kumquat-buildroot/system/skeleton/etc
Jan Kundrát 8196b299ba skeleton: fix permissions on /dev/pts/ptmx
Without this patch, it is not possible to allocate PTYs when a generated
rootfs image with a recent glibc and systemd is launched as a container  on
an RHEL7 system via machinectl/systemd-nspawn. The container boots, but
`machinectl login mycontainer` fails. The culprit is /dev/pts/ptmx with
0000 perms.

On a typical system, there are two `ptmx` devices. One is provided by the
devpts at /dev/pts/ptmx and it is typically not directly accessed from
userspace. The other one which actually *is* opened by processes is
/dev/ptmx. Kernel's documentation says these days that /dev/ptmx should be
either a symlink, or a bind mount of the /dev/pts/ptmx from devpts.

When a container is launched via machinectl/machined/systemd-nspawn, the
container manager prepares a root filesystem so that the container can live
in an appropriate namespace (this is similar to what initramfs is doing on
x86 desktops). During these preparations, systemd-nspawn mounts a devpts
instance using a correct ptmxmode=0666 within the container-to-be's
/dev/pts, and it adds a compatibility symlink at /dev/ptmx. However, once
systemd takes over as an init in the container,
/lib/systemd/systemd-remount-fs applies mount options from /etc/fstab to
all fileystems. Because the buildroot's template used to not include the
ptmxmode=... option, a default value of 0000 was taking an effect which in
turn led to not being able to allocate any pseudo-terminals.

The relevant kernel option was introduced upstream in commit 1f8f1e29 back
in 2009. The oldest linux-headers referenced from buildroot's config is
3.0, and that version definitely has that commit. Mount options that are
not understood by the system are anyway ignored, so backward
compatibility is preserved.

Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[Thomas: fix commit title, adjust commit log.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-18 15:24:56 +01:00
..
network package/skeleton: remove useless .empty file 2016-07-05 15:57:20 +02:00
profile.d skeleton: Rename /etc/profile.d/umask to umask.sh 2016-02-10 07:49:04 +01:00
fstab skeleton: fix permissions on /dev/pts/ptmx 2017-03-18 15:24:56 +01:00
group system/skeleton: use uid/gid 65534 for nobody/nogroup 2016-08-26 15:39:42 +02:00
hosts New top-level directory: system 2012-11-04 12:51:08 +01:00
mtab system/skeleton: update etc/mtab with a more sensible link 2016-07-05 15:24:38 +02:00
passwd system/skeleton: use uid/gid 65534 for nobody/nogroup 2016-08-26 15:39:42 +02:00
profile skeleton: Pretty fixes for /etc/profile 2015-10-04 15:53:07 +01:00
protocols skeleton: Update /etc/protocols from Debian Jessie 2013-10-27 08:27:38 +01:00
resolv.conf New top-level directory: system 2012-11-04 12:51:08 +01:00
services New top-level directory: system 2012-11-04 12:51:08 +01:00
shadow skeleton: sync /etc/shadow with /etc/passwd 2015-10-28 23:33:14 +01:00