[Pkg-sysvinit-devel] Bug#510712: initscripts: inconsistent management of /etc/nologin file|symlink

Gian Piero Carrubba gp-ml at rm-rf.it
Sun Jan 4 14:28:53 UTC 2009


Package: initscripts
Version: 2.86.ds1-38+etchnhalf.1
Severity: normal


Note: assigning this report to initscripts, but it's about the source
package. Hope it's ok, otherwise feel free to clone this bug against the
sysvinit binary package.

For a long explanation, please see Joey Hess' mail in #510582[1].

In short:
- initscripts treats /etc/nologin as a symlink to
	/var/lib/initscripts/nologin. The link is created by postinst (if not
	existent - doesn't touch it if it's a regular file). The init scripts
	only modify /var/lib/initscripts/nologin during boot/shutdown.
- shutdown(8) treats /etc/nologin as a regular file and unlink() it if
	cancelled or before executing init.

As a result, after the first reboot /etc/nologin doesn't exist anymore
(either as a file or as a symlink) and the nologin feature during boot
is gone. The nologin feature on shutdown works because of shutdown(8),
but only in the last 5 min before init invocation.

Digging in changelogs and old bug reports, and googling around a bit, I
couldn't understand the rationale beyond /etc/nologin being a symlink
and the real file being out of the root fs (as noted in a changelog
entry), so in the following I'm guessing a lot. Please clarify on this
matter, thank you.

Some suggestions I can think of:

1. For the nologin feature to work also during the init phase of
halt/reboot, shutdown(8) should only unlink it if cancelled (and *not*
before invoking init). The nologin file should be removed by a late
script during shutdown or an early script during boot if DELAYLOGIN=no
(this way you can also address the fastdown case, when nologin isn't
unlinked).

2. shutdown(8) could use /var/lib/initscripts/nologin or follow
/etc/nologin if it's a symlink when unlinking (please note that it
follows it - if still exists - when fopen-ing for writing). However,
/var/lib/initscripts/nologin could be on a separate fs (possibly not
mounted). I assume shutdown(8) should only operate on root fs.

3. As 2. above, but put the real file on root filesystem (reintroducing
/etc/nologin.boot?).

4. Consistently treat /etc/nologin as a regular file.

5. If, for some reason, initscripts and shutdown(8) should treat
/etc/nologin differently, put an early script that recreate the symlink.


Thanks,
Gian Piero.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510582

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.24-king2
Locale: LANG=it_IT.UTF8, LC_CTYPE=it_IT.UTF8 (charmap=UTF-8)

Versions of packages initscripts depends on:
ii  deb 2.17                                 Miscellaneous utilities specific t
ii  e2f 1.39+1.40-WIP-2006.11.14+dfsg-2etch1 ext2 file system utilities and lib
ii  lib 2.7-16                               GNU C Library: Shared libraries
ii  lsb 3.1-23.2etch1                        Linux Standard Base 3.1 init scrip
ii  mou 2.12r-19etch1                        Tools for mounting and manipulatin
ii  sys 2.86.ds1-38+etchnhalf.1              System-V-like utilities

Versions of packages initscripts recommends:
ii  psmisc                        22.3-1     Utilities that use the proc filesy

-- no debconf information





More information about the Pkg-sysvinit-devel mailing list