由于SSD安装导致启动缓慢?

由于SSD安装导致启动缓慢?

我看到一个奇怪的问题,我不知道它的起源。

我正在运行 Pop_OS! 20.10 和内核 5.9.10

运行sudo dmesg我看到:

[ 13.453986] rfkill: input handler enabled

[ 41.356512] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)

[ 41.470036] rfkill: input handler disabled

[ 42.042698] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)

[ 42.371273] usb 3-3.4: reset high-speed USB device number 8 using xhci_hcd

SDA1 是我的 SSD,它不是我的启动驱动器,我能找到的很多故障排除似乎都假设它只是一个 ext4 存储驱动器。

运行时,systemd-analyze我看到相对较高的“固件”时间,在互联网上,该时间似乎是人们正常时间的 10 倍左右。我的启动驱动器是 PCIe 4 NVME 驱动器。

Startup finished in 15.478s (firmware) + 352ms (loader) + 3.989s (kernel) + 5.127s (userspace) = 24.948s

没有什么运行太异常的情况systemd-analyze blame,或者systemd-analyze critical-chanin除了 upower 在达到图形目标之前可能需要 4 秒运行之外。

有人知道我可以尝试什么吗?

这不是一个非常严重的问题,但是登录后黑屏 25 秒是相当烦人的。

更新

cat /etc/fstab返回:

# <file system>  <mount point>  <type>  <options>  <dump>  <pass>
UUID=cff257f3-ddc3-4d67-8b47-b87c545a4a95 / ext4 noatime,errors=remount-ro 0 0
PARTUUID=5a670c7c-e69f-4578-9542-0ff8b8081789 /boot/efi vfat umask=0077 0 0
/dev/mapper/cryptswap none swap defaults 0 0
UUID=693161ff-c7ba-495d-8740-1c63cb6a2957 /home ext4 noatime,errors=remount-ro 0 0

fsck返回:

fsck from util-linux 2.36

最后给出一个概览lsblk

NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda             8:0    1 931,5G  0 disk  
└─sda1          8:1    1 931,5G  0 part  /media/username/SSD
sdb             8:16   1   3,6T  0 disk  
├─sdb1          8:17   1 976,6G  0 part  /media/username/HDD1
└─sdb3          8:19   1   2,7T  0 part  /home
nvme0n1       259:0    0 931,5G  0 disk  
├─nvme0n1p1   259:1    0 596,2G  0 part  
├─nvme0n1p3   259:2    0   331G  0 part  /
├─nvme0n1p4   259:3    0   603M  0 part  /boot/efi
└─nvme0n1p5   259:4    0   3,6G  0 part  
  └─cryptswap 253:0    0   3,6G  0 crypt [SWAP]

现在看起来有点奇怪,我在 nvme0n1p1 上有另一个安装,但我删除了它,我的目的是将 root 移到它上面并扩展,与 /home 相同。

答案1

SSD 也有同样的问题,在几个 i7 裸机系统上是否作为引导系统。启动 SSD 单元的示例...每个启动序列延迟 30 秒:

[ 1.894942] hid-generic 0003:1A2C:2124.0001: input,hidraw0: USB HID v1.10 Keyboard [SEM USB Keyboard] on usb-0000:00:1d.0-1.1/input0

[ 1.896417] input: SEM USB Keyboard as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/0003:1A2C:2124.0002/input/input4

[ 1.954771] hid-generic 0003:1A2C:2124.0002: input,hidraw1: USB HID v1.10 Device [SEM USB Keyboard] on usb-0000:00:1d.0-1.1/input1

[ 32.656052] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)

[ 32.783076] ip_tables: (C) 2000-2006 Netfilter Core Team

我认为这与SSD磁盘元数据有关,而不是raid。参考系统:

# uname -a

Linux JSCR64 4.9.0-14-amd64 #1 SMP Debian 4.9.246-2 (2020-12-17) x86_64 GNU/Linux

编辑:刚刚解决...尝试分析日志观察 dmesg 在内核上有大约 30 秒的时间间隔。

