Score:1

Kubuntu takes a long time to start up

de flag

As per the subject, Kubuntu takes 1:03 minutes to start, but there is an inconsistency with some data:

andrea@Tehesyan:~$ systemd-analyze time
Startup finished in 4.504s (firmware) + 2.140s (loader) + 5.188s (kernel) + 9.054s (userspace) = 20.888s 
graphical.target reached after 9.007s in userspace.

As you can see the boot time should be around 30 seconds, what does the system do in the other time?

andrea@Tehesyan:~$ systemd-analyze blame --no-pager
6.289s NetworkManager-wait-online.service
1.541s snapd.service
 996ms snapd.apparmor.service
 970ms systemd-resolved.service
 949ms systemd-binfmt.service
 948ms systemd-timesyncd.service
 809ms lm-sensors.service
 555ms snapd.seeded.service
 275ms apport.service
 230ms dev-nvme0n1p3.device
 153ms udisks2.service
 149ms accounts-daemon.service
 148ms cups.service
 147ms [email protected]
 134ms systemd-journal-flush.service
 114ms plymouth-quit.service
  97ms ModemManager.service
  94ms ua-timer.service
  92ms avahi-daemon.service
  92ms bluetooth.service
  90ms rsyslog.service
  86ms dbus.service
  79ms polkit.service
  78ms power-profiles-daemon.service
  73ms systemd-udev-trigger.service
  71ms systemd-udevd.service
  71ms smartmontools.service
  68ms and.service
  63ms virtualbox.service
  59ms systemd-logind.service
  58ms thermald.service
  57ms update-notifier-download.service
  51ms gpu-manager.service
  49ms systemd-tmpfiles-clean.service
  49ms grub-common.service
  46ms alsa-restore.service
  45ms upower.service
  45ms home.mount
  40ms boot-efi.mount
  36ms keyboard-setup.service
  36ms apparmor.service
  35ms snap-bare-5.mount
  33ms NetworkManager.service
  33ms snap-core-14946.mount
  32ms e2scrub_reap.service
  31ms pure-ftpd.service
  31ms snap-core18-2751.mount
  30ms systemd-fsck@dev-disk-by\x2duuid-4cc61126\x2d9300\x2d4049\x2d8a21\x2d8efb758016f5.service
  30ms snap-core18-2785.mount
  28ms snap-core20-1891.mount
  26ms snap-core22-634.mount
  26ms systemd-modules-load.service
  26ms grub-initrd-fallback.service
  26ms systemd-fsck@dev-disk-by\x2duuid-A544\x2dD3FB.service
  25ms systemd-journald.service
  25ms snap-core22-750.mount
  24ms snap-gnome\x2d3\x2d38\x2d2004-140.mount
  23ms snap-gnome\x2d42\x2d2204-105.mount
  22ms snap-gnome\x2d42\x2d2204-111.mount
  21ms plymouth-start.service
  21ms snapd.socket
  21ms snap-gtk2\x2dcommon\x2dthemes-13.mount
  20ms snap-gtk\x2dcommon\x2dthemes-1535.mount
  20ms colord.service
  19ms wpa_supplicant.service
  19ms proc-sys-fs-binfmt_misc.mount
  19ms snap-snapd-19122.mount
  18ms systemd-tmpfiles-setup.service
  17ms snap-snapd-19361.mount
  17ms systemd-tmpfiles-setup-dev.service
  15ms snap-winbox-112.mount
  14ms kerneloops.service
  13ms systemd-sysusers.service
  13ms snap-wine\x2dplatform\x2d5\x2dstable-18.mount
  12ms dev-hugepages.mount
  12ms dev-mqueue.mount
  11ms sys-kernel-debug.mount
  11ms sys-kernel-tracing.mount
  11ms snap-wine\x2dplatform\x2druntime-348.mount
  11ms plymouth-read-write.service
  11ms systemd-random-seed.service
   9ms snap-wine\x2dplatform\x2druntime-349.mount
   9ms systemd-sysctl.service
   8ms motd-news.service
   8ms systemd-backlight@backlight:intel_backlight.service
   7ms [email protected]
   7ms kmod-static-nodes.service
   7ms systemd-remount-fs.service
   7ms [email protected]
   7ms dev-disk-by\x2duuid-7cd25b73\x2df94a\x2d4b4a\x2d965c\x2d703a45eb5556.swap
   7ms dev-loop14.device
   7ms [email protected]
   7ms dev-loop13.device
   7ms dev-loop12.device
   7ms dev-loop8.device
   7ms dev-loop11.device
   6ms dev-loop9.device
   6ms [email protected]
   6ms dev-loop16.device
   6ms dev-loop15.device
   6ms dev-loop10.device
   5ms dev-loop17.device
   4ms systemd-update-utmp.service
   4ms modprobe@efi_pstore.service
   4ms systemd-rfkill.service
   4ms setvtrgb.service
   3ms systemd-user-sessions.service
   3ms systemd-update-utmp-runlevel.service
   3ms console-setup.service
   2ms sddm.service
   2ms sys-fs-fuse-connections.mount
   2ms rtkit-daemon.service
   1ms sys-kernel-config.mount
   1ms ufw.service  

