8

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://i.stack.imgur.com/86VE9.jpg

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)
Smajl
  • 275
  • 3
  • 12
  • Have you deleted or removed the device containing your swap partition (or any other partitions you told the installer to automatically mount)? If so, Ubuntu could be trying to find that partition and eventually giving up. – luk3yx Sep 26 '18 at 06:40
  • @luk3yx Hi, I have not tried that. How do I proceed and identify what should be removed and continue? – Smajl Sep 26 '18 at 06:45
  • I think you misunderstood, what I meant is if you had removed a partition in /etc/fstab it could have been the cause of the slow boot. – luk3yx Sep 26 '18 at 07:26
  • @luk3yx Alright, got what you meant. I did not remove anything manually (perhaps it happened during system installation?). How do I debug this? – Smajl Sep 26 '18 at 09:10
  • 2
    Can you install bootchart and post a pic? – Fabby Sep 26 '18 at 16:43
  • 1
    During the 50 second black screen there are messages you cannot see. Edit /etc/default/grub. Remove the "quiet splash" from between the double quotes but leave the double quotes there. Save the file. Run sudo update-grub. Reboot and update your question with the longest lasting message now appearing on your black screen. – WinEunuuchs2Unix Sep 30 '18 at 19:40
  • take a look at https://askubuntu.com/questions/1034359 ? – alfred Oct 01 '18 at 07:19
  • @alfred Thanks, I followed the instructions in the answer but the problem prevails (nothing changed). – Smajl Oct 01 '18 at 07:52
  • @Smajl Can you try commenting your swap from /etc/fstab and then trying rebooting? I guess that the start job process might be for the swap. – Prathu Baronia Oct 02 '18 at 10:00
  • @PrathuBaronia Hi, I tried commenting out the swap partition. It speeded up the process when I turn off my computer but had no effect on the boot time (which is a more pressing issue for me). – Smajl Oct 02 '18 at 11:45
  • Well the error says it's a problem with lvmetad - which I think is some sort of disk caching; I don't really know anything about it but you could disable from /etc/lvm/lvm.conf by setting use_lvmetad = 0. See how that changes things. I'd have a live USB drive set up ready, just in case changes make your system unbootable. – pbhj Oct 02 '18 at 14:47

1 Answers1

0

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:

Startup finished in 6.204s (kernel) + 6.059s (userspace) = 12.264s
graphical.target reached after 5.618s in userspace
Smajl
  • 275
  • 3
  • 12