Restarting init without rebooting

Paul Everlund tdv94ped at cs.umu.se
Tue Apr 22 00:37:52 PDT 2003


On Tue, 22 Apr 2003, Willie Viljoen wrote:

> On Tuesday 22 April 2003 7:39, someone, possibly Sunil Sunder Raj,
> typed:
> (Top post moved to bottom)
> > >There is supposed to be a way of restarting init, after
> > >modifications of say an rc.* file, by sending a SIGHUP, I think
> > >avoiding the need to reboot.
> >
> > kill -HUP pid
> > wher pid is the pid of the inetd process.
>
> Sunil, this is to restart the internet super server (inetd). Joe
> wanted to restart init (the stage of booting and system management
> just after the kernel)

If you type 'kill -HUP 1' the init-process reads some (do
not know which except for /etc/ttys) configuration files.

> Joe, sadly BSD init will not restart as some SysV flavours will do,
> however, if you are at the console (NOT over a network connection,
> but a serial console counts too), there is a way to emulate the
> behaviour you would get from a SysV init.
>
> First, as root, do this (note the omission of switches):
>
> # shutdown now
>
> The system should now kill off processes and if your console is set
> to be insecure in /etc/ttys(5), init will ask for your root password
> to enter single user mode.
>
> Now you will be asked for a shell. Normally I prefer csh, but I'd
> recommend going with the defeault of /bin/sh for single user mode,
> various reasons.
>
> Once in single user mode, you will see:
>
> #
>
> Now, your only real option is to conduct some single user operations
> on the system, and reboot. You may also reinvoke rc however. Note
> that this can be troublesome, as some things in system startup
> really need only happen once. If you want to do this, first make
> sure to unmount all file systems in fstab(5), except for root. Do
> this:
>
> # umount -A
>
> Now, to attempt the restart, enter:
>
> # sh /etc/rc
>
> It's important that you use sh here. Even if you selected to use csh
> for your shell, you MUST invoke /etc/rc with sh.
>
> The system should now start performing the general booting
> procedures. This is pretty much a reboot, but it won't kill your
> uptime (which I am assuming is what you wish to preserve)
>
> Give this a try.
> Will

Can one not accomplish this by 'killall init'? Then enter for
'/bin/sh', and when typing exit the rc-scripts seems to be read
once again. This must of course be done at the console.

Best regards,
Paul



More information about the freebsd-questions mailing list