Differences between revisions 31 and 33 (spanning 2 versions)
Revision 31 as of 2020-06-08 20:31:31
Size: 3312
Editor: ?ReynaldoVerdejo
Comment: drop redundant 'although'
Revision 33 as of 2021-08-15 13:04:52
Size: 4130
Comment: Update init-switching instructions for Bullseye
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
Since jessie, only systemd is fully supported; sysvinit is mostly supported, but Debian packages are not ''required'' to provide sysvinit start scripts. [[runit]] is also packaged, but has not received the same level of testing and support as the others, and is not currently supported as PID 1. Since jessie, only systemd is fully supported; sysvinit is mostly supported, but Debian packages are not ''required'' to provide sysvinit start scripts. Support for init systems other than systemd is significantly improved in [[DebianBullseye|Bullseye]]. [[runit]] is also packaged, but has not received the same level of testing and support as the others, and is not currently supported as PID 1. As of [[DebianBullseye|Bullseye]], a collection of sysvinit start scripts that have been removed from their original packages is provided in the [[DebPkg:orphan-sysvinit-scripts]] package.
Line 21: Line 21:
In [[DebianStretch|stretch]], you may change from systemd to sysvinit by performing these steps: In [[DebianBullseye|Bullseye]], a number of alternative init systems are supported (such as System-V-style init and OpenRC). Generally, to switch between init systems, you install the new init system and reboot. The exception is switching away from systemd - systemd's packages will refuse to be removed if systemd is running; so the process is a little more involved.
Line 23: Line 23:
 1. `apt-get install sysvinit-core`
 1. reboot
In outline, you need to download the new packages you need, switch to single-user mode, install these new packages, and then reboot. The recommended approach is as follows. First, clear out `/var/cache/apt/archives` by running `apt clean` (this makes identifying the packages to install later easier). Next, get `apt` to download the new packages you need, e.g.: `apt --download-only install sysvinit-core libpam-elogind`; [[DebPkg:libpam-elogind]] (and [[DebPkg:elogind]] which it Depends upon) provide session management facilities, which you will likely need on any system running a desktop environment. At this point, review `apt`'s proposed actions, and if happy, let it carry on.
Line 26: Line 25:
During most of stretch's time as testing, you could change from systemd to runit by performing these steps:

 1. `apt-get install runit-systemd`
 1. reboot
 1. `apt-get install runit-init`
 1. reboot again

However, the [[DebPkg:runit-init]] package was removed from Debian shortly before stretch's release. Currently, runit is ''not'' supported as an init system in Debian, although that may change in the future, and ''might'' work in testing or unstable, any attempt to do this is done at your own risk. (See DebianBug:861536 for discussion of the removal.)
Now switch to single-user mode (`systemctl rescue`) and install the packages you downloaded using `apt install /var/cache/apt/archives/*.deb` Once this has completed, reboot your system.

Translation(s): English - Français - Italiano - Русский


BootProcess > init


Init is the first program to run after your system is booted, and continues to run as process number 1 until your system halts. Init's job is to start other programs that are essential to the operation of your system. All other processes are descended from init.

Overview

The system initialization process is handled by the init daemon. In squeeze and earlier releases, that daemon is provided by the sysvinit package, and no alternatives are supported. In wheezy, the default init daemon is still sysvinit, but a "technology preview" of systemd is available. In jessie and stretch, the default init system is systemd, but switching to sysvinit is supported.

Since jessie, only systemd is fully supported; sysvinit is mostly supported, but Debian packages are not required to provide sysvinit start scripts. Support for init systems other than systemd is significantly improved in Bullseye. runit is also packaged, but has not received the same level of testing and support as the others, and is not currently supported as PID 1. As of Bullseye, a collection of sysvinit start scripts that have been removed from their original packages is provided in the orphan-sysvinit-scripts package.

Determining the init system

In general, you can determine which init system is installed by checking whether the /sbin/init file is a symlink. If it's not a symlink, then sysvinit is probably in use. If it's a symlink pointing to /lib/systemd/systemd then systemd is in use. If it's a symlink pointing to /lib/sysvinit/init then sysvinit is in use.

If you suspect that the init system may have been changed without a reboot, you may also cat /proc/1/comm to see which command name was used for the init daemon during the most recent boot.

Changing the init system

In Bullseye, a number of alternative init systems are supported (such as System-V-style init and OpenRC). Generally, to switch between init systems, you install the new init system and reboot. The exception is switching away from systemd - systemd's packages will refuse to be removed if systemd is running; so the process is a little more involved.

In outline, you need to download the new packages you need, switch to single-user mode, install these new packages, and then reboot. The recommended approach is as follows. First, clear out /var/cache/apt/archives by running apt clean (this makes identifying the packages to install later easier). Next, get apt to download the new packages you need, e.g.: apt --download-only install sysvinit-core libpam-elogind; libpam-elogind (and elogind which it Depends upon) provide session management facilities, which you will likely need on any system running a desktop environment. At this point, review apt's proposed actions, and if happy, let it carry on.

Now switch to single-user mode (systemctl rescue) and install the packages you downloaded using apt install /var/cache/apt/archives/*.deb Once this has completed, reboot your system.

Sysvinit configuration

The inittab configuration tells init what to do. Especially it contains the lines:

  • id:2:initdefault:
    
    si::sysinit:/etc/init.d/rcS
    
    l2:2:wait:/etc/init.d/rc 2

Which causes the files /etc/init.d/rcS to run initialization scripts (in /etc/rcS.d/*), then scripts for requested runlevel (in /etc/rcS.[0-9]/*).

See also


CategoryBootProcess