我的系统上安装了以下配置,
mercurial@providence:~$ neofetch
_,met$$$$$gg. mercurial@providence
,g$$$$$$$$$$$$$$$P. --------------------
,g$$P" """Y$$.". OS: Debian GNU/Linux 10 (buster) x86_64
,$$P' `$$$. Host: XPS L501X A08
',$$P ,ggs. `$$b: Kernel: 4.19.0-6-amd64
`d$$' ,$P"' . $$$ Uptime: 7 mins
$$P d$' , $$P Packages: 2883 (dpkg)
$$: $$. - ,d$$' Shell: bash 5.0.3
$$; Y$b._ _,d$P' Resolution: 1366x768
Y$$. `.`"Y$$$$P"' DE: MATE
`$$b "-.__ WM: Metacity (Marco)
`Y$$ WM Theme: TraditionalOk
`Y$$. Theme: Clearlooks [GTK2/3]
`$$b. Icons: gnome [GTK2/3]
`Y$$b. Terminal: mate-terminal
`"Y$b._ Terminal Font: Monospace 10
`""" CPU: Intel i5 M 460 (4) @ 2.534GHz
GPU: NVIDIA GeForce GT 420M
GPU: Intel Core Processor
Memory: 1062MiB / 3683MiB
mercurial@providence:~$ uname -a
Linux providence 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux
现在的问题是系统启动时间太长,以下是启动情节。
mercurial@providence:~$ systemd-analyze
Startup finished in 38.520s (kernel) + 26.496s (userspace) = 1min 5.017s
graphical.target reached after 26.478s in userspace
https://svgshare.com/i/FNK.svg
我试图修复一些问题,但无法深入其中。
我的启动日志如下,
Gave up waiting for suspend/resume device
Debian: clean, 934549/7528448 files, 9966424/30091008 blocks
[ OK ] Started Set console font and keymap.
[ OK ] Started Tell Plymouth To Write Out Runtime Data.
[ OK ] Started Create Volatile Files and Directories.
Starting Update UTMP about System Boot/Shutdown...
Starting Network Time Synchronization...
[ OK ] Started Update UTMP about System Boot/Shutdown.
[ OK ] Started udev Kernel Device Manager.
Starting Show Plymouth Boot Screen...
[ OK ] Started Load AppArmor profiles.
Starting Raise network interfaces...
[ OK ] Started Show Plymouth Boot Screen.
[ OK ] Reached target Local Encrypted Volumes.
[ OK ] Started Forward Password Requests to Plymouth Directory Watch.
[ OK ] Started Network Time Synchronization.
[ OK ] Reached target System Time Synchronized.
[ OK ] Created slice system-systemd\x2dbacklight.slice.
Starting Load/Save Screen Backlight Brightness of backlight:intel_backlight...
[ OK ] Started Load/Save Screen Backlight Brightness of backlight:intel_backlight.
[ OK ] Started Raise network interfaces.
Starting Load/Save Screen Backlight Brightness of leds:dell::kbd_backlight...
[ OK ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
[ OK ] Started Load/Save Screen Backlight Brightness of leds:dell::kbd_backlight.
Starting Load/Save RF Kill Switch Status...
[ OK ] Started Load/Save RF Kill Switch Status.
Starting Show Plymouth Boot Screen...
Starting Tell Plymouth To Write Out Runtime Data...
[ OK ] Started Tell Plymouth To Write Out Runtime Data.
[ OK ] Started Show Plymouth Boot Screen.
Starting Tell Plymouth To Write Out Runtime Data...
Starting Show Plymouth Boot Screen...
[ OK ] Started Tell Plymouth To Write Out Runtime Data.
[ OK ] Started Show Plymouth Boot Screen.
[ OK ] Found device ST9500420AS 7.
Activating swap /dev/disk/by-uuid/c0198c37-f28b-41f5-bb0f-37d575e86896...
[ OK ] Activated swap /dev/disk/by-uuid/c0198c37-f28b-41f5-bb0f-37d575e86896.
[ OK ] Reached target Swap.
[ OK ] Reached target System Initialization.
[ OK ] Started Trigger anacron every hour.
[ OK ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
[ OK ] Listening on CUPS Scheduler.
[ OK ] Started Daily Cleanup of Temporary Directories.
[ OK ] Started Daily apt download activities.
[ OK ] Started CUPS Scheduler.
[ OK ] Reached target Paths.
[ OK ] Listening on D-Bus System Message Bus Socket.
[ OK ] Started Daily rotation of log files.
[ OK ] Started Daily man-db regeneration.
[ OK ] Listening on UUID daemon activation socket.
[ OK ] Reached target Sockets.
[ OK ] Reached target Basic System.
[ OK ] Started CUPS Scheduler.
[ OK ] Started Manage Sound Card State (restore and store).
Starting Save/Restore Sound Card State...
Starting System Logging Service...
[ OK ] Started Run anacron jobs.
Starting Bluetooth service...
Starting Avahi mDNS/DNS-SD Stack...
[ OK ] Started Regular background program processing daemon.
Starting Modem Manager...
Starting Accounts Service...
Starting Restore /etc/resolv.conf if the system crashed before the ppp link was shut down...
Starting Deferred execution scheduler...
Starting Disk Manager...
[ OK ] Started D-Bus System Message Bus.
Starting Network Manager...
Starting WPA supplicant...
Starting Login Service...
[ OK ] Started Daily apt upgrade and clean activities.
[ OK ] Reached target Timers.
[ OK ] Started System Logging Service.
[ OK ] Started Save/Restore Sound Card State.
[ OK ] Started Restore /etc/resolv.conf if the system crashed before the ppp link was shut down.
[ OK ] Started Deferred execution scheduler.
[ OK ] Started Login Service.
[ OK ] Started WPA supplicant.
[ OK ] Started Avahi mDNS/DNS-SD Stack.
[ OK ] Started Bluetooth service.
[ OK ] Reached target Bluetooth.
[ OK ] Started Make remote CUPS printers available locally.
[ OK ] Reached target Sound Card.
Starting Authorization Manager...
Starting Hostname Service...
[ OK ] Started Network Manager.
Starting Network Manager Wait Online...
[ OK ] Reached target Network.
Starting Permit User Sessions...
[ OK ] Started Unattended Upgrades Shutdown.
[ OK ] Started Permit User Sessions.
Starting Hold until boot process finishes up...
Starting Light Display Manager...
[ OK ] Started Hostname Service.
Starting Network Manager Script Dispatcher Service...
[ OK ] Started Network Manager Script Dispatcher Service.
[ OK ] Started Authorization Manager.
[ OK ] Started Accounts Service.
请注意,我为此搜索了一些内容GAVE UP WAITING FOR...
,并且有人针对此内容,
mercurial@providence:~$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-4.19.0-6-amd64
cryptsetup: ERROR: Couldn't resolve device
UUID=fee92c6d-7b60-4014-a66b-c48cd9094162
cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries
nor crypto modules. If that's on purpose, you may want to uninstall the
'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs
integration and avoid this warning.
W: Possible missing firmware /lib/firmware/nvidia/gv100/acr/ucode_load.bin for module nouveau
I: The initramfs will attempt to resume from /dev/sda7
I: (UUID=c0198c37-f28b-41f5-bb0f-37d575e86896)
I: Set the RESUME variable to override this.
update-initramfs: Generating /boot/initrd.img-4.19.0-5-amd64
cryptsetup: ERROR: Couldn't resolve device
UUID=fee92c6d-7b60-4014-a66b-c48cd9094162
cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries
nor crypto modules. If that's on purpose, you may want to uninstall the
'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs
integration and avoid this warning.
W: Possible missing firmware /lib/firmware/nvidia/gv100/acr/ucode_load.bin for module nouveau
I: The initramfs will attempt to resume from /dev/sda7
I: (UUID=c0198c37-f28b-41f5-bb0f-37d575e86896)
I: Set the RESUME variable to override this.
那/dev/sda7
是我的交换文件。
mercurial@providence:~$ sudo fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST9500420AS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc8000000
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 206847 204800 100M 7 HPFS/NTFS/exFAT
/dev/sda2 206848 170128349 169921502 81G 7 HPFS/NTFS/exFAT
/dev/sda3 170144408 337927335 167782928 80G 7 HPFS/NTFS/exFAT
/dev/sda4 337930238 976769023 638838786 304.6G f W95 Ext'd (LBA)
/dev/sda5 337930240 727652351 389722112 185.9G 83 Linux
/dev/sda6 727654400 968382463 240728064 114.8G 83 Linux
/dev/sda7 968384512 976769023 8384512 4G 82 Linux swap / Solaris
mercurial@providence:~$ ls -la /dev/disk/by-uuid
total 0
drwxr-xr-x 2 root root 160 Oct 7 23:45 .
drwxr-xr-x 7 root root 140 Oct 7 23:45 ..
lrwxrwxrwx 1 root root 10 Oct 7 23:46 129C98019C97DE13 -> ../../sda3
lrwxrwxrwx 1 root root 10 Oct 7 23:46 3D9D2B1C080C3A89 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 7 23:46 480488312682F440 -> ../../sda1
lrwxrwxrwx 1 root root 10 Oct 7 23:46 aec68856-488a-4c50-aa05-01af59b3ae0b -> ../../sda6
lrwxrwxrwx 1 root root 10 Oct 7 23:46 c0198c37-f28b-41f5-bb0f-37d575e86896 -> ../../sda7
lrwxrwxrwx 1 root root 10 Oct 7 23:46 d96d4546-92a2-49bf-b9d0-c00348d42395 -> ../../sda5
我怎样才能更快地启动,也许每竖琴不到 10 秒?
答案1
我遇到了同样的问题,基本上,在禁用和删除虚拟盒内的交换后,UUID 变得混乱。这会导致超时问题和依赖项失败,并强制在每次启动时检查文件系统。我必须相应地更新我的 UUID。
如果交换分区被删除(例如,从 HD 迁移到 SSD 时故意删除),则该文件/etc/initramfs-tools/conf.d/resume
应该完全为空或读取RESUME=
。删除任何 UUID 编号。RESUME=NONE
无效。无论您是否使用交换,修复方法如下:
对于故障排除(可选):
sudo cat /var/log/boot.log
列出正确的分区 UUIDS:
sudo blkid -c /dev/null -o list
确保以下三个文件具有 blkid 列出的正确 UUID 设置,并使用正确的 UUID 覆盖它们:
/etc/fstab [for me swap was incorrect]
/etc/default/grub [for me RESUME=UUID was incorrect]
/boot/grub/grub.cfg [for me RESUME=UUID was incorrect]
然后更新初始 Ram 文件系统:
update-initramfs -u
编辑上面的三个文件也永久解决了我cryptsetup: error: couldn't resolve device
运行 update-initramfs 时的错误
这应该可以避免将 UUID 添加到 的需要/etc/initramfs-tools/conf.d/resume
,但是,如果您仍然遇到问题,请考虑添加 UUID,例如:RESUME=UUID=c0198c37-f28b-41f5-bb0f-37d575e86896
,或者RESUME=
如果您不使用交换文件,则进行设置。
然后运行:
update-initramfs -u
还要确保/etc/default/grub
已设置为GRUB_TIMEOUT=0
, 以加快启动过程。在我在这里描述的所有内容之后,它在启动时执行了最后一次文件系统检查,但之后它在 10 秒内启动,而不是 1 分 30 秒。
答案2
mercurial@providence:~$ systemd-analyze
Startup finished in 7.913s (kernel) + 20.621s (userspace) = 28.534s
graphical.target reached after 20.605s in userspace
这是我纠正了一些问题后所取得的成果。正如您所看到的,启动时间逐渐从 1 分 5 秒减少到 28 秒。
1. sudo update-initramfs -u -k all :内核时间
这是在大声尖叫,我正试图从一个找不到的设备恢复,即我的系统中有一个恢复块。grub.cfg
cryptsetup: ERROR: Couldn't resolve device
UUID=fee92c6d-7b60-4014-a66b-c48cd9094162
这只是一个错误,
cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries
nor crypto modules. If that's on purpose, you may want to uninstall the
'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs
integration and avoid this warning.
这行漂亮的代码要求我声明新的交换分区,以便我的系统可以从中恢复,
I: The initramfs will attempt to resume from /dev/sda7
I: (UUID=c0198c37-f28b-41f5-bb0f-37d575e86896)
I: Set the RESUME variable to override this.
于是我就这么做了,
mercurial@providence:~$ cat /etc/initramfs-tools/conf.d/resume
RESUME=UUID=c0198c37-f28b-41f5-bb0f-37d575e86896
2. systemd-analyze 问题:用户空间时间
我的网络管理员需要一些时间才能上线,所以我所要做的就是屏蔽它。
sudo systemctl mask NetworkManager-wait-online.service
结果
现在我的启动时间已降至 28 秒,以下是我的责任和关键链,
mercurial@providence:~$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.
graphical.target @20.605s
└─udisks2.service @9.969s +10.636s
└─basic.target @9.515s
└─sockets.target @9.515s
└─dbus.socket @9.515s
└─sysinit.target @9.333s
└─swap.target @9.333s
└─dev-disk-by\x2duuid-c0198c37\x2df28b\x2d41f5\x2dbb0f\x2d37d575e86896.swap @8.843s +490ms
└─dev-disk-by\x2duuid-c0198c37\x2df28b\x2d41f5\x2dbb0f\x2d37d575e86896.device @8.841s
mercurial@providence:~$ systemd-analyze blame
10.636s udisks2.service
6.628s dev-sda6.device
5.486s ModemManager.service
4.935s accounts-daemon.service
4.346s exim4.service
4.156s NetworkManager.service
3.211s bluetooth.service
3.203s atd.service
3.174s apt-daily.service
3.132s pppd-dns.service
3.128s alsa-restore.service
2.765s systemd-logind.service
2.762s avahi-daemon.service
2.751s rsyslog.service
2.750s wpa_supplicant.service
2.594s networking.service
2.168s lightdm.service
2.148s plymouth-quit-wait.service
2.024s upower.service
1.975s systemd-udevd.service
1.955s apparmor.service
1.718s polkit.service
1.412s systemd-tmpfiles-setup.service
1.161s colord.service
1.000s systemd-rfkill.service
我相信还有很大的改进空间,所以我将等待一些核心系统管理员来阐明。谢谢。
答案3
编辑 /etc/default/grub 将配置文件替换为退出和启动 Sudo update-grub 编辑 /etc/fstab 机会 1 OR 2 in 0 掩码网络管理器在线等待 掩码普利茅斯在线等待 重新启动