again

andrea@Tehesyan:~$ systemd-analyze critical-chain --no-pager
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

graphical.target @9.031s
└─multi-user.target @9.031s
  └─virtualbox.service @8.967s +63ms
    └─network-online.target @8.919s
      └─NetworkManager-wait-online.service @2.628s +6.289s
        └─NetworkManager.service @2.592s +33ms
          └─dbus.service @2.503s +86ms
            └─basic.target @2.492s
              └─sockets.target @2.492s
                └─snapd.socket @2.470s +21ms
                  └─sysinit.target @2.468s
                    └─snapd.apparmor.service @1.471s +996ms
                      └─apparmor.service @1.432s +36ms
                        └─local-fs.target @1.431s
                          └─run-user-1000.mount @4.336s
                            └─swap.target @563ms
                              └─dev-disk-by\x2duuid-7cd25b73\x2df94a\x2d4b4a\x2d965c\x2d703a45eb5556.swap @554ms +7ms
                                └─dev-disk-by\x2duuid-7cd25b73\x2df94a\x2d4b4a\x2d965c\x2d703a45eb5556.device @549ms

again

andrea@Tehesyan:~$ journalctl --boot=0 --priority=3 --no-pager
giu 16 16:31:49 Tehesyan kernel: ACPI BIOS Error (bug): Failure creating named object [\_SB.PC00.I2C0.TPL1._PR0], AE_ALREADY_EXISTS (20221020/dswload2-326)
giu 16 16:31:49 Tehesyan kernel: ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20221020/psobject-220)
giu 16 16:31:49 Tehesyan kernel: ACPI BIOS Error (bug): Failure creating named object [\_SB.PC00.I2C0.TPL1._PR3], AE_ALREADY_EXISTS (20221020/dswload2-326)
giu 16 16:31:49 Tehesyan kernel: ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20221020/psobject-220)
giu 16 16:31:49 Tehesyan kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0], AE_NOT_FOUND (20221020/dswload2-162)
giu 16 16:31:49 Tehesyan kernel: ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20221020/psobject-220)
giu 16 16:31:49 Tehesyan kernel: tpm tpm0: [Firmware Bug]: TPM interrupt not working, polling instead
giu 16 16:31:49 Tehesyan systemd-udevd[494]: event_source: Failed to get device name: No such file or directory
giu 16 16:31:51 Tehesyan bluetoothd[807]: src/plugin.c:plugin_init() Failed to init vcp plugin
giu 16 16:31:51 Tehesyan bluetoothd[807]: src/plugin.c:plugin_init() Failed to init mcp plugin
giu 16 16:31:51 Tehesyan bluetoothd[807]: src/plugin.c:plugin_init() Failed to init bap plugin
giu 16 16:31:56 Tehesyan kernel: rtw_8822ce 0000:03:00.0: failed to do dpk calibration
giu 16 16:32:00 Tehesyan bluetoothd[807]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 14:79:DB:8A:3E:DF: Host is down (112)
giu 16 16:32:05 Tehesyan bluetoothd[807]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 10:F0:05:CA:70:FA: Host is down (112)
giu 16 16:32:35 Tehesyan systemd[1129]: Failed to start app-baloo_file-ff4b7f2a20f64e4abb162e3d474e7625.scope - Demone dei file Baloo.
giu 16 16:32:36 Tehesyan hp-systray[1949]: hp-systray[1949]: error: option -s not recognized
giu 16 16:32:40 Tehesyan systemd[1129]: Failed to start app-script\x2dremapping\x2dmouse\x2dkeys-b3f82c270c8046e0b4bd32758d6d46b5.scope - script-remapping-mouse-keys.
giu 16 16:32:40 Tehesyan systemd[1129]: Failed to start app-snap\x2duserd\x2dautostart-5b2d61154fee442aad23110308d429fa.scope - Snap user application autostart helper.
giu 16 16:32:40 Tehesyan systemd[1129]: Failed to start app-spice\x2dvdagent-8817624255bb4aabaffb22400d7d5f9c.scope - Spice vdagent.
giu 16 16:32:40 Tehesyan systemd[1129]: Failed to start app-xbindkeys-6a68845bad8a4b63abd513ce3f205f2d.scope - xbindkeys.
giu 16 16:52:56 Tehesyan kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe B (start=94294 end=94295) time 257 us, min 1071, max 1079, scanline start 1068, end 1089
giu 16 17:16:25 Tehesyan kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe B (start=199919 end=199920) time 273 us, min 1071, max 1079, scanline start 1062, end 1063
giu 16 17:30:07 Tehesyan systemd[1129]: Failed to start app-\x2fhome\x2fandrea\x2fprogrammazione\x2fbash\x2dscripts\x2fscript\x2dremapping\x2dmouse\x2dkeys.sh-59cc7cd375644db098a000315149cb04.scope - /home/andrea/programmazione/bash-scripts/script-remapping-mouse-keys.sh.

again

andrea@Tehesyan:~$ journalctl --boot=0 --priority=4 --no-pager --grep='disk|mount'
giu 16 16:31:49 Tehesyan systemd-udevd[497]: nvme0n1: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/nvme0n1' failed with exit code 1.
giu 16 16:31:49 Tehesyan systemd-udevd[496]: sda: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/sda' failed with exit code 1.
giu 16 16:31:49 Tehesyan systemd-udevd[524]: nvme0n1p3: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/nvme0n1p3' failed with exit code 1.
giu 16 16:31:49 Tehesyan systemd-udevd[523]: nvme0n1p2: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/nvme0n1p2' failed with exit code 1.
giu 16 16:31:49 Tehesyan systemd-udevd[497]: nvme0n1p1: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/nvme0n1p1' failed with exit code 1.
giu 16 16:31:49 Tehesyan systemd-udevd[532]: sda1: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/sda1' failed with exit code 1.

other informations:

Kernel: 6.2.0-20-generic 
arch: x86_64 bits: 
64 compiler: N/A
Desktop: KDE Plasma v: 5.27.4 
Distro: Ubuntu 23.04 (Lunar Lobster)
product: HP 250 15.6 inch G9 Notebook PC
SAMSUNG SOLID STATE DRIVE SSD 256GB M.2 NVMe

The notebook is about a month old, I don't remember very well but it seems to me that at the beginning it didn't take up all this time.

I believe the problem is before the OS loads, at least that's what I assume, unless the data provided by systemd-analyze time is incorrect.

I would like you to help me investigate why the system takes so long to start up, and take countermeasures. Thanks

P.S. The smoke you see in the video is from a cigarette, not from the notebook lol

startup video

