19 сентября 2018 г. 17:40

Kernel startup is slow (Ubuntu 18.04 and Linux Mint 19)

Faced the issue that my laptop startup on Ubuntu 18.04 and Linux Mint 19 takes more than a minute.
The reason is that the kernel startup takes more than 1 min 40 seconds.
To check it execute the next command:
$ systemd-analyze
This should print out something like:
Startup finished in 40.293s (kernel) + 20.524s (userspace) = 1min 818ms
graphical.target reached after 20.498s in userspace

To fix this proble, open resume file for edition:
$ sudo nano /etc/initramfs-tools/conf.d/resume

And replace a line:
With the next line:

And then execute the next command to apply changes:
$ sudo update-initramfs -u
This command will take significant time, be patient and do not interrupt this process.

After successful applying, reboot the system:
$ sudo reboot

After reboot let's check startup time again:
$ systemd-analyze
Startup finished in 9.121s (kernel) + 25.787s (userspace) = 34.909s
graphical.target reached after 22.528s in userspace

Creating a swapfile

Apparently swap partition does not work on Ubuntu 18.04 and Linux Mint 19.
To solve this problem I've created a swapfile

1. Create a swapfile and fill it with zeros:
$ sudo dd if=/dev/zero of=/swapfile bs=1M count=2048

2. Prepare swapfile for usage:
$ sudo mkswap /swapfile
$ sudo chmod 600 /swapfile

3. Add it to fstab
$ sudo nano /etc/fstab

With the next line:
/swapfile none swap sw 0 0
Find and comment out a line with an old swap!
Save changes: Ctrl+O, Enter
Exit from the editor: Ctrl+X

4. Activate the swapfile:
$ sudo swapon /swapfile

5. Reboot:
$ sudo reboot

6. Check after restart:
$ sudo swapon --show
$ free -h

PS: This article is only relevant for Ubuntu 18.04 and Linux Mint 19
When Linux Mint 20 was installed, the problem did not appear.

Комментариев пока нет :(

Add comment