Newer versions of screen don't work by default with a read-only root partition

Check-list

  • I did not find the issue in the existing issues
  • I can reproduce the issue with unmodified Buildroot from this repository, not from a fork somewhere else
  • I can reproduce the issue on the latest commit of the branch I'm using:
    • master
    • stable (i.e. 20NN.MM.x - please specify)
    • LTS 2025.02.3
  • I can reproduce the issue after running make clean; make
  • I attached the full build log file (e.g. make 2>&1 |tee build.log)
  • I attached a minimal defconfig file that can reproduce the issue (make BR2_DEFCONFIG=$(pwd)/issue_defconfig savedefconfig)
  • I also attached the configuration for kconfig-based packages that are enabled (and necessary to reproduce the issue), most notably:
    • busybox
    • linux
    • uclibc
    • uboot

What I did

  • Buildroot commit sha1: 2025.02.3
  • Distribution of the build machine: Ubuntu 22.04

With the root partition mounted read-only (BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW not set) I am unable to use the screen package without providing a socket path via the SCREENDIR environment variable. In version 4.9.0 (prior to updating to version >=5.0) the default sockets directory was /tmp/screens/S-<user>. Now I believe it is expected to be in $HOME/.screen. It appears that there is the --enable-socket-dir option in configure.ac which sets the the global socket directory. This can either be a flag which sets it to /run/screen or any desired path. That variable sets the SOCKET_DIR macro, which if defined is used as the socket directory, otherwise $HOME/.screen is used.

# screen
Cannot access /root/.screen: No such file or directory

During building the autoconf configure output shows that the global socket directory is not specified:

Configuration:

 PAM support: .............................. yes
 telnet support: ........................... no
 utmp support: ............................. no
 global socket directory: .................. no

 system screenrc location: ................. /etc/screenrc
 pty mode: ................................. 0620
 pty group: ................................ 5
 pty on read only file system: ............. no

What happens

When trying to run the screen command on a system with a read-only root partition and without the SCREENDIR environment variable set you receive an error similar to Cannot access /root/.screen: No such file or directory.


What was expected

Being able to run the screen command without getting a similar error to Cannot access /root/.screen: No such file or directory and ideally without having to set the SCREENDIR environment variable.