[     2.067836] input:  USB OPTICAL MOUSE as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:2188:0AE1.0003/input/input5
[    2.068070] hid-generic 0003:2188:0AE1.0003: input,hidraw2: USB HID v1.11 Mouse [ USB OPTICAL MOUSE] on usb-0000:00:1d.0-1.2/input0
[   32.609087] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[   32.742762] ip_tables: (C) 2000-2006 Netfilter Core Team
Watching daemon.log something wrong...
Jan  3 21:30:26 JSCR64 systemd[1]: Closed Load/Save RF Kill Switch Status /dev/rfkill Watch.
Jan  3 21:30:26 JSCR64 systemd[1]: Stopped target Sound Card.
Jan  3 21:30:26 JSCR64 systemd[1]: Stopping User Manager for UID 112...
Jan  3 21:31:53 JSCR64 systemd-modules-load[386]: Inserted module 'lp'
Jan  3 21:31:53 JSCR64 systemd-modules-load[386]: Inserted module 'ppdev'
Jan  3 21:31:53 JSCR64 systemd-modules-load[386]: Inserted module 'parport_pc'
Jan  3 21:31:53 JSCR64 systemd-modules-load[386]: Inserted module 'coretemp'
Jan  3 21:31:53 JSCR64 keyboard-setup.sh[380]: cannot open file /tmp/tmpkbd.NEcSl2
Jan  3 21:31:53 JSCR64 systemd[1]: Starting Flush Journal to Persistent Storage...
Jan  3 21:31:53 JSCR64 systemd[1]: Started Flush Journal to Persistent Storage.
Jan  3 21:31:53 JSCR64 systemd[1]: Started udev Kernel Device Manager.
Jan  3 21:31:53 JSCR64 systemd[1]: Started Set the console keyboard layout.
Jan  3 21:31:53 JSCR64 systemd[1]: Reached target Local File Systems (Pre).
Jan  3 21:31:53 JSCR64 systemd[1]: Reached target Local File Systems.
....
Jan  3 21:31:53 JSCR64 systemd[1]: Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
Jan  3 21:31:53 JSCR64 systemd[1]: Reached target Sockets.
Jan  3 21:31:53 JSCR64 systemd[1]: Reached target Basic System.
Jan  3 21:31:53 JSCR64 systemd[1]: Starting LSB: Load kernel modules needed to enable cpufreq scaling...
Jan  3 21:31:53 JSCR64 systemd[1]: Started CUPS Scheduler.
Jan  3 21:31:53 JSCR64 systemd[1]: Starting RealtimeKit Scheduling Policy Service...
Jan  3 21:31:53 JSCR64 systemd[1]: Starting LSB: Speech Dispatcher...
Jan  3 21:31:53 JSCR64 systemd[1]: Started D-Bus System Message Bus.
Jan  3 21:31:53 JSCR64 rtkit-daemon[625]: Successfully called chroot.
Jan  3 21:31:53 JSCR64 rtkit-daemon[625]: Successfully dropped privileges.
Jan  3 21:31:53 JSCR64 systemd[1]: Started RealtimeKit Scheduling Policy Service.
Jan  3 21:31:53 JSCR64 rtkit-daemon[625]: Successfully limited resources.
Jan  3 21:31:53 JSCR64 systemd[1]: Starting Network Manager...
Jan  3 21:31:53 JSCR64 rtkit-daemon[625]: Running.
Jan  3 21:31:53 JSCR64 rtkit-daemon[625]: Watchdog thread running.
Jan  3 21:31:53 JSCR64 systemd[1]: Started Run anacron jobs.
Jan  3 21:31:53 JSCR64 rtkit-daemon[625]: Canary thread running.
...
Jan  3 21:31:53 JSCR64 systemd[1]: Starting Login Service...
Jan  3 21:31:53 JSCR64 systemd[1]: Starting Avahi mDNS/DNS-SD Stack...
Jan  3 21:31:53 JSCR64 systemd[1]: Started Restore /etc/resolv.conf if the system crashed before the ppp link was shut down.
Jan  3 21:31:53 JSCR64 speech-dispatcher[626]: speech-dispatcher disabled; edit /etc/default/speech-dispatcher.
Jan  3 21:31:53 JSCR64 systemd[1]: anacron.timer: Adding 3min 49.607004s random time.
Jan  3 21:31:53 JSCR64 systemd[1]: Started LSB: Speech Dispatcher.
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: Found user 'avahi' (UID 114) and group 'avahi' (GID 120).
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: Successfully dropped root privileges.
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: avahi-daemon 0.6.32 starting up.
Jan  3 21:31:53 JSCR64 systemd[1]: Started Login Service.
Jan  3 21:31:53 JSCR64 loadcpufreq[619]: Loading cpufreq kernel modules...libkmod: ERROR ../libkmod/libkmod-module.c:1929 kmod_module_get_holders: could not open '/sys/module/mac80211/holders': No such file or directory
Jan  3 21:31:53 JSCR64 systemd[1]: Started Avahi mDNS/DNS-SD Stack.
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: Successfully called chroot().
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: Successfully dropped remaining capabilities.
Jan  3 21:31:53 JSCR64 avahi-daemon[665]: chroot.c: open() failed: No such file or directory
...
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: Failed to open /etc/resolv.conf: Invalid argument
...
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: Network interface enumeration completed.
Jan  3 21:31:53 JSCR64 avahi-daemon[650]: Server startup complete. Host name is JSCR64.local. Local service cookie is 310164566.
Jan  3 21:31:53 JSCR64 ModemManager[646]: <info>  ModemManager (version 1.6.4) starting in system bus...
Jan  3 21:31:53 JSCR64 systemd[1]: Started Raise network interfaces.
Jan  3 21:31:53 JSCR64 systemd[1]: Started System Logging Service.

