Accelerate LINUX Boot by Disabling Unneeded Services


Published: 2021-01-04
Updated: 2021-01-05
Web: https://fritzthecat-blog.blogspot.com/2021/01/accelerate-linux-boot-by-disabling.html


My Ubuntu 20.04 LINUX takes about 70 seconds to boot on my 4 x 1.70 GHz cores laptop with 8 GB memory. This is much slower than WINDOWS, so I wondered if I can make this faster. On the web I found some useful commands. (I summarize them here in case I will need them again - that's what Blogs are for !-)

Finding out how much time every service startup took:


systemd-analyze blame
>



Parts of the output:



style="background: #f0f3f3; overflow:auto;width:auto;font-size: 120%; border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"
>

34.526s postgresql@9.3-main.service
34.086s snapd.service
33.170s postgresql@12-main.service
33.078s postgresql@9.5-main.service
33.024s postgresql@10-main.service
24.547s docker.service
....
>



Postgreslq database needed 34 seconds startup time, Snap 34, Docker 25.
Docker and Snap are deployment tools that I
don't use, Postgres I use rarely for testing
JPA
functionality. Although these startups are done in background, why do them on
boot?




Displaying all services and their status:



style="background: #f0f3f3; overflow:auto;width:auto;font-size: 120%; border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"
>

service --status-all
>



This gives you a list of all service names, either running [ + ] or stopped [ - ]. These
names you can use to manage the services:



style="background: #f0f3f3; overflow:auto;width:auto;font-size: 120%; border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"
>
 ....
[ + ] docker
....
[ + ] postgresql
....

Surprisingly Snap was not in this list .... looks like this is not so easy to get rid of. You can list your applications depending on Snap using this command:

snap list

Chromium, Gimp and Ksnip may be in this list, so better don't uninstall this!

Here are the commands to stop and disable a service (example for docker):

sudo systemctl stop docker
sudo systemctl disable docker

Other disable-candidates would be cups (a print-service, in case you don't use printers) and brltty ("Braille teletyper", console support for blind people), but I couldn't find their startup time in output of systemd-analyze blame, so it may not matter.

If I ever will need postgres again, I can launch these commands:

sudo systemctl enable postgresql
sudo systemctl start postgresql

Query the status of a specific service (example for snapd):

service snapd status




ɔ⃝ Fritz Ritzberger, 2021-01-04