我开始尝试优化我的启动时间。当我输入命令时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 有什么不同?它们应该是相同的。你的 swap 已经改变了。
在启动时,系统会读取 /etc/fstab 中的交换 UUID 并尝试挂载它。但是它不存在,因此挂载失败。系统重试,再次失败。因此系统开始寻找可以使用的交换。最终,系统找到新的交换分区并挂载它。整个过程在启动过程中大约需要一分钟(或更长时间),从而减慢了启动速度。
只需告诉系统交换分区的正确 UUID,即可轻松解决问题:编辑 /etc/fstab,用正确的 UUID 替换旧 UUID。运行 时,您就会知道正确的 UUID sudo blkid
。
然后重新启动即可享受更快的启动。