SDB:systemd
Systemd
systemd in openSUSE Factory installeren
Dit artikel is nog maar gedeeltelijk vertaald. Als u mee wilt helpen met vertalen lees dan Wiki vertalen naar het Nederlands. |
Please uninstall all earlier versions of systemd and systemd-sysvinit with
rpm -e --nodeps systemd systemd-sysvinit
before installing or updating new packages. Some needed logic inside the rpm runs only at the first installation of systemd.
A possible more recent version of systemd might be available from the Base:System repository: systemd. It usually takes a couple of days to move from there to Factory systemd.
Make sure you run a 2.6.36+ kernel with CONFIG_CGROUPS=y. Some kernel flavours, like -desktop, did not enable it. This should be fixed already, or be on the way to Factory.
# Use the Factory repo: zypper ar http://download.opensuse.org/factory/repo/oss/ Factory # Install systemd zypper install systemd
At this point systemd is installed in parallel with systemvinit. To actually use systemd as your init reboot your machine and append the following to your kernel command line arguments at the grub menu:
init=/bin/systemd
On the running system check the output of:
kay@yio:~> systemctl UNIT LOAD ACTIVE SUB JOB DESCRIPTION dev-hugepages.automount loaded active running Huge Pages File System Automount Point dev-mqueue.automount loaded active running POSIX Message Queue File System Automount Point proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point sys-kernel-debug.automount loaded active running Debug File System Automount Point sys-kernel-security.automount loaded active running Security File System Automount Point sys-devices-pc...0000:00:19.0-net-eth0.device loaded active plugged 82567LM Gigabit Network Connection sys-devices-pc...000:03:00.0-net-wlan0.device loaded active plugged Ultimate N WiFi Link 5300 sys-devices-pc...0:0-6:0:0:0-block-sdb.device loaded active plugged Flash_HS-CF sys-devices-pc...0:0-6:0:0:1-block-sdc.device loaded active plugged Flash_HS-COMBO sys-devices-pc...:0:0:0-block-sda-sda1.device loaded active plugged SAMSUNG_MMCQE28G8MUP-0VA sys-devices-pc...:0:0:0-block-sda-sda2.device loaded active plugged SAMSUNG_MMCQE28G8MUP-0VA sys-devices-pc...:0:0:0-block-sda-sda3.device loaded active plugged SAMSUNG_MMCQE28G8MUP-0VA sys-devices-pc...:0:0:0-block-sda-sda4.device loaded active plugged SAMSUNG_MMCQE28G8MUP-0VA sys-devices-pc...0:0-0:0:0:0-block-sda.device loaded active plugged SAMSUNG_MMCQE28G8MUP-0VA sys-devices-pl...-serial8250-tty-ttyS0.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0 sys-devices-pl...-serial8250-tty-ttyS1.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1 sys-devices-pl...-serial8250-tty-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2 sys-devices-pl...-serial8250-tty-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3 sys-devices-virtual-net-tun0.device loaded active plugged /sys/devices/virtual/net/tun0 sys-devices-virtual-tty-tty0.device loaded active plugged /sys/devices/virtual/tty/tty0 sys-devices-virtual-tty-tty1.device loaded active plugged /sys/devices/virtual/tty/tty1 sys-devices-virtual-tty-tty10.device loaded active plugged /sys/devices/virtual/tty/tty10 sys-devices-virtual-tty-tty11.device loaded active plugged /sys/devices/virtual/tty/tty11 sys-devices-virtual-tty-tty12.device loaded active plugged /sys/devices/virtual/tty/tty12 sys-devices-virtual-tty-tty2.device loaded active plugged /sys/devices/virtual/tty/tty2 sys-devices-virtual-tty-tty3.device loaded active plugged /sys/devices/virtual/tty/tty3 sys-devices-virtual-tty-tty4.device loaded active plugged /sys/devices/virtual/tty/tty4 sys-devices-virtual-tty-tty5.device loaded active plugged /sys/devices/virtual/tty/tty5 sys-devices-virtual-tty-tty6.device loaded active plugged /sys/devices/virtual/tty/tty6 sys-devices-virtual-tty-tty7.device loaded active plugged /sys/devices/virtual/tty/tty7 sys-devices-virtual-tty-tty8.device loaded active plugged /sys/devices/virtual/tty/tty8 sys-devices-virtual-tty-tty9.device loaded active plugged /sys/devices/virtual/tty/tty9 -.mount loaded active mounted / home-kay-.gvfs.mount loaded active mounted /home/kay/.gvfs home-kay-work.mount loaded active mounted /home/kay/work sys-kernel-security.mount loaded active mounted Security File System tmp.mount loaded active mounted Temporary Directory var-lock.mount loaded active mounted Lock Directory var-run.mount loaded active mounted Runtime Directory bluez-coldplug.service loaded active exited LSB: cups.service loaded active running LSB: CUPS printer daemon dbus.service loaded active running D-Bus System Message Bus getty@tty1.service loaded active running Getty on tty1 getty@tty2.service loaded active running Getty on tty2 getty@tty3.service loaded active running Getty on tty3 getty@tty4.service loaded active running Getty on tty4 getty@tty5.service loaded active running Getty on tty5 getty@tty6.service loaded active running Getty on tty6 localfs.service loaded active exited LSB: check and mount local filesystems except / network.service loaded active running LSB: Configure the localfs depending network interfaces rootfsck.service loaded active exited LSB: check and mount root filesystem sysctl.service loaded active exited Apply Kernel Variables syslog.service loaded active running LSB: Start the system logging daemons udev-settle.service loaded active exited udev Wait for Complete Device Initialization udev.service loaded active running udev Kernel Device Manager var-lock.service loaded active exited Lock Directory var-run.service loaded active exited Runtime Directory xdm.service loaded active running LSB: X Display Manager dbus.socket loaded active running D-Bus System Message Bus Socket systemd-initctl.socket loaded active listening systemd /dev/initctl Compatibility Socket systemd-logger.socket loaded active listening systemd Logging Socket systemd-shutdownd.socket loaded active listening systemd Delayed Shutdown Socket basic.target loaded active active Basic System getty.target loaded active active Login Prompts graphical.target loaded active active Graphical Interface local-fs.target loaded active active Local File Systems multi-user.target loaded active active Multi-User network.target loaded active active Network remote-fs.target loaded active active Remote File Systems sockets.target loaded active active Sockets swap.target loaded active active Swap sysinit.target loaded active active System Initialization LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. JOB = Pending job for the unit. 178 units listed. Pass --all to see inactive units, too.
for a starting point to understand what's going on. All tools have proper man pages and should provide much of the needed information.
Server admins that manage many user logins might want to check pam_systemd, install the pam module, check the output of systemd-cgls and see how systemd takes track over groups of processes belonging to a service or a logged-in user. The kernel cgroups make it possible to have control over the resources a specific service, a user or a login is able to take:
kay@yio:~> systemd-cgls β 2 [kthreadd] β 3 [ksoftirqd/0] β 4 [migration/0] β 5 [migration/1] ... β 718 [usb-storage] β user β β kay β β 1 β β 802 /usr/lib/gdm/gdm-session-worker β β 878 /usr/bin/gnome-session β β 19199 /bin/bash β β 19209 systemd-cgls β β 30209 /bin/bash β β 30234 xchat β systemd-1 β 1 /sbin/init β sys-kernel-security.mount β syslog.service β β 767 /sbin/rsyslogd -c 5 -f /etc/rsyslog.conf β cups.service β β 706 /usr/sbin/cupsd -C /etc/cups/cupsd.conf β avahi-daemon.service β β 682 avahi-daemon: running [yio.local] β xdm.service β β 708 /usr/sbin/gdm β β 723 /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1 β β 742 /usr/bin/Xorg :0 -br -verbose -auth /var/run/gdm/auth-for-gdm-s7iqVZ/database -nolisten tcp vt7 β dbus.service β β 583 /bin/dbus-daemon --system --address=systemd: --nofork --systemd-activation β β 724 /usr/sbin/modem-manager β β 761 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -f /var/log/wpa_supplicant.log β β 804 /usr/sbin/console-kit-daemon --no-daemon β β 977 /usr/lib/upower/upowerd β β 1010 /usr/lib/udisks/udisks-daemon β β 1015 udisks-daemon: polling /dev/sdd /dev/sdc β β 1089 /usr/lib/rtkit/rtkit-daemon β β 1093 /usr/lib/polkit-1/polkitd β cron.service β β 631 /usr/sbin/crond β network-remotefs.service β β 716 /usr/sbin/NetworkManager β β 786 /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-eth0.pid -lf /var/lib/dhcp/dhclient-cd731c1... β var-lock.mount β var-run.mount β udev.service β 55 /sbin/udevd β 19102 /sbin/udevd β 19103 /sbin/udevd
User/admin configuration of systemd takes place in /etc:
kay@yio:~> tree /etc/systemd/ /etc/systemd/ βββ session βββ system β βββ default.target -> /lib/systemd/system/runlevel5.target β βββ getty.target.wants β β βββ getty@tty1.service -> /lib/systemd/system/getty@.service β β βββ getty@tty2.service -> /lib/systemd/system/getty@.service β β βββ getty@tty3.service -> /lib/systemd/system/getty@.service β β βββ getty@tty4.service -> /lib/systemd/system/getty@.service β β βββ getty@tty5.service -> /lib/systemd/system/getty@.service β β βββ getty@tty6.service -> /lib/systemd/system/getty@.service β βββ local-fs.target.wants β β βββ tmp.service -> /lib/systemd/system/tmp.service β βββ multi-user.target.wants β β βββ remote-fs.target -> /lib/systemd/system/remote-fs.target βββ system.conf
Static configuration and native systemd service files installed by packages take place in /lib/systemd:
kay@yio:~> tree /lib/systemd/ /lib/systemd/ βββ system β βββ avahi-daemon.service β βββ avahi-daemon.socket β βββ avahi-dnsconfd.service β βββ basic.target β βββ basic.target.wants β β βββ console-kit-log-system-start.service -> ../console-kit-log-system-start.service β βββ bluetooth.target β βββ clock.service -> hwclock-load.service β βββ console-kit-daemon.service β βββ console-kit-log-system-restart.service β βββ console-kit-log-system-start.service β βββ console-kit-log-system-stop.service β βββ ctrl-alt-del.target -> reboot.target β βββ dbus.service β βββ dbus.socket β βββ dbus.target β βββ dbus.target.wants β β βββ dbus.socket -> ../dbus.socket β βββ default.target -> graphical.target β βββ dev-hugepages.automount β βββ dev-hugepages.mount β βββ dev-mqueue.automount β βββ dev-mqueue.mount β βββ emergency.service β βββ emergency.target β βββ fsck.target β βββ getty@.service β βββ getty.target β βββ graphical.target β βββ halt.service β βββ halt.target β βββ halt.target.wants β β βββ console-kit-log-system-stop.service -> ../console-kit-log-system-stop.service β βββ http-daemon.target β βββ hwclock-load.service β βββ hwclock-save.service β βββ local-fs.target β βββ local-fs.target.wants β β βββ var-lock.service -> ../var-lock.service β β βββ var-run.service -> ../var-run.service β βββ mail-transfer-agent.target β βββ multi-user.target β βββ multi-user.target.wants β β βββ dbus.service -> ../dbus.service β β βββ getty.target -> ../getty.target β βββ network.target β βββ nss-lookup.target β βββ poweroff.service β βββ poweroff.target β βββ poweroff.target.wants β β βββ console-kit-log-system-stop.service -> ../console-kit-log-system-stop.service β βββ printer.target β βββ proc-sys-fs-binfmt_misc.automount β βββ proc-sys-fs-binfmt_misc.mount β βββ random.service -> systemd-random-seed-load.service β βββ reboot.service β βββ reboot.target β βββ reboot.target.wants β β βββ console-kit-log-system-restart.service -> ../console-kit-log-system-restart.service β βββ remote-fs.target β βββ remount-rootfs.service β βββ rescue.target β βββ rpcbind.target β βββ rtc-set.target β βββ runlevel0.target -> poweroff.target β βββ runlevel1.target -> rescue.target β βββ runlevel1.target.wants β β βββ systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service β βββ runlevel2.target -> multi-user.target β βββ runlevel2.target.wants β β βββ systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service β βββ runlevel3.target -> multi-user.target β βββ runlevel3.target.wants β β βββ systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service β βββ runlevel4.target -> multi-user.target β βββ runlevel4.target.wants β β βββ systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service β βββ runlevel5.target -> graphical.target β βββ runlevel5.target.wants β β βββ systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service β βββ runlevel6.target -> reboot.target β βββ serial-getty@.service β βββ shutdown.target β βββ shutdown.target.wants β β βββ hwclock-save.service -> ../hwclock-save.service β β βββ systemd-random-seed-save.service -> ../systemd-random-seed-save.service β β βββ systemd-update-utmp-shutdown.service -> ../systemd-update-utmp-shutdown.service β βββ sigpwr.target β βββ smartcard.target β βββ sockets.target β βββ sockets.target.wants β β βββ dbus.socket -> ../dbus.socket β β βββ systemd-initctl.socket -> ../systemd-initctl.socket β β βββ systemd-logger.socket -> ../systemd-logger.socket β β βββ systemd-shutdownd.socket -> ../systemd-shutdownd.socket β βββ swap.target β βββ sysctl.service β βββ sysinit.target β βββ sysinit.target.wants β β βββ dev-hugepages.automount -> ../dev-hugepages.automount β β βββ dev-mqueue.automount -> ../dev-mqueue.automount β β βββ proc-sys-fs-binfmt_misc.automount -> ../proc-sys-fs-binfmt_misc.automount β β βββ sysctl.service -> ../sysctl.service β β βββ sys-kernel-debug.automount -> ../sys-kernel-debug.automount β β βββ sys-kernel-security.automount -> ../sys-kernel-security.automount β β βββ systemd-modules-load.service -> ../systemd-modules-load.service β β βββ systemd-random-seed-load.service -> ../systemd-random-seed-load.service β β βββ systemd-vconsole-setup.service -> ../systemd-vconsole-setup.service β β βββ tmpwatch.service -> ../tmpwatch.service β β βββ tmpwatch.timer -> ../tmpwatch.timer β β βββ udev-retry.service -> ../udev-retry.service β β βββ udev.service -> ../udev.service β β βββ udev-settle.service -> ../udev-settle.service β βββ sys-kernel-debug.automount β βββ sys-kernel-debug.mount β βββ sys-kernel-security.automount β βββ sys-kernel-security.mount β βββ syslog.target β βββ systemd-auto-serial-getty.service β βββ systemd-initctl.service β βββ systemd-initctl.socket β βββ systemd-kmsg-syslogd.service β βββ systemd-kmsg-syslogd.socket β βββ systemd-logger.service β βββ systemd-logger.socket β βββ systemd-modules-load.service β βββ systemd-random-seed-load.service β βββ systemd-random-seed-save.service β βββ systemd-remount-api-vfs.service β βββ systemd-shutdownd.service β βββ systemd-shutdownd.socket β βββ systemd-update-utmp-runlevel.service β βββ systemd-update-utmp-shutdown.service β βββ systemd-vconsole-setup.service β βββ tmp.mount β βββ tmp.service β βββ tmpwatch.service β βββ tmpwatch.timer β βββ udev_retry.service -> udev-retry.service β βββ udev-retry.service β βββ udev.service β βββ udev-settle.service β βββ umount.target β βββ var-lock.mount β βββ var-lock.service β βββ var-run.mount β βββ var-run.service βββ systemd-auto-serial-getty βββ systemd-cgroups-agent βββ systemd-initctl βββ systemd-kmsg-syslogd βββ systemd-logger βββ systemd-modules-load βββ systemd-random-seed βββ systemd-remount-api-vfs βββ systemd-reply-password βββ systemd-shutdownd βββ systemd-update-utmp βββ systemd-vconsole-setup
Systemd mounts afew filesystems natively, and some others are provided as automounts, which are activated on demand when accessed:
kay@yio:~> cat /proc/self/mountinfo 13 1 259:524288 / / rw,noatime - ext4 /dev/root rw,user_xattr,acl,barrier=1,data=ordered 14 13 0:5 / /dev rw,relatime - devtmpfs devtmpfs rw,size=1965248k,nr_inodes=491312,mode=755 15 13 0:3 / /proc rw,relatime - proc proc rw 16 13 0:13 / /sys rw,relatime - sysfs sysfs rw 17 14 0:14 / /dev/shm rw,relatime - tmpfs tmpfs rw 18 14 0:10 / /dev/pts rw,relatime - devpts devpts rw,mode=600 19 13 0:15 / /cgroup rw,nosuid,nodev,noexec,relatime - tmpfs tmpfs rw,mode=755 20 19 0:16 / /cgroup/systemd rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd 21 14 0:17 / /dev/mqueue rw,relatime - autofs systemd-1 rw,fd=15,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 22 16 0:18 / /sys/kernel/security rw,relatime - autofs systemd-1 rw,fd=16,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 23 15 0:19 / /proc/sys/fs/binfmt_misc rw,relatime - autofs systemd-1 rw,fd=17,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 24 16 0:20 / /sys/kernel/debug rw,relatime - autofs systemd-1 rw,fd=18,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 25 14 0:21 / /dev/hugepages rw,relatime - autofs systemd-1 rw,fd=19,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 26 25 0:22 / /dev/hugepages rw,relatime - hugetlbfs hugetlbfs rw 27 21 0:12 / /dev/mqueue rw,relatime - mqueue mqueue rw 28 13 259:786432 / /home/kay/work rw,noatime - ext3 /dev/sda3 rw,errors=continue,user_xattr,acl,barrier=0,data=writeback 29 13 0:23 / /var/run rw,relatime - tmpfs tmpfs rw,mode=755 30 13 0:24 / /var/lock rw,relatime - tmpfs tmpfs rw,mode=775,gid=54 31 16 0:25 / /sys/fs/fuse/connections rw,relatime - fusectl fusectl rw 32 13 0:26 / /home/kay/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=2702,group_id=100
A typical bootup adds something like this to the kernel log (dmesg):
[ 2.289347] Freeing unused kernel memory: 2228k freed [ 2.396738] init[1]: systemd 10 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX; suse) [ 2.490912] init[1]: Set hostname to <yio>. [ 2.902303] udev[53]: starting version 162 ... [ ] init[1]: Startup finished in 2s 492ms 633us (kernel) + 7s 303ms 506us (userspace) = 9s 796ms 139us.
To permanently switch-over, without any bootloader options, the RPM package systemd-sysvinit can be installed, which conflicts with the currently used sysvinit.
In case things go wrong during the current development cycle, it might be nice to have a copy of sysvinit's /sbin/init as /sbin/init.sysv laying around, to be able to repair a systemd-only system, which might be slightly more convenient than init=/bin/bash.
That's it! If things break try some of the Documentation.
The developers can be found at #systemd at irc.freenode.net.
Common Problems
Services not starting as expected
Even though chkconfig cron shows that cron should be enabled, it seems not to be started after boot. systemctl start cron.service starts it just fine. See Bug #660493.
systemctl enable cron.service helps here.
Loop mounts not working without manually loading the "loop" module
See Bug #661715. With SysV init, the loop module was unconditionally loaded by /etc/init.d/boot.localfs which is not used anymore. If you want to autoload it anyway, do
echo loop > /etc/modules-load.d/loop.conf
Getting debug from systemd
To get debug from systemd, you can either :
- remove quiet from kernel command line
- increase systemd verbosity by adding systemd.log_target=kmsg systemd.log_level=debug to kernel command line. You can also add systemd.sysv_console=1 (0: disabled, 1: enabled) to display legacy SysV initscripts output on console.
- modify /etc/systemd/system.conf (check man systemd.conf) to increase verbosity like this :
LogLevel=debug LogTarget=syslog-or-kmsg SysVConsole=yes
serial console isn't working
By default, systemd starts a minimal set of getty to let the system accessible.
When specifying on kernel command line which serial console should be used, only the last one in the list (which define the "active" console), will get a getty started :
- console=tty0 console=ttyS0 will start a console on both tty0 (ie physical console) and serial console
- console=ttyS0 console=tty0 will only start a console on tty0
To force starting console on serial port, use :
ln -s /lib/systemd/systemd/serial-getty@.service /etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service