You are not logged in.

#1 2016-10-02 06:45:24

ackalker
Member
Registered: 2012-11-27
Posts: 201

Chrooted with arch-chroot: missing pty files in /dev/pts

After bootstrapping Arch Linux (linux, arch-install scripts all from official repos) to a directory using:

# mkdir chroot
# pacstrap -d chroot base

I find that pty files appear to be missing from /dev/pts, while still being referenced from /proc/self/fd:

# arch-chroot chroot
chroot# ls -l /proc/self/fd/{0,1,2}
lrwx------ 1 root root 64 Oct  2 06:20 /proc/self/fd/0 -> /dev/pts/11
lrwx------ 1 root root 64 Oct  2 06:20 /proc/self/fd/1 -> /dev/pts/11
lrwx------ 1 root root 64 Oct  2 06:20 /proc/self/fd/2 -> /dev/pts/11
chroot# ls -l /dev/pts
total 0
c--------- 1 root root 5, 2 Oct  2 06:20 ptmx

Also, `tty` doesn't detect a tty:

chroot# tty
not a tty

(Note: I'm running arch-chroot from an urxvt, whose pty `ps -ely` lists as:

S     0 31375 31374  0  80   0  3088  3440 -      pts/11   00:00:00 arch-chroot

Mountpoints in the chroot are as follows:

chroot# mount
/dev/sdb1 on / type ext4 (rw,relatime,commit=300,data=ordered)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=4051192k,nr_inodes=1012798,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
tmp on /tmp type tmpfs (rw,nosuid,nodev)
tmpfs on /etc/resolv.conf type tmpfs (rw,nosuid,nodev,mode=755)

I know that there has been some recent change in the workings of devpts: the kernel's Documentation/filesystems/devpts.txt now states that:

Each mount of the devpts filesystem is now distinct such that ptys
and their indicies allocated in one mount are independent from ptys
and their indicies in all other mounts.

Could the reason there are no pty device nodes in /dev/pts in the chroot be that no *new* ptys have yet been allocated in the chroot?
A related question: assuming that the chroot should get its own set of ptys, why do the /proc/self/fd/* symlinks in the chroot still appear to reference device nodes in /dev/pts as they are named outside the chroot?

Interestingly, the commit message for this commit which updates Documentation/filesystems/devpts.txt  states:

    Reserved ttys are now available to all instances of devpts where the
    mounter is in the initial mount namespace.

Doesn't this mean that ttys allocated outside the chroot should also be available within the chroot?

Most importantly: how could the "not a tty" problem be fixed?

Thanks for your consideration.

Last edited by ackalker (2016-10-02 12:03:03)

Offline

#2 2016-10-02 07:50:28

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Chrooted with arch-chroot: missing pty files in /dev/pts

Moving to Kernel and Hardware


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2016-10-02 11:29:29

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,566
Website

Re: Chrooted with arch-chroot: missing pty files in /dev/pts

I think this got locked by accident, unlocking.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB