我已经在 HP Pavilion 15 笔记本电脑(i7-8750h、8GB RAM、Nvidia GTX 1050 4GB 显卡)上安装了 Ubuntu 18.04 和 Windows 10 双启动。我在 128GB SSD 和 1TB HDD 上安装了 Windows 10,我在 100GB 分区上安装了 Ubuntu。
Ubuntu 启动大约需要 3 分钟,这太长了。我使用dmesg
终端检查了启动日志,但找不到具体的解决方案。日志的部分内容如下-
[ 28.304674] ACPI Error: Field [D128] at bit offset/length 128/1024 exceeds size of target Buffer (160 bits) (20170831/dsopcode-235)
[ 28.304680] No Local Variables are initialized for Method [HWMC]
[ 28.304681] Initialized Arguments for Method [HWMC]: (2 arguments defined for method invocation)
[ 28.304682] Arg0: 00000000d4827883 <Obj> Integer 0000000000000002
[ 28.304685] Arg1: 00000000d8e2e5c3 <Obj> Buffer(20) 53 45 43 55 01 00 00 00
[ 28.304691] ACPI Error: Method parse/execution failed \HWMC, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304698] ACPI Error: Method parse/execution failed \_SB.WMID.WMAA, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304737] ACPI Error: Field [D128] at bit offset/length 128/1024 exceeds size of target Buffer (160 bits) (20170831/dsopcode-235)
[ 28.304741] No Local Variables are initialized for Method [HWMC]
[ 28.304742] Initialized Arguments for Method [HWMC]: (2 arguments defined for method invocation)
[ 28.304743] Arg0: 000000006a1236a5 <Obj> Integer 0000000000000002
[ 28.304745] Arg1: 0000000058614773 <Obj> Buffer(20) 53 45 43 55 01 00 00 00
[ 28.304750] ACPI Error: Method parse/execution failed \HWMC, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304755] ACPI Error: Method parse/execution failed \_SB.WMID.WMAA, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304792] ACPI Error: Field [D128] at bit offset/length 128/1024 exceeds size of target Buffer (160 bits) (20170831/dsopcode-235)
[ 28.304796] No Local Variables are initialized for Method [HWMC]
[ 28.304797] Initialized Arguments for Method [HWMC]: (2 arguments defined for method invocation)
[ 28.304797] Arg0: 000000006a1236a5 <Obj> Integer 0000000000000002
[ 28.304799] Arg1: 0000000010b0d4d2 <Obj> Buffer(20) 53 45 43 55 01 00 00 00
[ 28.304805] ACPI Error: Method parse/execution failed \HWMC, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304809] ACPI Error: Method parse/execution failed \_SB.WMID.WMAA, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304840] input: HP WMI hotkeys as /devices/virtual/input/input11
[ 28.304935] ACPI Error: Field [D128] at bit offset/length 128/1024 exceeds size of target Buffer (160 bits) (20170831/dsopcode-235)
[ 28.304939] No Local Variables are initialized for Method [HWMC]
[ 28.304940] Initialized Arguments for Method [HWMC]: (2 arguments defined for method invocation)
[ 28.304940] Arg0: 000000006a1236a5 <Obj> Integer 0000000000000002
[ 28.304942] Arg1: 0000000058614773 <Obj> Buffer(20) 53 45 43 55 01 00 00 00
[ 28.304948] ACPI Error: Method parse/execution failed \HWMC, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304953] ACPI Error: Method parse/execution failed \_SB.WMID.WMAA, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.304989] ACPI Error: Field [D128] at bit offset/length 128/1024 exceeds size of target Buffer (160 bits) (20170831/dsopcode-235)
[ 28.304992] No Local Variables are initialized for Method [HWMC]
[ 28.304993] Initialized Arguments for Method [HWMC]: (2 arguments defined for method invocation)
[ 28.304994] Arg0: 000000006a1236a5 <Obj> Integer 0000000000000003
[ 28.304996] Arg1: 0000000010b0d4d2 <Obj> Buffer(20) 53 45 43 55 01 00 00 00
[ 28.305001] ACPI Error: Method parse/execution failed \HWMC, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 28.305006] ACPI Error: Method parse/execution failed \_SB.WMID.WMAA, AE_AML_BUFFER_LIMIT (20170831/psparse-550)
[ 57.223498] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 57.223499] Bluetooth: BNEP filters: protocol multicast
[ 57.223500] Bluetooth: BNEP socket layer initialized
[ 72.479544] IPv6: ADDRCONF(NETDEV_UP): eno1: link is not ready
[ 73.118840] r8169 0000:02:00.0 eno1: link down
[ 73.118970] IPv6: ADDRCONF(NETDEV_UP): eno1: link is not ready
[ 73.219866] IPv6: ADDRCONF(NETDEV_UP): wlo1: link is not ready
[ 73.843272] IPv6: ADDRCONF(NETDEV_UP): wlo1: link is not ready
[ 74.922172] IPv6: ADDRCONF(NETDEV_UP): wlo1: link is not ready
[ 105.606945] wlo1: authenticate with e4:46:da:97:22:1d
[ 105.607275] wlo1: send auth to e4:46:da:97:22:1d (try 1/3)
[ 105.609899] wlo1: authenticated
[ 105.616013] wlo1: associate with e4:46:da:97:22:1d (try 1/3)
[ 105.628806] wlo1: RX AssocResp from e4:46:da:97:22:1d (capab=0x431 status=0 aid=7)
[ 105.629150] wlo1: associated
[ 105.862745] IPv6: ADDRCONF(NETDEV_CHANGE): wlo1: link becomes ready
[ 145.733942] ahci 0000:00:17.0: port does not support device sleep
[ 175.120308] Bluetooth: RFCOMM TTY layer initialized
[ 175.120315] Bluetooth: RFCOMM socket layer initialized
[ 175.120318] Bluetooth: RFCOMM ver 1.11
[ 187.978585] rfkill: input handler disabled
但除了这些之外,还有多个地方的事件需要 5-10 秒,而且有很多。我无法找到导致巨大延迟的特定原因。
请在这件事上给予我帮助。
编辑1:
systemd-analyze blame | head -n 20
结果是 -
1min 44.210s apt-daily.service
1min 18.450s [email protected]
1min 15.205s plymouth-quit-wait.service
58.390s fstrim.service
31.935s dev-sdb6.device
28.224s snapd.service
21.987s networkd-dispatcher.service
20.731s phpsessionclean.service
18.816s dev-loop23.device
18.615s dev-loop22.device
18.480s gpu-manager.service
18.368s dev-loop24.device
18.307s dev-loop25.device
18.137s grub-common.service
18.110s dev-loop20.device
17.286s dev-loop15.device
17.158s dev-loop21.device
16.665s dev-loop19.device
16.648s dev-loop17.device
15.046s dev-loop11.device
systemd-analyze critical-chain
结果是-
graphical.target @2min 17.958s
└─multi-user.target @2min 17.957s
└─postgresql.service @2min 2.541s +143ms
└─[email protected] @44.090s +1min 18.450s
└─basic.target @44.051s
└─sockets.target @44.051s
└─snapd.socket @43.990s +60ms
└─sysinit.target @43.876s
└─systemd-timesyncd.service @40.817s +3.059s
└─systemd-tmpfiles-setup.service @38.798s +1.520s
└─local-fs.target @38.796s
└─run-user-1000-gvfs.mount @2min 48.252s
└─run-user-1000.mount @2min 30.698s
└─swap.target @35.602s
└─dev-disk-by\x2duuid-c8bb376c\x2dd620\x2d4b47\x2da8fb\x2d652c38543811.swap @33.503s +2.098s
└─dev-disk-by\x2duuid-c8bb376c\x2dd620\x2d4b47\x2da8fb\x2d652c38543811.device @33.502s
编辑2:
移除后postgresql
开机时间仍约2min
systemd-analyze blame | head -20
给出:
41.367s plymouth-quit-wait.service
20.468s snap-gtk\x2dcommon\x2dthemes-1198.mount
20.409s snap-gnome\x2d3\x2d26\x2d1604-82.mount
19.986s snap-gnome\x2dsystem\x2dmonitor-81.mount
19.908s snap-gnome\x2d3\x2d28\x2d1804-40.mount
19.042s snap-core-6818.mount
18.939s snap-heroku-3762.mount
18.775s snap-gnome\x2d3\x2d26\x2d1604-70.mount
18.184s dev-sdb6.device
14.139s snap-gnome\x2dcalculator-406.mount
14.128s snap-vlc-770.mount
14.032s snap-heroku-3685.mount
13.816s snap-gnome\x2dcharacters-258.mount
13.740s snap-core18-941.mount
13.631s snap-core-4917.mount
13.577s snap-gnome\x2dsystem\x2dmonitor-57.mount
13.523s snap-gnome\x2d3\x2d26\x2d1604-74.mount
13.433s snap-gtk\x2dcommon\x2dthemes-319.mount
13.411s snap-gnome\x2dcharacters-139.mount
13.094s snap-gnome\x2dcalculator-180.mount
systemd-analyze critical-chain
给予-
graphical.target @1min 23.456s
└─multi-user.target @1min 23.454s
└─kerneloops.service @51.067s +8ms
└─network-online.target @51.065s
└─NetworkManager-wait-online.service @42.081s +8.983s
└─NetworkManager.service @38.105s +3.972s
└─dbus.service @31.790s
└─basic.target @31.759s
└─sockets.target @31.759s
└─snapd.socket @31.657s +101ms
└─sysinit.target @31.633s
└─systemd-timesyncd.service @30.948s +685ms
└─systemd-tmpfiles-setup.service @30.094s +848ms
└─local-fs.target @30.093s
└─run-user-121.mount @50.162s
└─swap.target @22.765s
└─dev-disk-by\x2duuid-c8bb376c\x2dd620\x2d4b47\x2da8fb\x2d652c38543811.swap @22.563s +201ms
└─dev-disk-by\x2duuid-c8bb376c\x2dd620\x2d4b47\x2da8fb\x2d652c38543811.device @22.563s
另外,以防万一它可能会有所帮助 - 大多数时候屏幕是空白的,并且 ubuntu 徽标会短暂出现(我假设是 10-20 秒),然后出现登录屏幕。
编辑3-
同时systemd-analyze
揭示——
Startup finished in 3.976s (firmware) + 49.943s (loader) + 6.720s (kernel) + 1min 20.403s (userspace) = 2min 21.043s
graphical.target reached after 1min 17.190s in userspace
加载程序耗时 49.94 秒
编辑4- 重新安装 Ubuntu 18.04 后,启动日志显示新的错误-
[ 47.471182] IPv6: ADDRCONF(NETDEV_CHANGE): wlo1: link becomes ready
[ 65.656882] show_signal_msg: 28 callbacks suppressed
[ 65.656884] gnome-shell[1072]: segfault at 20 ip 00007fc16a2fa81d sp 00007ffdf619a4e0 error 4 in libmutter-2.so.0.0.0[7fc16a20c000+156000]
[ 67.640490] gnome-shell[1177]: segfault at 20 ip 00007f8a8430781d sp 00007fff201dba60 error 4 in libmutter-2.so.0.0.0[7f8a84219000+156000]
[ 101.336776] Bluetooth: RFCOMM TTY layer initialized
[ 101.336784] Bluetooth: RFCOMM socket layer initialized
[ 101.336788] Bluetooth: RFCOMM ver 1.11
[ 103.556549] rfkill: input handler disabled
安装 Ubuntu 19.04 后 图形驱动程序问题已解决,我已使用 Ubuntu 19.04 自动安装最新的 Nvidia 驱动程序。但启动时间仍未改善。
答案1
所以systemd-analyze
输出表明这[email protected]
是减慢启动时间的主要原因。
如果你不需要在系统上运行 PostgreSQL 服务器并在启动时自动启动,你可以使用以下命令完全卸载它:
sudo apt remove postgresql*
或者你可以保留它并禁用启动时自动启动服务
sudo systemctl disable postgresql
然后,您仍然可以使用以下命令手动启动当前会话的服务
sudo systemctl start postgresql
答案2
检查您是否拥有最新的 BIOS
sudo dmidecode -s bios-version
# 获取当前 BIOS 版本去https://support.hp.com,输入序列号,进入下载区,检查是否有更新的 BIOS
- 下载并安装较新的 BIOS
启动缓慢
- 您安装了超过二十多个 snap 应用程序
snap list
# 查看全部sudo snap remove xxxx
# 删除 snap 应用程序sudo apt-get install xxxx
# 将应用程序重新安装为常规应用程序
检查你的文件系统
- 启动至 Ubuntu Live DVD/USB
- 打开
terminal
窗户 - 类型
sudo fdisk -l
- 识别“Linux 文件系统”的 /dev/XXXX 设备名称
- 输入
sudo fsck -f /dev/XXXX
# 用你之前找到的数字替换 XXXX - 如果有错误,请重复 fsck 命令
- 类型
reboot
更新#1:
因为这并不能解决问题...
由于 BIOS 更新没有解决 ACPI 错误,而且 HP 似乎不想修复他们的 BIOS,我们将这样做...
sudo pico /etc/modprobe.d/acpi_fix.conf
# 创建新文件
在空文件中输入以下文本...
blacklist acpi_power_meter
然后保存文件...
control+ o,然后return
control+x
然后...
reboot
# 重启计算机
更新 #2:
fstrim 在 sdb6 上运行,导致启动速度变慢。
一个磁盘的 SMART 数据显示读取/寻道/ECC 错误率较高。
答案3
禁用 grub 中的 plymouth 以获得更快的启动速度(plymouth-quit-wait-service)
sudo nano /etc/default/grub
并改变行GRUB_CMDLINE_LINUX_DEFAULT进入
GRUB_CMDLINE_LINUX_DEFAULT="noplymouth video=SVIDEO-1:d"
保存更改后,你必须使用以下命令更新 grub
sudo update-grub
然后重新启动机器。