Re: the GPG_TTY line in bashrc produces error message in chroot environment

"Jamenson Espindula" ([email protected] via blfs-dev Mailing List) <[email protected]> Mon, 20 Oct 2025 23:43:06 -0300
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <CAOW_YOnvBudqSSVCBZFwdbaonK32JfbEE+dQnuyfCoOYRb4qig@mail.gmail.com>
Em seg., 20 de out. de 2025 às 22:58, Xi Ruoyao
<[email protected]> escreveu:
>
> It won't work if the host's tty group has a different gid than 5.
> That's why we stopped to use it in the first place.
>
OK. I got it.

I think it would be useful to transcript some output from my LFS 12.3
(installed on a USB flash disk).

I transcript the script (suggested by Blau Araújo) I use to enter the chroot:

 = = = Transcription begins = = =

#!/usr/bin/env /usr/bin/bash
mount -v --bind /dev $LFS/dev
mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then install -v -d -m 1777 $LFS$(realpath
/dev/shm); else mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm; fi
chroot "$LFS" /usr/bin/env -i HOME=/root TERM="$TERM" PS1='(lfs
chroot) \u:\w\$ ' PATH=/usr/bin:/usr/sbin /usr/bin/bash --login

 = = = Transcription ends = = =

Entering the chroot from an PTY (terminal emulator in Graphic User
Interface), yield the following results:

 = = = Transcription begins = = =

root@comp01:~# LC_ALL=C mount -v /dev/sdb3 "${LFS}"
mount: /dev/sdb3 mounted on /mnt/lfs.
root@comp01:~# LC_ALL=C ./jaula-lfs.sh
mount: /dev bound on /mnt/lfs/dev.
mount: /dev/pts bound on /mnt/lfs/dev/pts.
mount: proc mounted on /mnt/lfs/proc.
mount: sysfs mounted on /mnt/lfs/sys.
mount: tmpfs mounted on /mnt/lfs/run.
mount: tmpfs mounted on /mnt/lfs/dev/shm.
root [ / ]# LC_ALL=C findmnt
TARGET       SOURCE    FSTYPE   OPTIONS
/            /dev/sdb3 ext4     rw,relatime
|-/dev       udev      devtmpfs
rw,nosuid,relatime,size=8059892k,nr_inodes=2014973,mode=755,inode64
| |-/dev/pts devpts    devpts
rw,nosuid,noexec,relatime,gid=5,mode=600,ptmxmode=000
| `-/dev/shm tmpfs     tmpfs    rw,nosuid,nodev,relatime,inode64
|-/proc      proc      proc     rw,relatime
|-/sys       sysfs     sysfs    rw,relatime
`-/run       tmpfs     tmpfs    rw,relatime,inode64
root [ / ]# ls -l /proc/$$/fd
total 0
lrwx------ 1 root root 64 out 20 23:23 0 -> /dev/pts/0
lrwx------ 1 root root 64 out 20 23:23 1 -> /dev/pts/0
lrwx------ 1 root root 64 out 20 23:23 2 -> /dev/pts/0
lrwx------ 1 root root 64 out 20 23:23 255 -> /dev/pts/0
root [ / ]# ls -l /dev/ptmx
crw-rw-rw- 1 root tty 5, 2 out 20 23:23 /dev/ptmx
root [ / ]# LC_ALL=C tty
/dev/pts/0
root [ / ]# echo $?
0
root [ / ]# LC_ALL=C tty -s
root [ / ]# echo $?
0

 = = = Transcription ends = = =

On the other hand, entering the chroot from an TTY (terminal - F1),
yield the following results:

 = = = Transcription begins = = =

root@comp01:~# LC_ALL=C mount -v /dev/sdb3 "${LFS}"
mount: /dev/sdb3 mounted on /mnt/lfs.
root@comp01:~# LC_ALL=C ./jaula-lfs.sh
mount: /dev bound on /mnt/lfs/dev.
mount: /dev/pts bound on /mnt/lfs/dev/pts.
mount: proc mounted on /mnt/lfs/proc.
mount: sysfs mounted on /mnt/lfs/sys.
mount: tmpfs mounted on /mnt/lfs/run.
mount: tmpfs mounted on /mnt/lfs/dev/shm.
root [ / ]# LC_ALL=C findmnt
TARGET       SOURCE    FSTYPE   OPTIONS
/            /dev/sdb3 ext4     rw,relatime
|-/dev       udev      devtmpfs
rw,nosuid,relatime,size=8059892k,nr_inodes=2014973,mode=755,inode64
| |-/dev/pts devpts    devpts
rw,nosuid,noexec,relatime,gid=5,mode=600,ptmxmode=000
| `-/dev/shm tmpfs     tmpfs    rw,nosuid,nodev,relatime,inode64
|-/proc      proc      proc     rw,relatime
|-/sys       sysfs     sysfs    rw,relatime
`-/run       tmpfs     tmpfs    rw,relatime,inode64
root [ / ]# ls -l /proc/$$/fd
total 0
lrwx------ 1 root root 64 out 20 23:20 0 -> /dev/tty1
lrwx------ 1 root root 64 out 20 23:20 1 -> /dev/tty1
lrwx------ 1 root root 64 out 20 23:20 2 -> /dev/tty1
lrwx------ 1 root root 64 out 20 23:20 255 -> /dev/tty1
root [ / ]# ls -l /dev/ptmx
crw-rw-rw- 1 root tty 5, 2 out 20 23:27 /dev/ptmx
root [ / ]# LC_ALL=C tty
tty1
root [ / ]# echo $?
0
root [ / ]# LC_ALL=C tty -s
root [ / ]# echo $?
0

 = = = Transcription ends = = =

To your appreciation.

Jamenson Espindula

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page