Differences between revisions 247 and 248
Revision 247 as of 2015-02-18 14:08:24
Size: 9539
Editor: kao
Comment: add link to the french page
Revision 248 as of 2015-03-28 23:49:45
Size: 9806
Editor: ?ChrisBainbridge
Comment: Kernel debug without systemd debug in Jessie
Deletions are marked like this. Additions are marked like this.
Line 132: Line 132:
=== Kernel debug without systemd debug in Jessie ===

Using the old "debug" kernel parameter in Jessie will turn on systemd debug logging as well as kernel debug logging. To get the old behaviour, do not use "debug", instead use the kernel parameter "loglevel=7".

Translation(s): English - Español - Français - Russian

systemd - system and service manager


systemd is a system and service manager for Linux. systemd is compatible with SysV and LSB init scripts. It can work as a drop-in replacement for sysvinit. Systemd

  • Provides aggressive parallelization capabilities
  • Uses socket and D-Bus activation for starting services
  • Offers on-demand starting of daemons
  • Implements transactional dependency-based service control logic
  • Tracks processes using Linux cgroups
  • Supports snapshotting and restoring
  • Maintains mount and automount points

Please see the upstream page for more information.

Installing and Testing

systemd was included in Debian wheezy as a technology preview. Please make sure that you are using Debian testing or newer to get a recent version of systemd.


To install systemd run:

# apt-get update
# apt-get install systemd

This will install the systemd packages but will not configure systemd as your init system.

Configuring for testing

To test systemd before switching to it by default, you can add the following boot parameter to the kernel:


This can be done in the grub menu for a single boot - press "e" in the grub menu and add this to the kernel line. For example, depending on the options required for your particular system, it might look something like:

linux   /vmlinuz-3.13-1-amd64 root=/dev/mapper/root-root init=/bin/systemd ro quiet

If PID 1 is systemd then your system is running with systemd.

Configuring as default

In order to use systemd you should also install systemd-sysv which provides the symlinks links for /sbin/init.

# apt-get install systemd-sysv

In order to boot your system with the newly installed systemd, simply reboot.

# reboot

If you run a self-compiled kernel, make sure you have 2.6.39 or newer and enable the following options:

 * CONFIG_IPV6=[y|m], optional, but highly recommended
 * CONFIG_FANOTIFY=y, optional, required for systemd readahead. available in Linux kernel >= 2.6.37.

For an up-to-date list, see section "REQUIREMENTS" in the upstream README file.


Sometimes it is necessary to investigate why systemd hangs on startup or on reboot/shutdown.

Solution #0: Remove "quiet" from Kernel command line (so called "cmdline" or "grub line")

Solution #1: Increase verbosity via cmdline: Add "systemd.log_target=kmsg systemd.log_level=debug"

Of course you can have a "temporary" persistent solution:

[ /etc/default/grub ]
GRUB_CMDLINE_LINUX="systemd.log_target=kmsg systemd.log_level=debug" <--- Add here (by uncommenting you can easily switch to debug)

# update-grub

Solution #2: Increase verbosity via /etc/systemd/system.conf

LogLevel=debug           <--- Uncomment this line and use "debug" (default: commented and "info")
LogTarget=syslog-or-kmsg <--- Uncomment this line (default: commented)

Solution #3: Boot an emergency shell: Add systemd.unit=rescue.target or just 1 (the number one) to the kernel command line.

Solution #4: Enable the debug shell: Run systemctl enable debug-shell.service. (You can do this in a chroot environment after booting a rescue system.) This starts a root shell on TTY 9.

HINT: "man systemd" and "man systemd-system.conf"

HINT: Extensive debugging information about systemd is on this FreeDesktop page.

HINT: How to check Kernel command line parameters/options?

# cat /proc/cmdline

NOTE on LogLevel (see systemd(1) and systemd-system.conf(5)):

"Set log level. As argument this accepts a numerical log level or the well-known syslog(3) symbolic names (lowercase): emerg, alert, crit, err, warning, notice, info, debug."

HINT: Keep a copy of /sbin/init from sysvinit package in case of rescue (so you can use init=/sbin/init.sysvinit in cmdline)!

# cp -av /sbin/init /sbin/init.sysvinit <--- Before installing systemd-sysv package

See also http://fedoraproject.org/wiki/How_to_debug_Systemd_problems

Kernel debug without systemd debug in Jessie

Using the old "debug" kernel parameter in Jessie will turn on systemd debug logging as well as kernel debug logging. To get the old behaviour, do not use "debug", instead use the kernel parameter "loglevel=7".

Bugs and Bug-Tracking-Systems

Known Issues and Workarounds

sysvinit vs. systemd-sysv

Upgrade to sysvinit ≥ 2.88dsf-44.

Encrypted swap blocks boot

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712439#70 for a patch.

According to the bug, the patch is no longer required as long as you upgrade to dmsetup 2:1.02.83-1.

Booting with lvm (especially with separate /usr) fails

Upgrade to lvm2 ≥ 2.02.104-1

Shared bind mounts

The default behavior of bind mounts changes under systemd. The Linux kernel makes bind mounts of anything below / PRIVATE. Systemd changes this to SHARED.

Thus, when you do this:

    mount --bind / $CHROOT
    mount --bind /dev/ $CHROOT/dev
    umount $CHROOT/dev

then /dev will be unmounted in your base/parent system as well!

What you can do now instead, to is to:

    mount --bind --make-rslave / $CHROOT
    mount --bind --make-rslave /dev/ $CHROOT/dev

this will propagate mount changes (also mount options) in the base/parent system into the $CHROOT but not from the $CHROOT back to the parent.

The rationale for the change of the default behavior can be found in bug 739593, in particularily in Lenart's comment therein.

Where to get help?

Systemd is a young project with a strong emphasis on solving problems in a distribution agnostic manner.

Debian specific channels include

Several other distributions are using systemd

Installing without systemd

Jessie installs systemd by default on new installs. Should one desire to install without systemd, i.e use sysvinit-core instead (old sysV5 init), it is possible to use preseed to replace systemd with sysvinit at the end of the install (This probably won't work if selecting one of the desktop environments that require systemd specific features however). If using a preseed file already, just make sure to set the preseed value

preseed/late_command="in-target apt-get install -y sysvinit-core"

If not using a preseed file, this can be added to the boot arguments instead by hitting TAB at the boot menu on the desired entry and appending the above preseed line at the end of the boot command.

There may still be a few bits of systemd installed, but at least init itself is not systemd and cleaning up any remaining pieces should not be too hard.

Debian Resources

Other Resources