Raffa avatar
jp flag
Please [edit] your question to add the output of `systemd-analyze blame --no-pager` and `systemd-analyze critical-chain --no-pager`
canerandagio avatar
de flag
@Raffa Thanks for your interest, I've added what you requested.
Raffa avatar
jp flag
Thanks, this looks normal ... Let's see if there were any last boot errors `journalctl --boot=0 --priority=3 --no-pager` and lets check "disk" and "mount" related messages one more log-level up `journalctl --boot=0 --priority=4 --no-pager --grep='disk|mount'` ... Please add the output of both these commands.
oldfred avatar
cn flag
Several things to review in these questions: https://askubuntu.com/questions/1284302/is-it-possible-to-make-ubuntu-20-04-boot-faster & https://askubuntu.com/questions/1187117/slow-boot-boot-19-10-tried-almost-everything & https://askubuntu.com/questions/1018576/what-does-networkmanager-wait-online-service-do & https://askubuntu.com/questions/800479/ubuntu-16-04-slow-boot-apt-daily-service
canerandagio avatar
de flag
@Raffa I've added the outputs, there seems to be a lot of problems
canerandagio avatar
de flag
@Raffa For ACPI errors I don't think much can be done, HP doesn't give the possibility to install updated firmware from Linux systems, maybe I could install a VM with windows and create the file with the key to update the firmware..
Raffa avatar
jp flag
@CaneRandagio "ACPI errors" don't seem to be related to delaying your boot time so I wouldn't worry about them ... However, other things are and the other things seem to be user applications and startup scripts ... And I have just now checked your linked video and will write an answer in a short while to explain what is happening and what you can do to improve "*boot*"(*turned out to be not totally boot*) time.
Score:1
jp flag

Your system, boot-wise, is "almost" perfect

I didn't check your linked video initially, like most command-line "geeks" here, we prefer the black background of a terminal and avoid colorful bright videos as we think it might hurt our eyes and might be lengthy and unnecessary ... But, I was wrong, your video turned out to be a very important piece of evidence as it shows you calculate boot time from the time you switch on your machine until you see your desktop ... I was on a totally different wavelength ... Actually, systemd-analyze counts boot time up-to graphical.target(the last systemd unit in the boot process) ... graphical.target is the login-manager's greeter AKA the user-login-screen ... Now, you clearly see the reason for discrepancy in how systemd-analyze prints boot time versus your own calculation of boot time.

The output of systemd-analyze time is correct, your boot time is 20.888(slightly more by one or two) seconds ... Furthermore, the output systemd-analyze blame and systemd-analyze critical-chain confirm the last 9.054 seconds supported by more details.

Why "almost"?

Because it takes around 6 seconds included in the 9 (userspace) seconds just waiting for network connection ... This doesn't necessarily mean that it's delaying system boot by full 6 seconds as services can run in parallel with other services that don't have a dependency relationship(either depends or reverse depends) with ... But, it can be improved and I recommend it given the ratio of two thirds the userspace boot time ... Please see How to decrease the boot time for how to do that.

And the rest of the 1:03 minutes?

That is your own desktop environment's user-session loading ... This isn't part of the boot process but actually a part of the user login process which might or might not happen immediately after boot and might happen multiple times and for multiple users anytime a user logs-in or out and back in as long as the system is running be it for a few hours, days or even months ... The fact that you have automatic-login enabled doesn't make it part of system boot, it's still a user login session.

Why is my user login session taking that much time to load?

It takes time(not necessarily that long ... maybe less and maybe more) to set up your user session including drawing the GUI, parsing your user login configuration files, loading your startup applications/scripts, mounting your user defined filesystems, connecting and configuring devices e.g. external monitors, starting your user services like audio ... etc. ... The more you customize your user environment to your needs/liking, the more time it takes to load your user session compared to when you first created your user.

You appear to have done just that ... For example:

  • You connect Bluetooth devices:

    bluetoothd[807]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 14:79:DB:8A:3E:DF: Host is down (112)
    bluetoothd[807]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 10:F0:05:CA:70:FA: Host is down (112)
    
  • You have Baloo enabled(might be the default though):

    Failed to start app-baloo_file-ff4b7f2a20f64e4abb162e3d474e7625.scope - Demone dei file Baloo.
    
  • You have hp-systray installed and enabled:

    hp-systray[1949]: hp-systray[1949]: error: option -s not recognized
    
  • You have a custom script to map your mouse keys:

    Failed to start app-script\x2dremapping\x2dmouse\x2dkeys-b3f82c270c8046e0b4bd32758d6d46b5.scope - script-remapping-mouse-keys.
    
  • etc. ...

Bottom-line is ... it's a part of your user experience and it can enrich it and naturally increase your login time a bit to fulfill your needs in a desktop environment user session.

canerandagio avatar
de flag
So if I understand correctly, everything is normal, and there is little to do, I can just disable NetworkManager-wait-online.service, thanks
Raffa avatar
jp flag
@CaneRandagio That is correct … You are welcome.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.