Differences between revisions 13 and 38 (spanning 25 versions)
Revision 13 as of 2007-10-07 00:14:40
Size: 818
Editor: FranklinPiat
Comment: s/boot/Boot/
Revision 38 as of 2021-12-09 11:46:00
Size: 6858
Comment: make translation header easy to include in translated pages + interwiki links
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
["BootProcess"] > init ##For Translators - to have a constantly up to date translation header in you page, you can just add a line like the following (with the comment's character at the start of the line removed)
## <<Include(Init, ,from="^##TAG:TRANSLATION-HEADER-START",to="^##TAG:TRANSLATION-HEADER-END")>>
##TAG:TRANSLATION-HEADER-START
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: [[Init|English]] - [[fr/Init|Français]] - [[it/Init|Italiano]] - [[ru/Init|Русский]] -~
##TAG:TRANSLATION-HEADER-END
Line 4: Line 9:
Debian's init scripts (the scripts that runs at ["Boot"] time ) are found in the directory /etc/init.d/ [[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.
<<TableOfContents()>>
Line 6: Line 14:
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 processes are descended from init. For more information, see the manual page init(8). == Overview ==
The system initialization process is handled by the {{{init}}} daemon. In [[DebianSqueeze|squeeze]] and earlier releases, that daemon is provided by the sysvinit package, and no alternatives are supported. In [[DebianWheezy|wheezy]], the default init daemon is still sysvinit, but a "technology preview" of [[systemd]] is available. In [[DebianJessie|jessie]] and [[DebianStretch|stretch]], the default init system is [[systemd]], but switching to sysvinit is supported.
Line 8: Line 17:
See also:
 * [http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=init Init man page].
 * [http://linuxreviews.net/man/init/ Init(8) man page].
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 [[DebianPackage: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 - at installation time ==

The easiest time to choose an init other than systemd is at installation time (since systemd's packages will refuse to be removed if systemd is running).

The best time to perform the switch is after the "Selecting and installing software" stage. Note that the default GNOME desktop is harder to get to work without systemd in [[DebianBullseye|Bullseye]] (because its usual display manager [[DebianPackage:gdm3]] declares a dependency on [[DebianPackage:libpam-systemd]] - see DebianBug:991880), so if you want a desktop environment it will be easier to deselect GNOME and select another (Xfce, KDE Plasma, LXDE, Cinnamon, MATE, and LXQt have all been tested without systemd).

Once that stage is complete, launch a shell, and chroot into the installed system by typing `chroot /target`. You then need to tell `apt` to install your preferred init system and, unless you are not using a desktop environment at all, libpam-elogind to provide the necessary elogind session management facilities (which are provided by libpam-systemd and systemd in a default installation). For example, for System-V-like init, type `apt install sysvinit-core libpam-elogind`. This will install your new init system and elogind, and remove systemd, libpam-systemd and other components that can only work with systemd. If `apt` is proposing to remove a very large number of packages, then you probably selected a desktop environment that depends on systemd; it will be best to stop at this point and go back to the task selector to chose another instead.

Once that is done, exit the chroot by typing `exit`, then switch back to the installer (if you were using a different virtual console by switching back; if you had selected the "Execute a shell" menu option, then by typing `exit` once more), and resume the installation by moving to the boot loader installation stage, which is typically installing GRUB. You can now complete the installation process as normal.

== Changing the init system - on a running system ==

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.

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`; [[DebianPackage:libpam-elogind]] (and [[DebianPackage: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 DebianMan:inittab configuration tells [[DebianPackage:sysvinit-core|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|runlevel]] (in /etc/rcS.[0-9]/*).


== Getting help ==

If you encounter any issues specifically associated with using an alternative init system, there is a [[https://www.chiark.greenend.org.uk/mailman/listinfo/debian-init-diversity/|Debian init system diversity list]] that may be able to help.

== See also ==
 * [[DebianMan:1/init|Init(1) man page]] (from [[DebianPackage:systemd-sysv]]).
 * [[DebianMan:8/init|Init(8) man page]] (from [[DebianPackage:sysvinit-core]]).
Line 12: Line 64:
 * ["Initrd"]
 * ImportantDirectories
 * http://www.debianhelp.org/print.php?sid=3306
 * [[Initrd]]
Line 16: Line 66:
 
----
CategoryBootProcess

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 - at installation time

The easiest time to choose an init other than systemd is at installation time (since systemd's packages will refuse to be removed if systemd is running).

The best time to perform the switch is after the "Selecting and installing software" stage. Note that the default GNOME desktop is harder to get to work without systemd in Bullseye (because its usual display manager gdm3 declares a dependency on libpam-systemd - see 991880), so if you want a desktop environment it will be easier to deselect GNOME and select another (Xfce, KDE Plasma, LXDE, Cinnamon, MATE, and LXQt have all been tested without systemd).

Once that stage is complete, launch a shell, and chroot into the installed system by typing chroot /target. You then need to tell apt to install your preferred init system and, unless you are not using a desktop environment at all, libpam-elogind to provide the necessary elogind session management facilities (which are provided by libpam-systemd and systemd in a default installation). For example, for System-V-like init, type apt install sysvinit-core libpam-elogind. This will install your new init system and elogind, and remove systemd, libpam-systemd and other components that can only work with systemd. If apt is proposing to remove a very large number of packages, then you probably selected a desktop environment that depends on systemd; it will be best to stop at this point and go back to the task selector to chose another instead.

Once that is done, exit the chroot by typing exit, then switch back to the installer (if you were using a different virtual console by switching back; if you had selected the "Execute a shell" menu option, then by typing exit once more), and resume the installation by moving to the boot loader installation stage, which is typically installing GRUB. You can now complete the installation process as normal.

Changing the init system - on a running 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]/*).

Getting help

If you encounter any issues specifically associated with using an alternative init system, there is a Debian init system diversity list that may be able to help.

See also


CategoryBootProcess