shutdown: unconditionally removes /etc/nologin

Reported by Ryan Lovett on 2008-08-21
2
Affects Status Importance Assigned to Milestone
upstart
Low
Unassigned

Bug Description

Debian provides a way for /etc/nologin to persist after a reboot by the DELAYLOGIN variable that is checked within the rmnologin initscript. upstart removes /etc/nologin without checking for this condition.

Note that I don't care about the mechanism itself, just that there be *some* way of telling the system to have an /etc/nologin in place after reboot.

Changed in upstart:
importance: Undecided → Low
status: New → Confirmed
importance: Low → Wishlist

I suspect the problem isn't the initscripts, but that the shutdown binary unconditionally removes /etc/nologin before it reboots the machine (because it might write to it)

summary: - Ignores rmnologin/DELAYLOGIN mechanism
+ shutdown: unconditionally removes /etc/nologin
Changed in upstart:
status: Confirmed → Triaged
importance: Wishlist → Low

I've just checked the sysvinit code, it looks like its shutdown also unconditionally removes /etc/nologin

What steps are you taking?

Changed in upstart:
status: Triaged → Incomplete
Ryan Lovett (ryan-spacecoaster) wrote :

Re: https://bugs.launchpad.net/upstart/+bug/259965/comments/2

"What steps are you taking?"

Is this directed at me? If so, what do you mean?

I assume that you are changing some configuration, creating an /etc/nologin and then rebooting.

What steps do you take to do this?

On Thu, Jun 18, 2009 at 05:53:27PM -0000, Scott James Remnant wrote:
> I assume that you are changing some configuration, creating an
> /etc/nologin and then rebooting.
>
> What steps do you take to do this?

It is part of a maintanence cycle with tape backups. We wish to reboot a
machine and keep it unavailable to regular users until the tape backups
complete at which point /etc/nologin is removed.

At present we have to modify the distrubution to get around this behavior,
but we'd prefer if upstart could handle it. In an init.d script:

        # restore /etc/nologin since init wipes it
        if [ -e /etc/nologin_reboot ]; then
                /bin/mv /etc/nologin_reboot /etc/nologin
        fi

        # preserve /etc/nologin if some condition is met, else remove it
        if [ -e /etc/nologin ]; then
                if ! $OUR_CONDITION ; then
                        /bin/rm /etc/nologin
                fi
        fi

Ryan

Are you sure that it's Upstart that wipes the nologin file? In Ubuntu, at least, the nologin file is created by the /etc/rcS.d/S80bootmisc.sh script and then removed by /etc/rc[2-5].d/S99rmnlogin

Removal can be prevented by setting DELAYLOGIN=no in /etc/default/rcS

If this is not what you mean, could you explain why (and where in the code) you think Upstart is removing /etc/nologin

Ryan Lovett (ryan-spacecoaster) wrote :

On Sat, Jun 20, 2009 at 10:19:02AM -0000, Scott James Remnant wrote:
> Are you sure that it's Upstart that wipes the nologin file? In Ubuntu,
> at least, the nologin file is created by the /etc/rcS.d/S80bootmisc.sh
> script and then removed by /etc/rc[2-5].d/S99rmnlogin
>
> Removal can be prevented by setting DELAYLOGIN=no in /etc/default/rcS
>
>
> If this is not what you mean, could you explain why (and where in the
> code) you think Upstart is removing /etc/nologin

In upstart-0.3.9 compat/sysv/shutdown.c, shutdown_now() and cancel_callback():

        unlink (ETC_NOLOGIN);

Ryan

The exact same code exists in sysvinit-2.86.ds1 src/shutdown.c, stopit() and shutdown():

                unlink(NOLOGIN);

The nologin file is then recreated in rcS.d/S55bootmisc.sh:

        case "$DELAYLOGIN" in
          Y*|y*)
                echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin
                ;;
        esac

and removed in rc[1-5].d/S99rmnlogin:

 case "$DELAYLOGIN" in
   Y*|y*)
  rm -f /var/lib/initscripts/nologin
  ;;
 esac

Depending on the value of $DELAYLOGIN.

Are you sure that Upstart is behaving differently to sysvinit, and are you sure that Ubuntu is behaving differently to Debian?

I'm more than happy to accept the bug that shutdown should not unconditionally remove /etc/nologin as it does - however the description as it stands implies that this is a regression, when this is not backed up by the sysvinit/Debian code which appears identical.

Ryan Lovett (ryan-spacecoaster) wrote :

On Wed, Jun 24, 2009 at 08:49:24AM -0000, Scott James Remnant wrote:
> I'm more than happy to accept the bug that shutdown should not
> unconditionally remove /etc/nologin as it does - however the description
> as it stands implies that this is a regression, when this is not backed
> up by the sysvinit/Debian code which appears identical.

I was just going by the Debian documentation as we don't have any Debian
systems. If Debian has the bug too perhaps it should be fixed there as
well. ;)

Ryan

On Thu, 2009-07-30 at 18:11 +0000, Ryan Lovett wrote:

> On Wed, Jun 24, 2009 at 08:49:24AM -0000, Scott James Remnant wrote:
> > I'm more than happy to accept the bug that shutdown should not
> > unconditionally remove /etc/nologin as it does - however the description
> > as it stands implies that this is a regression, when this is not backed
> > up by the sysvinit/Debian code which appears identical.
>
> I was just going by the Debian documentation as we don't have any Debian
> systems. If Debian has the bug too perhaps it should be fixed there as
> well. ;)
>
Could you provide a reference to that documentation? It'd help to
understand how things should work.

Scott
--
Have you ever, ever felt like this?
Had strange things happen? Are you going round the twist?

Changed in upstart:
status: Incomplete → Triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers