Score:4

Ubuntu 22.04 on VirtualBox takes 5 minutes to boot

vu flag

A few days ago, I installed Oracle VM VirtualBox Manager and added a Ubuntu 22.04 VM. I'm new to Ubuntu, and currently, the problem I am having is that it takes nearly 5 minutes to boot up Ubuntu.

I have given the VM 16MB of ram, 12 CPU cores, and 16Mb of video memory, so I don't think the problem is a lack of memory. My laptop is new as well, so nothing on that front. I've looked at other questions here, but none of them seem to solve my own issue. Below, I've included any information I could find about the issue:

I am using a Lenovo Thinkpad X1 Gen 10, with the following System Specs:

Processor 12th Gen Intel(R) Core(TM) i7-1270P 2.20 GHz
Installed RAM 32.0 GB (31.7 GB usable)
System type 64-bit operating system, x64-based processor

Log from sudo systemd-analyze:

Startup finished in 28.543s (kernel) + 4min 12.340s (userspace) = 4min 40.883s 
graphical.target reached after 4min 11.918s in userspace

Log from sudo systemd-analyze blame:

3min 38.930s plymouth-quit-wait.service
1min 18.298s snapd.service
 1min 5.788s vboxadd.service
     32.317s udisks2.service
     31.605s networkd-dispatcher.service
     29.849s accounts-daemon.service
     20.852s ModemManager.service
     20.214s NetworkManager-wait-online.service
     18.067s snapd.seeded.service
     17.132s cups.service
     13.753s NetworkManager.service
     12.332s power-profiles-daemon.service
     11.085s gdm.service
     10.839s polkit.service
     10.699s upower.service
     10.270s e2scrub_reap.service
      8.551s avahi-daemon.service
      8.297s switcheroo-control.service
      7.858s systemd-logind.service
      7.791s wpa_supplicant.service
      7.391s dev-sda3.device
      7.091s dev-loop5.device
      6.514s vboxadd-service.service
      5.915s dev-loop10.device
      5.877s dev-loop9.device
      5.832s dev-loop8.device
      5.212s dev-loop6.device
      5.180s dev-loop4.device
      5.064s dev-loop11.device
      4.964s dev-loop3.device
      4.961s dev-loop7.device
      4.899s systemd-modules-load.service
      4.698s dev-loop1.device
      4.586s systemd-sysctl.service
      4.449s dev-loop2.device
      3.983s packagekit.service
      3.526s dev-loop0.device
      2.777s snapd.apparmor.service
      2.491s grub-common.service
      2.485s [email protected]
      2.483s modprobe@pstore_blk.service

From cat /etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#

# <file system> <mount point>   <type>  <options>       <dump>  <pass>

# / was on /dev/sda3 during installation
UUID=5ad09f57-44c7-41d2-bd5c-3488ad58dba0 /               ext4    errors=remount-ro 0       1

# /boot/efi was on /dev/sda2 during installation
UUID=A505-32D9  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

Log from sudo systemd-analyze critical-chain:

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 @4min 11.918s
└─multi-user.target @4min 11.918s
  └─plymouth-quit-wait.service @32.987s +3min 38.930s
    └─systemd-user-sessions.service @31.969s +787ms
      └─network.target @30.761s
        └─NetworkManager.service @16.848s +13.753s
          └─dbus.service @16.823s
            └─basic.target @16.539s
              └─sockets.target @16.539s
                └─snapd.socket @16.461s +74ms
                  └─sysinit.target @16.347s
                    └─snapd.apparmor.service @13.569s +2.777s
                      └─apparmor.service @11.287s +2.248s
                        └─local-fs.target @11.259s
                          └─run-snapd-ns.mount @2min 15.093s
                            └─local-fs-pre.target @2.163s
                              └─systemd-tmpfiles-setup-dev.service @1.633s +529ms
                                └─systemd-sysusers.service @1.086s +540ms
                                  └─systemd-remount-fs.service @689ms +256ms
                                    └─systemd-journald.socket @454ms
                                      └─system.slice @439ms
                                        └─-.slice @439ms
us flag
Remove snapd. That will save you a lot of time. Also, do you have a SSD?
Christopher Miller avatar
vu flag
I'll remove `snapd` (thanks for the suggestion), but the remaining time will still probably be north of 2 minutes. I have a 500GB SSD.
us flag
Sometimes, removing snapd dramatically reduces the startup time of other services. Can you remove snapd and update the question with the new systemd-analyze results?
us flag
Is there any error/warning message (like waiting for something) in the boot screen?
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.