linux 的啟動時間非常慢 - 如何改進
sudo systemd-analyze Startup finished in 35.729s (firmware) + 5.933s (loader) + 32.920s (kernel) + 3min 18.149s (userspace) = 4min 32.732s graphical.target reached after 2min 46.619s in userspace
和
systemd-analyze blame 1min 41.665s sendmail.service 1min 31.112s podman-auto-update.service 1min 19.116s postgresql@10-main.service 1min 17.766s postgresql@12-main.service 1min 17.311s postgresql@13-main.service 59.659s mpd.service 37.709s user@1000.service 34.906s systemd-networkd-wait-online.service 33.412s nmbd.service 33.152s apache2.service 30.795s lightdm.service 30.746s plymouth-quit-wait.service 29.475s vmware.service 27.070s udisks2.service 24.988s networkd-dispatcher.service 23.200s accounts-daemon.service 19.811s lxc-net.service 15.702s upower.service 14.965s avahi-daemon.service 14.964s NetworkManager.service 14.573s NetworkManager-wait-online.service 14.191s polkit.service 14.189s power-profiles-daemon.service 14.022s switcheroo-control.service 14.016s wpa_supplicant.service 13.695s systemd-udev-settle.service 13.529s systemd-logind.service 13.513s vmware-USBArbitrator.service 12.911s dev-sda2.device
系統資訊
,g$$$$$$$$$$$$$$$P. OS: Debian 11 bullseye ,g$$P"" """Y$$.". Kernel: x86_64 Linux 5.11.0-18-generic ,$$P' `$$$. Uptime: 18m ',$$P ,ggs. `$$b: Packages: 6057 `d$$' ,$P"' . $$$ Shell: bash $$P d$' , $$P Resolution: 1920x1080 $$: $$. - ,d$$' DE: KDE 5.80.0 / Plasma 5.21.4 $$\; Y$b._ _,d$P' WM: KWin Y$$. `.`"Y$$$$P"' GTK Theme: Breeze [GTK2], Adwaita [GTK3] `$$b "-.__ Icon Theme: breeze `Y$$ Disk: 569G / 1.4T (44%) `Y$$. CPU: Intel Core i5-4570S @ 4x 3.6GHz [30.0°C] `$$b. GPU: NV138 `Y$$b. RAM: 3043MiB / 7909MiB `"Y$b._
我有 4 個硬碟通過 USB 集線器連接,2 個 USB 硬碟連接到 USB 埠。所有硬碟外部西方護照。但只有 on1 磁碟在引導時自動掛載。
我已經安裝了 minisql(更快的 postgresql 替代品?)我將我的 android 手機連接到 pc。我有有線網際網路。
a) sendmail 服務花了將近 2 分鐘 - 我可以禁用嗎?b) psotgresql 替代品?為什麼是 3 個實例?c) 音樂網路的 mpd 服務非常慢。備擇方案?
所以如果修復這些問題,我的啟動時間可能會縮短 5 分鐘!!!
任何想法?
更新:解除安裝 postgresql 後(我將來可能需要)
1min 33.326s sendmail.service 58.872s podman-auto-update.service 40.822s mpd.service 33.722s systemd-networkd-wait-online.service 29.988s user@1000.service 26.474s apache2.service 26.234s lightdm.service 26.217s plymouth-quit-wait.service 25.138s vmware.service 24.550s networkd-dispatcher.service 23.020s udisks2.service 22.879s accounts-daemon.service 15.663s NetworkManager-wait-online.service 14.961s avahi-daemon.service 14.959s NetworkManager.service 14.594s polkit.service 14.592s power-profiles-daemon.service 14.210s switcheroo-control.service 14.203s wpa_supplicant.service
禁用 sendmail.service 後更新
55.560s podman-auto-update.service 42.642s mpd.service 33.696s systemd-networkd-wait-online.service 30.868s user@1000.service 26.124s apache2.service 25.182s networkd-dispatcher.service 25.012s udisks2.service 23.658s lightdm.service 23.642s plymouth-quit-wait.service 22.550s vmware.service 22.424s accounts-daemon.service 16.712s systemd-journal-flush.service 16.003s NetworkManager-wait-online.service 15.687s systemd-udev-settle.service 15.422s avahi-daemon.service 15.420s NetworkManager.service 15.031s polkit.service 15.018s power-profiles-daemon.service 14.880s vmware-USBArbitrator.service 14.623s switcheroo-control.service 14.618s wpa_supplicant.service 14.145s winbind.service 14.015s lxc-net.service 13.885s systemd-logind.service 13.360s dev-sda2.device 10.786s ModemManager.service 10.315s smartmontools.service 10.246s gpu-manager.service 9.491s systemd-networkd.service 8.443s timidity.service 8.324s smbd.service 8.098s nmbd.service 7.389s cups.service 7.121s pwrstatd.service 7.099s packagekit.service 6.850s lxc.service 5.758s rsyslog.service 4.943s systemd-udevd.service 4.324s systemd-modules-load.service 4.090s gpm.service 3.690s e2scrub_reap.service
更新:最擔心的日記條目,因為它要求
Apr 16 01:50:19 eliasc kernel: platform eisa.0: EISA: Cannot allocate resource for mainboard Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 1 Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 2 Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 3 Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 4 Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 5 Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 6 Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 7 Apr 16 01:50:19 eliasc kernel: platform eisa.0: Cannot allocate resource for EISA slot 8 r8169 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control Apr 16 01:50:19 eliasc kernel: ACPI Warning: SystemIO range 0x0000000000001828-0x000000000000182F conflicts with OpRegion 0x0000000000001800-0x000000000000187F (\> Apr 16 01:50:19 eliasc kernel: lpc_ich: Resource conflict(s) found affecting gpio_ich Apr 16 01:50:19 eliasc kernel: sd 7:0:0:0: [sdb] No Caching mode page found Apr 16 01:50:19 eliasc kernel: sd 7:0:0:0: [sdb] Assuming drive cache: write through Apr 16 01:50:19 eliasc kernel: sd 8:0:0:0: [sdc] No Caching mode page found Apr 16 01:50:19 eliasc kernel: sd 8:0:0:0: [sdc] Assuming drive cache: write through Apr 16 01:50:19 eliasc kernel: sd 9:0:0:0: [sdd] No Caching mode page found Apr 16 01:50:19 eliasc kernel: sd 9:0:0:0: [sdd] Assuming drive cache: write through Apr 16 01:50:19 eliasc systemd[1]: /lib/systemd/system/plymouth-start.service:16: Unit configured to use KillMode=none. This is unsafe, as it disables systemd's p> Apr 16 01:50:20 eliasc kernel: ashmem_linux: module is from the staging directory, the quality is unknown, you have been warned. Apr 16 01:50:22 eliasc systemd-modules-load[406]: Failed to find module 'dhd' Apr 16 01:50:24 eliasc systemd-udevd[425]: /usr/lib/udev/rules.d/60-anbox-modules-dkms.rules:1 NAME="%k" is ignored, as it breaks kernel supplied names. Apr 16 01:50:27 eliasc kernel: at24 0-0052: supply vcc not found, using dummy regulator Apr 16 01:50:28 eliasc kernel: scsi 11:0:0:1: Wrong diagnostic page; asked for 1 got 8 Apr 16 01:50:28 eliasc kernel: scsi 11:0:0:1: Failed to get diagnostic page 0x1 Apr 16 01:50:28 eliasc kernel: scsi 11:0:0:1: Failed to bind enclosure -19 Apr 16 01:50:30 eliasc kernel: snd_hda_intel 0000:00:1b.0: dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead Apr 16 01:50:30 eliasc kernel: snd_hda_intel 0000:01:00.1: dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead Apr 16 01:50:42 eliasc smartd[750]: Device: /dev/sda [SAT], no ATA CHECK POWER STATUS support, ignoring -n Directive Apr 16 01:51:11 eliasc kernel: vmmon: loading out-of-tree module taints kernel. Configuration file /etc/xdg/autostart/org.kde.discover.notifier.desktop is marked executable. Please remove executable permission bits. Proceeding anyway. Apr 16 01:51:37 eliasc systemd-xdg-autostart-generator[1373]: Not generating service for XDG autostart app-unity\x2dsettings\x2ddaemon-autostart.service, error parsing Exec= line: No such file or directory Apr 16 01:51:42 eliasc systemd[1518]: mpd.socket: Failed to create listening socket ([::]:6600): Address already in use Apr 16 01:51:42 eliasc systemd[1322]: mpd.socket: Failed to receive listening socket ([::]:6600): Input/output error Apr 16 01:51:42 eliasc systemd[1322]: mpd.socket: Failed to listen on sockets: Input/output error Apr 16 01:51:42 eliasc systemd[1322]: mpd.socket: Failed with result 'resources'. Apr 16 01:51:42 eliasc systemd[1322]: Failed to listen on mpd.socket. Apr 16 01:51:43 eliasc sm-mta[1533]: My unqualified host name (eliasc) unknown; sleeping for retry Apr 16 01:51:44 eliasc sm-msp-queue[1549]: My unqualified host name (eliasc) unknown; sleeping for retry Apr 16 01:51:46 eliasc systemd[1087]: mpd.service: Main process exited, code=exited, status=1/FAILURE Apr 16 01:51:46 eliasc systemd[1087]: mpd.service: Failed with result 'exit-code'. Apr 16 01:51:46 eliasc systemd[1087]: Failed to start Music Player Daemon. Apr 16 01:51:46 eliasc systemd[1322]: mpd.service: Main process exited, code=exited, status=1/FAILURE Apr 16 01:51:46 eliasc systemd[1322]: mpd.service: Failed with result 'exit-code'. Apr 16 01:51:47 eliasc pipewire-media-session[1538]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire-media-session[1538]: could not set nice-level to -11: Permission denied Apr 16 01:51:47 eliasc pipewire[1537]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire[1537]: could not set nice-level to -11: Permission denied Apr 16 01:51:47 eliasc pipewire-media-session[1522]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire-media-session[1522]: could not set nice-level to -11: Permission denied Apr 16 01:51:47 eliasc pipewire[1521]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire[1521]: could not set nice-level to -11: Permission denied Apr 16 01:51:47 eliasc pipewire-media-session[1538]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire-media-session[1538]: could not make thread realtime: Permission denied Apr 16 01:51:47 eliasc pipewire[1537]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire[1537]: could not make thread realtime: Permission denied Apr 16 01:51:47 eliasc pipewire-media-session[1522]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire-media-session[1522]: could not make thread realtime: Permission denied Apr 16 01:51:47 eliasc pipewire[1521]: RTKit error: org.freedesktop.DBus.Error.AccessDenied Apr 16 01:51:47 eliasc pipewire[1521]: could not make thread realtime: Permission denied Apr 16 01:51:47 eliasc pulseaudio[1523]: Home directory not accessible: Permission denied Apr 16 01:51:47 eliasc pulseaudio[1578]: Home directory not accessible: Permission denied Apr 16 01:51:47 eliasc systemd[1322]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE Apr 16 01:51:47 eliasc systemd[1322]: pulseaudio.service: Failed with result 'exit-code'. Apr 16 01:51:47 eliasc systemd[1322]: Failed to start Sound Service Apr 16 01:51:56 eliasc pulseaudio[1539]: Sink output does not exist. Apr 16 01:51:56 eliasc pulseaudio[1539]: Source input does not exist. Apr 16 01:52:43 eliasc sm-mta[1533]: unable to qualify my own domain name (eliasc) -- using short name Apr 16 01:52:44 eliasc sm-msp-queue[1549]: unable to qualify my own domain name (eliasc) -- using short name Apr 16 01:52:58 eliasc org.kde.powerdevil.backlighthelper[2031]: org.kde.powerdevil: no kernel backlight interface found Apr 16 08:32:10 eliasc systemd[1087]: plasma-baloorunner.service: Failed with result 'exit-code'. Apr 16 08:32:10 eliasc systemd[1087]: Failed to start KRunner provider for baloo file indexer.
首先,我會推薦前面提到的
systemd-analyze
,而不是更詳細地查看引導步驟sudo journalctl -b
。此命令還將根據其重要性對行進行顏色編碼(紅色表示錯誤等)此外,
journalctl
您將能夠分析多個以前的引導,所有這些都sudo journalctl --list-boots
使用以下命令列出並訪問它們的日誌:journalctl -b [ID] [ID] -1 for previous boot, -2 for two boots back etc.
至於
sendmail.service
,可能的原因是它無法解析您的主機名,直到超時並進入睡眠狀態以允許引導繼續。這將在journalctl -b
日誌中報告,可能如下所示:sendmail[1740]: My unqualified host name ([hostname]) unknown; sleeping for retry sendmail[1740]: unable to qualify my own domain name ([hostname]) -- using short name
如果您檢查以下位置
ls -alh /var/lib/sendmail
您可能會找到一個與此類似的文件:
-rw-rw---- 1 root smmsp 11M Apr 16 02:01 /var/lib/sendmail/dead.letter
如果你往裡看,你
/var/log/
會發現mail.log``mail.err
我幾乎可以保證你的
mail.log
文件會很大,但是有 3 行的序列一遍又一遍地重複,看起來像這樣:Apr 12 16:01:04 [usr] sm-msp-queue[64338]: 23CK11C9064338: to=postmaster, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=32831, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1] Apr 12 16:01:04 [user] sm-msp-queue[64338]: 233NL1Ph021284: to=[user], delay=8+20:40:02, xdelay=00:00:00, mailer=relay, pri=121459, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1] Apr 12 16:01:04 [user] sm-msp-queue[64338]: 233NL1Ph021284: 23CK11CA064338: return to sender: Cannot send message for 5 days
鑑於您不確定
sendmail
它是什麼或為什麼執行,並且看到sendmail.service
它給您帶來的只是問題,因此可以安全地假設您沒有積極使用它。在這種情況下,我建議禁用它,您可以使用以下方法:sudo systemctl disable sendmail
重新啟動,然後分析您的時間,讓我們知道 1 分 40 秒的延遲是否不再存在。