Score:2

How can I make ubuntu start faster

yt flag

I'm running 21.10 and it is very slow to start. What can I do to speed it up? Here are some output from systemd-analyze

# systemd-analyze time
Startup finished in 4.592s (kernel) + 2min 52.922s (userspace) = 2min 57.515s 
graphical.target reached after 2min 52.311s in userspace

# 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 @2min 52.311s
└─multi-user.target @2min 52.311s
  └─plymouth-quit-wait.service @1min 743ms +1min 51.566s
    └─systemd-user-sessions.service @1min 338ms +214ms
      └─network.target @1min 51ms
        └─wpa_supplicant.service @51.897s +8.153s
          └─dbus.service @49.103s
            └─basic.target @49.073s
              └─sockets.target @49.072s
                └─cups.socket @58.292s
                  └─sysinit.target @48.963s
                    └─snapd.apparmor.service @47.673s +1.289s
                      └─apparmor.service @45.304s +2.366s
                        └─local-fs.target @45.302s
                          └─boot.mount @45.266s +34ms
                            └─systemd-fsck@dev-disk-by\x2duuid-5dff6fb3\x2d361f\x2d4666\x2d9462\x2d45f78a65ab47.service @45.001s +24>
                              └─dev-disk-by\x2duuid-5dff6fb3\x2d361f\x2d4666\x2d9462\x2d45f78a65ab47.device @44.999s

# systemd-analyze blame
1min 51.566s plymouth-quit-wait.service
 1min 9.365s man-db.service
     35.323s dev-sda3.device
     31.737s logrotate.service
     27.427s snapd.service
     25.519s networkd-dispatcher.service
     19.326s cups.service
     18.091s apt-daily.service
     17.520s systemd-journal-flush.service
     17.516s udisks2.service
     15.157s ModemManager.service
     12.620s NetworkManager-wait-online.service
     12.069s dev-loop14.device
     11.440s dev-loop11.device
     11.230s dev-loop26.device
     11.224s dev-loop3.device
     10.977s dev-loop20.device
     10.877s NetworkManager.service
     10.877s avahi-daemon.service
     10.803s dev-loop16.device
     10.717s dev-loop9.device
     10.694s dev-loop22.device
     10.584s dev-loop25.device
     10.550s polkit.service
     10.415s accounts-daemon.service
     10.317s dev-loop27.device
     10.101s dev-loop18.device
      9.976s dev-loop2.device
      9.830s dev-loop13.device
      9.816s dev-loop24.device
      9.720s dev-loop23.device
      9.665s power-profiles-daemon.service
      9.451s dev-loop21.device
      9.429s dev-loop15.device
      9.224s dev-loop19.device
      8.392s dev-loop12.device
      8.299s dev-loop10.device
      8.202s switcheroo-control.service
      8.169s dev-loop17.device
      8.153s wpa_supplicant.service
      8.091s thermald.service
      8.084s systemd-logind.service
      7.972s snapd.seeded.service
      7.845s dev-loop4.device
      7.192s dev-loop8.device
      5.923s gdm.service
      5.645s dev-loop6.device
      5.556s dev-loop1.device
      5.166s dev-loop7.device

Any ideas?

EDIT 1: Some system info.

It has 4 cores.

vendor_id   : AuthenticAMD
cpu family  : 21
model       : 16
model name  : AMD A8-5500 APU with Radeon(tm) HD Graphics
stepping    : 1
microcode   : 0x6001119
cpu MHz     : 1406.533
cache size  : 2048 KB

12 GB ram.

There is a SSD disc in the system.

/etc/fstab

# / was on /dev/sda3 during installation
UUID=1987d431-8f81-442f-8fc1-821fc4a1283a /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=5dff6fb3-361f-4666-9462-45f78a65ab47 /boot           ext4    defaults        0       2
# swap was on /dev/sda5 during installation
UUID=a4a87e3f-9f91-40bb-baa1-3bc7b11d1f1c none            swap    sw              0       0

fdisk -l (skipping /dev/loop1 ... /dev/loop30)

disk /dev/sda: 298,09 GiB, 320072933376 byte, 625142448 sektorer
Disk model: WDC WD3200BEVT-2
Enheter: sektorer av 1 * 512 = 512 byte
Sektorstorlek (logisk/fysisk): 512 byte / 512 byte
I/O-storlek (minsta/optimal): 512 byte / 512 byte
Disketikettstyp: dos
Diskidentifierare: 0x64a92ab6

Enhet      Start   Början    Slutet  Sektorer Storlek Id Typ
/dev/sda1  *         2048   1953791   1951744    953M 83 Linux
/dev/sda2         1955838  17577983  15622146    7,4G  5 Utökad
/dev/sda3        17577984 625141759 607563776  289,7G 83 Linux
/dev/sda5         1955840  17577983  15622144    7,4G 82 Linux växling / Solaris

Poster i partitionstabell är inte i diskordning.

And here is blkid

/dev/sda5: UUID="a4a87e3f-9f91-40bb-baa1-3bc7b11d1f1c" TYPE="swap" PARTUUID="64a92ab6-05"
/dev/sda3: UUID="1987d431-8f81-442f-8fc1-821fc4a1283a" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="64a92ab6-03"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda1: UUID="5dff6fb3-361f-4666-9462-45f78a65ab47" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="64a92ab6-01"
Matthias Lenmher avatar
nl flag
could you provide some info about system's spec?
heynnema avatar
ru flag
Edit your question and show me `cat /etc/fstab` and `sudo blkid` and `sudo fdisk -l`, and screenshots of the `Disks` app **SMART Data & Tests** data window (resize this window to capture all of the data). Start comments to me with @heynnema or I'll miss them.
heynnema avatar
ru flag
Please show me the requested SMART data. Let me know when you have it. Start comments to me with @heynnema or I'll miss them.
heynnema avatar
ru flag
Please see my completed answer. If it's helpful, please remember to accept it by clicking on the checkmark icon that appears just to the left of my answer. Thanks!
Artur Meinild avatar
vn flag
Does this answer your question? [How do I improve boot speed?](https://askubuntu.com/questions/10290/how-do-i-improve-boot-speed)
heynnema avatar
ru flag
Status please...
heynnema avatar
ru flag
Status please...
Elder Geek avatar
cn flag
WD3200BEVT-2 is not an SSD, people it's 320GB of spinning rust at 5400 RPM. Boot time seems normal for this hardware configuration.
yt flag
Hello, about the status: I have not had any time to work any more on this.
Score:4
ru flag

First, let's check your file system(s).

  • boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
  • open a terminal window by pressing Ctrl+Alt+T
  • type sudo fdisk -l
  • identify the /dev/sdXX device name for your "Linux Filesystem"
  • type sudo fsck -f /dev/sda3, replacing sdXX with the number you found earlier
  • type sudo fsck -f /dev/sda1, replacing sdXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot

Review

Show me cat /etc/fstab and sudo blkid and sudo fdisk -l, and screenshots of the Disks app SMART Data & Tests data window (resize this window to capture all of the data).

I've reviewed the above, but didn't get the requested SMART data screenshot.

Note: If I can get the SMART data, I may make further recommendations.

Note: There is no SSD on this system.

There are a number of things wrong. The following excerpts and comments will detail the problems.


RAM

model name  : AMD A8-5500 APU with Radeon(tm) HD Graphics
12 GB ram

AMD Processors are very fussy about RAM.

With 12G RAM, you must have 8G and 4G DIMMS, so your system cannot take speed advantage of having equal size/spec DIMMS, and memory interleaving is not being used.

Go to https://www.memtest86.com/ and download/run their free memtest to test your memory. Get at least one complete pass of all the 4/4 tests to confirm good memory. This may take a few hours to complete.


/etc/fstab

# /boot was on /dev/sda1 during installation
UUID=5dff6fb3-361f-4666-9462-45f78a65ab47 /boot           ext4    defaults        0       2

You'll notice this same UUID in the systemd-analyze command output.

This should be:

# /boot was on /dev/sda1 during installation
UUID=5dff6fb3-361f-4666-9462-45f78a65ab47 /boot           vfat    defaults        0       1

ext4 should be vfat. The fsck test should be 1, not 2.

But you can't just change this in fstab. More detail in a moment.


fdisk -l (skipping /dev/loop1 ... /dev/loop30)

Each SNAP application slows down the boot. Remove SNAP apps as possible, and change to regular .deb/repo apps to speed things up.

Disketikettstyp: dos

If you've got a UEFI computer, then dos should be GPT partition table.

Enhet      Start   Början    Slutet  Sektorer Storlek Id Typ
/dev/sda1  *         2048   1953791   1951744    953M 83 Linux

Poster i partitionstabell är inte i diskordning

Same partition that I mention earlier, and it's not in the correct partition order. This effects boot time also.

Summary

  • Backup your important data
  • Lay down a fresh GPT partition table (this WILL wipe the disk), using gparted
  • Clean install Ubuntu
  • Accept the installer's default partition plan
  • Reinstall apps and data. Better to not use SNAP apps if possible.
  • If possible, change 4G DIMM to a matching 8G DIMM
yt flag
Thank you for your reply. I will consider this and think about it.
heynnema avatar
ru flag
@user1887384 I'd still like to see the SMART data.
Score:2
vg flag

Mounting the disk is taking ridiculous time.

Check:

  • Time system clock is correct (i.e. not far in the past or the future, and your RTC battery is working)
  • Check logs (e.g. dmesg, /var/log/kern.log, /var/log/syslog) for errors in /dev/sda. Your disk may be dying, or the cable could be loose.
  • Run sudo tune2fs -l /dev/sda3 (and for all partitions) and check for 'Maximum mount count:' (run fsck every N mounts) and 'Check interval:' (run fsck after N days since last check). Your partition may be misconfigured to run fsck on every boot. You can tweak those values with tune2fs
  • Run a full fsck scan (alternate guide)

Maybe your disk could just do some service by getting a full wipe (if it's an SSD). Some SSDs get really bad after enough write cycles and TRIM maintenance isn't enough (or the TRIM itself takes too long).

But as Matthias Lenmher said, without specs it's hard to figure out more.

Update

I saw you posted HDD info. According to the internet the WD3200BEVT is a laptop regular hdd disk. Your disk could just be too fragmented and/or you have a lot of bloat. The best course of action is to just do a full format and reinstall (or replace it with an SSD...)

But to be on the safe side, post the full output of sudo smartctl -a /dev/sda. It's far too common for laptop HDDs to receive impacts and have lots of startup errors or read/write errors.

yt flag
* The clock is fine,
Elder Geek avatar
cn flag
2 mins. Isn't that long for a 5400 RPM HDD. Nice catch.
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.