Bug#920323: initscripts: /dev/shm mounting failure on stale static /dev

Pierre Ynard linkfanel at yahoo.fr
Thu Jan 24 06:42:10 GMT 2019

Package: initscripts
Version: 2.93-5
Severity: normal
Tags: patch

I haven't actually confirmed the bug, but just reading the code I
think there's a problem. After 2.93-4 resolved #851427 by reversing
the /dev/shm -> /run/shm symlink to /run/shm -> /dev/shm, on a system
running a static /dev, the following /lib/init/mount-functions.sh
mount_shm() code should hit the previous /dev/shm symlink:

>         if [ ! -d "$SHMDIR" ]
>         then
>                 mkdir --mode=755 "$SHMDIR"
>                 [ -x /sbin/restorecon ] && /sbin/restorecon "$SHMDIR"
>         fi

There is no clean-up so mkdir will fail. Then mounting on /dev/shm will
also fail because it's a dangling symlink. Then run_migrate() will
symlink /run/shm to /dev/shm. There will be a symlink loop and no shm

Perhaps the attached patch removing stale $SHMDIR symlinks could be an
appropriate trade-off.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages initscripts depends on:
ii  coreutils       8.30-1
ii  debianutils
ii  lsb-base        10.2018112800
ii  mount           2.33.1-0.1
ii  sysv-rc         2.93-1
ii  sysvinit-utils  2.93-1

Versions of packages initscripts recommends:
ii  e2fsprogs  1.44.5-1
ii  psmisc     23.2-1

initscripts suggests no packages.

-- Configuration Files:
/etc/default/rcS changed [not included]
/etc/default/tmpfs changed [not included]

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stale_shm_symlink.patch
Type: text/x-diff
Size: 459 bytes
Desc: not available
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20190124/ce3a5be6/attachment.patch>

More information about the Debian-init-diversity mailing list