linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Miquel van Smoorenburg" <miquels@cistron.nl>
To: linux-kernel@vger.kernel.org
Subject: Re: how to restart userland?
Date: Mon, 3 Nov 2003 23:32:33 +0000 (UTC)	[thread overview]
Message-ID: <bo6oih$s51$1@news.cistron.nl> (raw)
In-Reply-To: Pine.LNX.4.53.0311031519050.2654@chaos

In article <Pine.LNX.4.53.0311031519050.2654@chaos>,
Richard B. Johnson <root@chaos.analogic.com> wrote:
>On Mon, 3 Nov 2003, Tomas Szepe wrote:
>
>> Hi,
>>
>> Would anyone know of a proven way to completely restart the userland
>> of a Linux system?
>>
>> i.e. something like
>> # echo whatever-restart >/proc/wherever
>>
>> Killing all processes.
>> Killing init.
>> Unmounting all filesystems.
>> VFS: Mounted root (ext2 filesystem).
>> INIT: v2.84 booting
>> ...
>
>If you have an 'old' sys-V installation, you as root can execute
>`init 0`.
>Then, after everything has stopped, you can execute
>`init 5` or `init 6` to restart to the runlevel you had. More
>modern versions from (probably all) distributions won't allow
>this.

It's been a while since you used a real sysv right ? Or you've
used different ones then I did.

The correct command for single user mode is:

# shutdown now (equivalent to "init 1")

Now the system will throw you into single user mode. Here, all
processed are killed. It's just that all filesystems remain
mounted

You can now login and enter 'init 2' or 'init 3' or whatever to
go to that runlevel

Just exiting the shell (logout) will boot into the default runlevel

You can even just not login at all, press ^D and the system will
boot to the default runlevel.

The command that is run at single user mode is "sulogin". It's
invoked by init, as defined in /etc/inittab. If you just add
a timeout to the sulogin invocation (-t 20 or so) then sulogin
will exit after that timeout.

Now that is exactly what you want - add the timeout. Throw the
system into single user mode with "shutdown now" or "init 1".
After a while the system will be restarted from scratch
without a reboot.

This will work on Debian. It most likely will works on other
distributions too, and probably on most System Vs as well.
Though on System V the shutdown command is "shutdown -i1 -y".
Which, btw, will work just fine on Linux too ;)

Mike.


      parent reply	other threads:[~2003-11-03 23:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-03 19:39 how to restart userland? Tomas Szepe
2003-11-03 20:03 ` Valdis.Kletnieks
2003-11-03 20:12   ` Tomas Szepe
2003-11-04 10:05     ` Helge Hafting
2003-11-04 15:47       ` Thierry Vignaud
2003-11-03 20:21   ` Måns Rullgård
2003-11-03 20:31     ` Valdis.Kletnieks
2003-11-03 20:32 ` Richard B. Johnson
2003-11-03 20:41   ` Tomas Szepe
2003-11-03 21:00     ` Francois Romieu
2003-11-03 21:03       ` Francois Romieu
2003-11-03 21:12         ` Tomas Szepe
2003-11-03 23:32   ` Miquel van Smoorenburg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='bo6oih$s51$1@news.cistron.nl' \
    --to=miquels@cistron.nl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).