Jan  3 21:31:53 JSCR64 systemd[1]: Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
Jan  3 21:31:53 JSCR64 systemd[1]: Starting Load/Save RF Kill Switch Status...
Jan  3 21:31:53 JSCR64 dbus[627]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'

Jan  3 21:31:53 JSCR64 systemd[1]: Starting Hostname Service...
Jan  3 21:31:53 JSCR64 systemd[1]: Started Load/Save RF Kill Switch Status.
Jan  3 21:31:53 JSCR64 dbus[627]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan  3 21:31:53 JSCR64 systemd[1]: Started Hostname Service.
...
Jan  3 21:31:55 JSCR64 systemd[1]: Created slice User Slice of lightdm.
Jan  3 21:31:55 JSCR64 systemd[1]: Starting User Manager for UID 112...

出现问题导致进程 UID=112 的停止滞后。这个UID是谁?

/etc# cat passwd|grep :112:
messagebus:x:108:112::/var/run/dbus:/bin/false
lightdm:x:112:116:Light Display Manager:/var/lib/lightdm:/bin/false

有些东西滞后于 UID 112 的停止,我们可以禁用以继续故障排除。 ----------禁用 lightdm 后我们可以看到启动新信息。开始;运行 /Scripts/local-block...done |->Linux 启动并在使用 /scripts/local-block 循环时花费很长时间 可能的原因:Linux 启动需要知道它尝试挂载的交换文件的 UUID。 --- 观看存储块设备...

/etc# blkid
/dev/sda1: UUID="bd746cd3-2b08-4b5c-93a6-dbeca9cb899f" TYPE="ext4" PARTUUID="735c261f-01"

--- 它不在系统上,仅在第一个分区上,也许是在用 SSD 磁盘替换旋转磁盘之前的旧交换分区。

/etc# cd /etc/initramfs-tools/conf.d/
/etc/initramfs-tools/conf.d# ls
resume
/etc/initramfs-tools/conf.d# cat resume
RESUME=UUID=43ea92db-85a7-4e73-9275-d033af4e9351

---- 过去存在另一个交换单元,它不是主要安装的,正如我在 blkid 中看到的那样。停用交换并删除恢复文件

/etc/initramfs-tools/conf.d# swapoff --all
/etc/initramfs-tools/conf.d# cat resume
RESUME=UUID=43ea92db-85a7-4e73-9275-d033af4e9351
/etc/initramfs-tools/conf.d# rm resume

---- 更新初始化镜像

/etc/initramfs-tools/conf.d# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.9.0-14-amd64

---重启后问题解决。 :-)))

相关内容