Linux systemd启动流程
生活随笔
收集整理的這篇文章主要介紹了
Linux systemd启动流程
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
以Ubuntu 18.04.2 LTS為例,列出Systemd啟動target中涉及單元(Unit).
?default.target (= graphical.target by default)
graphical.targetRequires=multi-user.targetWants=display-manager.serviceConflicts=rescue.service rescue.targetAfter=multi-user.target rescue.service rescue.target display-manager.serviceAllowIsolate=yes# ls -l /etc/systemd/system/display-manager.service lrwxrwxrwx 1 root root 32 6月 3 2019 /etc/systemd/system/display-manager.service -> /lib/systemd/system/gdm3.service[Unit]After=getty@tty1.serviceAfter=rc-local.service plymouth-start.service systemd-user-sessions.serviceOnFailure=plymouth-quit.service[Service]ExecStartPre=/usr/share/gdm/generate-configExecStart=/usr/sbin/gdm3# ls -l /lib/systemd/system/graphical.target.wants/ lrwxrwxrwx 1 root root 39 6月 3 2019 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service[Unit]Requisite=systemd-update-utmp.serviceAfter=systemd-update-utmp.serviceAfter=runlevel1.target runlevel2.target runlevel3.target runlevel4.target runlevel5.targetBefore=shutdown.target[Service]ExecStart=/lib/systemd/systemd-update-utmp runlevel# ls -l /etc/systemd/system/graphical.target.wants/ lrwxrwxrwx 1 root root 43 6月 3 2019 accounts-daemon.service -> /lib/systemd/system/accounts-daemon.service lrwxrwxrwx 1 root root 35 6月 3 2019 udisks2.service -> /lib/systemd/system/udisks2.service?Multi-user.target
Multi-user.target[Unit]Description=Multi-User SystemDocumentation=man:systemd.special(7)Requires=basic.targetConflicts=rescue.service rescue.targetAfter=basic.target rescue.service rescue.targetAllowIsolate=yes# ls -l /lib/systemd/system/multi-user.target.wants/ lrwxrwxrwx 1 root root 15 6月 3 2019 dbus.service -> ../dbus.service lrwxrwxrwx 1 root root 15 6月 3 2019 getty.target -> ../getty.target lrwxrwxrwx 1 root root 24 6月 3 2019 plymouth-quit.service -> ../plymouth-quit.service lrwxrwxrwx 1 root root 29 6月 3 2019 plymouth-quit-wait.service -> ../plymouth-quit-wait.service lrwxrwxrwx 1 root root 33 6月 3 2019 systemd-ask-password-wall.path -> ../systemd-ask-password-wall.path lrwxrwxrwx 1 root root 25 6月 3 2019 systemd-logind.service -> ../systemd-logind.service lrwxrwxrwx 1 root root 39 6月 3 2019 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service lrwxrwxrwx 1 root root 32 6月 3 2019 systemd-user-sessions.service -> ../systemd-user-sessions.service# ls -l /etc/systemd/system/multi-user.target.wants/ lrwxrwxrwx 1 root root 35 6月 3 2019 anacron.service -> /lib/systemd/system/anacron.service lrwxrwxrwx 1 root root 40 6月 3 2019 avahi-daemon.service -> /lib/systemd/system/avahi-daemon.service lrwxrwxrwx 1 root root 42 7月 31 2019 binfmt-support.service -> /lib/systemd/system/binfmt-support.service lrwxrwxrwx 1 root root 41 6月 3 2019 console-setup.service -> /lib/systemd/system/console-setup.service lrwxrwxrwx 1 root root 38 2月 5 2021 containerd.service -> /lib/systemd/system/containerd.service lrwxrwxrwx 1 root root 32 6月 3 2019 cron.service -> /lib/systemd/system/cron.service lrwxrwxrwx 1 root root 40 6月 3 2019 cups-browsed.service -> /lib/systemd/system/cups-browsed.service lrwxrwxrwx 1 root root 29 6月 3 2019 cups.path -> /lib/systemd/system/cups.path lrwxrwxrwx 1 root root 37 6月 3 2019 dns-clean.service -> /lib/systemd/system/dns-clean.service lrwxrwxrwx 1 root root 38 6月 3 2019 irqbalance.service -> /lib/systemd/system/irqbalance.service lrwxrwxrwx 1 root root 38 6月 3 2019 kerneloops.service -> /lib/systemd/system/kerneloops.service lrwxrwxrwx 1 root root 40 6月 3 2019 ModemManager.service -> /lib/systemd/system/ModemManager.service lrwxrwxrwx 1 root root 47 6月 3 2019 networkd-dispatcher.service -> /lib/systemd/system/networkd-dispatcher.service lrwxrwxrwx 1 root root 38 6月 3 2019 networking.service -> /lib/systemd/system/networking.service lrwxrwxrwx 1 root root 42 6月 3 2019 NetworkManager.service -> /lib/systemd/system/NetworkManager.service lrwxrwxrwx 1 root root 36 6月 3 2019 ondemand.service -> /lib/systemd/system/ondemand.service lrwxrwxrwx 1 root root 36 6月 3 2019 pppd-dns.service -> /lib/systemd/system/pppd-dns.service lrwxrwxrwx 1 root root 36 6月 3 2019 remote-fs.target -> /lib/systemd/system/remote-fs.target lrwxrwxrwx 1 root root 33 6月 3 2019 rsync.service -> /lib/systemd/system/rsync.service lrwxrwxrwx 1 root root 35 6月 3 2019 rsyslog.service -> /lib/systemd/system/rsyslog.service ...... lrwxrwxrwx 1 root root 31 2月 5 2021 ssh.service -> /lib/systemd/system/ssh.service lrwxrwxrwx 1 root root 44 6月 3 2019 systemd-resolved.service -> /lib/systemd/system/systemd-resolved.service lrwxrwxrwx 1 root root 36 6月 3 2019 thermald.service -> /lib/systemd/system/thermald.service lrwxrwxrwx 1 root root 38 2月 5 2021 ubuntu-fan.service -> /lib/systemd/system/ubuntu-fan.service lrwxrwxrwx 1 root root 31 6月 3 2019 ufw.service -> /lib/systemd/system/ufw.service lrwxrwxrwx 1 root root 47 6月 3 2019 unattended-upgrades.service -> /lib/systemd/system/unattended-upgrades.service lrwxrwxrwx 1 root root 42 6月 3 2019 wpa_supplicant.service -> /lib/systemd/system/wpa_supplicant.servicebasic.target
basic.target[Unit]Description=Basic SystemDocumentation=man:systemd.special(7)Requires=sysinit.targetWants=sockets.target timers.target paths.target slices.targetAfter=sysinit.target sockets.target paths.target slices.target tmp.mountRequiresMountsFor=/var /var/tmpWants=tmp.mount# ls -l /lib/systemd/system/sockets.target -rw-r--r-- 1 root root 396 1月 28 2018 /lib/systemd/system/sockets.target # ls -l /lib/systemd/system/sockets.target.wants lrwxrwxrwx 1 root root 14 6月 3 2019 dbus.socket -> ../dbus.socket lrwxrwxrwx 1 root root 25 6月 3 2019 systemd-initctl.socket -> ../systemd-initctl.socket lrwxrwxrwx 1 root root 32 6月 3 2019 systemd-journald-audit.socket -> ../systemd-journald-audit.socket lrwxrwxrwx 1 root root 34 6月 3 2019 systemd-journald-dev-log.socket -> ../systemd-journald-dev-log.socket lrwxrwxrwx 1 root root 26 6月 3 2019 systemd-journald.socket -> ../systemd-journald.socket lrwxrwxrwx 1 root root 31 6月 3 2019 systemd-udevd-control.socket -> ../systemd-udevd-control.socket lrwxrwxrwx 1 root root 30 6月 3 2019 systemd-udevd-kernel.socket -> ../systemd-udevd-kernel.socket # ls -l /etc/systemd/system/sockets.target.wants/ lrwxrwxrwx 1 root root 32 6月 3 2019 acpid.socket -> /lib/systemd/system/acpid.socket lrwxrwxrwx 1 root root 41 6月 3 2019 apport-forward.socket -> /lib/systemd/system/apport-forward.socket lrwxrwxrwx 1 root root 39 6月 3 2019 avahi-daemon.socket -> /lib/systemd/system/avahi-daemon.socket lrwxrwxrwx 1 root root 31 6月 3 2019 cups.socket -> /lib/systemd/system/cups.socket lrwxrwxrwx 1 root root 33 2月 5 2021 docker.socket -> /lib/systemd/system/docker.socket lrwxrwxrwx 1 root root 32 6月 3 2019 snapd.socket -> /lib/systemd/system/snapd.socket lrwxrwxrwx 1 root root 32 6月 3 2019 uuidd.socket -> /lib/systemd/system/uuidd.socket# ls -l /lib/systemd/system/timers.target -rw-r--r-- 1 root root 445 1月 28 2018 /lib/systemd/system/timers.target # ls -l /lib/systemd/system/timers.target.wants lrwxrwxrwx 1 root root 31 6月 3 2019 systemd-tmpfiles-clean.timer -> ../systemd-tmpfiles-clean.timer # ls -l /etc/systemd/system/timers.target.wants/ lrwxrwxrwx 1 root root 33 6月 3 2019 anacron.timer -> /lib/systemd/system/anacron.timer lrwxrwxrwx 1 root root 35 6月 3 2019 apt-daily.timer -> /lib/systemd/system/apt-daily.timer lrwxrwxrwx 1 root root 43 6月 3 2019 apt-daily-upgrade.timer -> /lib/systemd/system/apt-daily-upgrade.timer lrwxrwxrwx 1 root root 32 6月 3 2019 fstrim.timer -> /lib/systemd/system/fstrim.timer lrwxrwxrwx 1 root root 35 6月 3 2019 motd-news.timer -> /lib/systemd/system/motd-news.timer lrwxrwxrwx 1 root root 43 6月 3 2019 snapd.snap-repair.timer -> /lib/systemd/system/snapd.snap-repair.timer# ls -l /lib/systemd/system/paths.target -rw-r--r-- 1 root root 394 1月 28 2018 /lib/systemd/system/paths.target # ls -l /etc/systemd/system/paths.target.wants/ lrwxrwxrwx 1 root root 30 6月 3 2019 acpid.path -> /lib/systemd/system/acpid.path lrwxrwxrwx 1 root root 42 6月 3 2019 apport-autoreport.path -> /lib/systemd/system/apport-autoreport.path# ls -l /lib/systemd/system/slices.target -rw-r--r-- 1 root root 449 1月 28 2018 /lib/systemd/system/slices.targetsysinit.target
sysinit.target[Unit]Description=System InitializationDocumentation=man:systemd.special(7)Conflicts=emergency.service emergency.targetWants=local-fs.target swap.targetAfter=local-fs.target swap.target emergency.service emergency.target# ls -l /lib/systemd/system/local-fs.target -rw-r--r-- 1 root root 547 1月 28 2018 /lib/systemd/system/local-fs.target # ls -l /lib/systemd/system/local-fs.target.wants/ lrwxrwxrwx 1 root root 29 6月 3 2019 systemd-remount-fs.service -> ../systemd-remount-fs.service# ls -l /lib/systemd/system/swap.target -rw-r--r-- 1 root root 393 1月 28 2018 /lib/systemd/system/swap.targetlocal-fs.target
local-fs.target Conflicts=shutdown.targetAfter=local-fs-pre.targetOnFailure=emergency.targetOnFailureJobMode=replace-irreversibly # ls /lib/systemd/system/local-fs.target.wants/ lrwxrwxrwx 1 root root 29 6月 3 2019 systemd-remount-fs.service -> ../systemd-remount-fs.servicesystemd-remount-fs.serviceAfter=systemd-fsck-root.serviceBefore=local-fs-pre.target local-fs.target shutdown.targetWants=local-fs-pre.targetConditionPathExists=/etc/fstabExecStart=/lib/systemd/systemd-remount-fssystemd-fsck-root.serviceWants=systemd-fsckd.socketBefore=local-fs.target shutdown.targetAfter=systemd-fsckd.socketExecStart=/lib/systemd/systemd-fsck總結
以上是生活随笔為你收集整理的Linux systemd启动流程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C++Primer 第15章 OOP
- 下一篇: 微信隐藏代码 1