I recently did a fresh install of Ubuntu 18.04 on my brand new laptop ASUS ZenBook UX430UN and I am experiencing a very slow boot.
I am not sure how to debug and solve this issue. I came across several issues similar to mine with Ubuntu 18.04 but none of the workarounds improved my problem.
Symptoms:
After the system boot, I see the purple screen for a few seconds and then, the screen turns black and waits for cca 50 seconds before displaying the Ubuntu logo. After that, the system starts normally and works fine once booted.
I have a second desktop computer running the same system (both Ubuntu dists having the most recent updates) and it boots in under 10 seconds. This one is almost one minute, however.
Startup finished in 35.752s (kernel) + 12.683s (userspace) = 48.436s
graphical.target reached after 11.941s in userspace
I read that this issue might be related to low entropy during boot so I tried installing rng-tools
and haveged
but nothing changed.
This is the output of systemd-analyze blame
:
7.027s NetworkManager-wait-online.service
3.801s plymouth-start.service
3.778s plymouth-read-write.service
3.172s plymouth-quit-wait.service
2.311s apt-daily-upgrade.service
2.072s apparmor.service
793ms snapd.service
768ms fwupd.service
726ms tlp.service
544ms keyboard-setup.service
412ms systemd-logind.service
394ms dev-mapper-ubuntu\x2d\x2dvg\x2droot.device
381ms snapd.seeded.service
264ms snap-gnome\x2d3\x2d26\x2d1604-59.mount
252ms snap-gnome\x2dcharacters-124.mount
247ms snap-gnome\x2dcalculator-238.mount
214ms snap-core-5145.mount
207ms NetworkManager.service
200ms snap-gnome\x2dcalculator-180.mount
199ms snap-core-4486.mount
198ms networkd-dispatcher.service
186ms snap-gtk\x2dcommon\x2dthemes-701.mount
184ms systemd-timesyncd.service
and 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 @11.941s
└─multi-user.target @11.941s
└─kerneloops.service @11.926s +14ms
└─network-online.target @11.925s
└─NetworkManager-wait-online.service @4.897s +7.027s
└─NetworkManager.service @4.688s +207ms
└─dbus.service @4.638s
└─basic.target @4.619s
└─sockets.target @4.619s
└─snapd.socket @4.618s +838us
└─sysinit.target @4.616s
└─cryptsetup.target @4.611s
└─systemd-ask-password-wall.path @217ms
└─-.mount @215ms
└─system.slice @217ms
└─-.slice @215ms
I am not even sure how to debug this properly so I will be happy for any suggestions what to try. I am happy to provide more details if needed.
EDIT 1:
This is the bootchart graph: https://imgur.com/a/6p0zJjm
EDIT 2:
I removed the "quiet splash" and it seems that it hangs for a while on the following lines:
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... WARNING Failed to connect to lvmetad. Falling back to device scanning.
Begin: Running /scripts/local-premount ...
Also: It takes significant amount of time to shutdown/restart the computer and hangs on the following line:
[ *** ] A stop job is running for Session 2 of user smajl (1min 20s / 1min 30s)
Best Answer
I finally solved my problem by following the steps in this tutorial: https://www.hiroom2.com/2018/05/01/ubuntu-1804-lvm-swap-wait-for-root-en/
Apparently, the issue was with my swap partition waiting for root and eventually timing out. I am not hundred percent sure if this is a valid solution but it definitely speeded up boot time for me: