我開始嘗試優化我的啟動時間。當我發出命令時systemd-analyze plot >bootup.svg
,我看到這種情況swap.target
持續了超過 1 分鐘。那我能用它做什麼呢?
編輯:
grep swap /etc/fstab
輸出:
# swap was on /dev/sda4 during installation
UUID=6b06a63a-e66b-489c-834d-04b5ab909160 none swap sw 0 0
sudo blkid | grep swap
輸出:
/dev/sda4: UUID="8fb26a5f-62fc-4c3a-8df5-421f884844b7" TYPE="swap" PARTUUID="d9fa2484-04"
輸出的“dmesg”部分:
[ 3.605617] input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1b.0/sound/card1/input8
[ 3.605710] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card1/input9
[ 4.687101] snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 4.697746] input: HDA Intel HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/sound/card0/input10
[ 4.697822] input: HDA Intel HDMI HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/sound/card0/input11
[ 4.697895] input: HDA Intel HDMI HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/sound/card0/input12
[ 4.697962] input: HDA Intel HDMI HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.0/sound/card0/input13
[ 4.698027] input: HDA Intel HDMI HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:03.0/sound/card0/input14
[ 92.575975] audit: type=1400 audit(1597581223.535:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-senddoc" pid=669 comm="apparmor_parser"
[ 92.577822] audit: type=1400 audit(1597581223.539:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=668 comm="apparmor_parser"
[ 92.577827] audit: type=1400 audit(1597581223.539:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=668 comm="apparmor_parser"
[ 92.580091] audit: type=1400 audit(1597581223.539:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-xpdfimport" pid=672 comm="apparmor_parser"
[ 92.583043] audit: type=1400 audit(1597581223.543:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=673 comm="apparmor_parser"
[ 92.583046] audit: type=1400 audit(1597581223.543:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=673 comm="apparmor_parser"
[ 92.583048] audit: type=1400 audit(1597581223.543:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_groff" pid=673 comm="apparmor_parser"
[ 92.583483] audit: type=1400 audit(1597581223.543:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cups-browsed" pid=671 comm="apparmor_parser"
[ 92.585361] audit: type=1400 audit(1597581223.543:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lsb_release" pid=674 comm="apparmor_parser"
[ 92.591057] audit: type=1400 audit(1597581223.551:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="ippusbxd" pid=677 comm="apparmor_parser"
[ 93.306091] nfc: nfc_init: NFC Core ver 0.1
[ 93.306112] NET: Registered protocol family 39
答案1
看看你的兩個 UUID 有什麼不同?它們應該是相同的。你的交換已經改變。
啟動時,您的系統會讀取 /etc/fstab 中的交換 UUID 並嘗試掛載它。但它不存在,所以掛載失敗。系統重試,再次失敗。因此系統開始尋找它可以使用的可用交換區。最終,您的系統找到新的交換分割區並安裝它。整個過程在啟動過程中大約需要一分鐘(或更長),減慢了啟動速度。
只要告訴系統交換區的正確 UUID,即可輕鬆解決問題:編輯 /etc/fstab 並用正確的 UUID 取代舊的 UUID。您在運行時了解到了正確的 UUID sudo blkid
。
然後重新啟動即可享受更快的啟動速度。