[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#697003: initscripts: postinst fails: mv /dev/shm/* misses dot (hidden) files

Package: initscripts
Version: 2.88dsf-34
Severity: important
User: debian-bsd@lists.debian.org
Usertags: kfreebsd
X-Debbugs-Cc: debian-bsd@lists.debian.org


The initscripts package is failing to upgrade from -32 to -34 in a
GNU/kFreeBSD jailed system:

> Preparing to replace initscripts 2.88dsf-32 (using .../initscripts_2.88dsf-34_kfreebsd-amd64.deb) ...
> Unpacking replacement initscripts ...
> Processing triggers for man-db ...
> Setting up initscripts (2.88dsf-34) ...
> Installing new version of config file /etc/init.d/checkroot-bootclean.sh ...
> Installing new version of config file /etc/init.d/mountall.sh ...
> Installing new version of config file /etc/init.d/mountall-bootclean.sh ...
> Installing new version of config file /etc/init.d/mountnfs-bootclean.sh ...
> Installing new version of config file /etc/init.d/umountnfs.sh ...
> mv: cannot stat `/run/shm/*': No such file or directory
> dpkg: error processing initscripts (--configure):
>  subprocess installed post-installation script returned error exit status 1
> Errors were encountered while processing:
>  initscripts
> E: Sub-process /usr/bin/dpkg returned an error code (1)

There are so many issues here:

+ RUN=d
+ mountpoint -q /dev/
+ DEV=m
+ mountpoint -q /dev/shm/
+ [ -L /dev/shm ]
+ mountpoint -q /run/
+ mountpoint -q /run/shm/
+ [ -L /run/shm ]

My jailed system's /dev is rather special (a sort of read-only devfs
mount);  it doesn't contain a /dev/shm directory or link, and I'm not
even able to create one as root.

+ ls -A /run/shm
+ [ .tmpfs !=  ]

This command indicates there is a file in this folder, called .tmpfs
(though it isn't really a tmpfs), and so:

+ mv /run/shm/* /dev/shm
mv: cannot stat `/run/shm/*': No such file or directory

The wildcard does not match the .tmpfs file, and since there are no
matching files this is an error.  Postinst fails.

On the other hand, if there'd been some non-hidden files/directories
there, they would be moved, but any remaining hidden ones would be

Another problem is that if /dev/shm doesn't exist, and since a trailing
slash wasn't used;  if my /dev had been writable and this command
succeeded, it could place some directory from /run/shm there with
arbitrary ownership/permissions, or some arbitrary link with scary

How about doing it this way instead - I think this is safer, complete,
and even avoids races:

# find /run/shm -mindepth 1 -xdev -execdir mv \{\} /dev/shm/ \;

Anyway;  why are we doing any of this?  In this (awkward) situation we'd
ideally leave /run/shm contents where they are already, and /dev/shm
must stay non-existent.

I think this is a similar scenario to:

> - /dev/ is bind mounted, and /dev/shm is a non-bind-mounted
>   directory. We can't fix this, so we should just create the
>   /run/shm directory and leave /dev/shm alone.

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 9.0-2-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initscripts depends on:
ii  coreutils       8.13-3.4
ii  debianutils     4.3.2
ii  libc0.1         2.13-37
ii  lsb-base        4.1+Debian8
ii  sysv-rc         2.88dsf-34
ii  sysvinit-utils  2.88dsf-34

Versions of packages initscripts recommends:
ii  e2fsprogs  1.42.5-1
ii  psmisc     22.19-1

initscripts suggests no packages.

-- no debconf information

Reply to: