Your boot process may take too long to complete if a lot of services and applications load automatically whenever you turn on your computer. Thankfully, Ubuntu allows us to easily manage the startup applications and disable anything we deem unnecessary from automatically loading. Let's see how.
The Two Startups
The boot process of most Linux distributions is split into two separate parts.
The first part starts when the Linux kernel loads and lasts up until we reach the login screen. A startup service - usually systemd - loads all services necessary for basic functionality. Those might include a Bluetooth stack, the audio subsystem, etc.
The second part starts when you log in and consists of desktop applications, usually like Slack or Skype.
It's easy to control both, but, as we'll see, we'll have to use different tools for each job.
Most modern Linux distributions, including Ubuntu, rely on systemd to automatically start any needed services. Systemd comes with useful tools that can help us check this initial startup process. We can use them to see the impact of everything that loads automatically and disable anything we consider useless.
To check how much times systemd took to load everything, type
systemd-analyze in the terminal and press Enter.
Systemd-analyze will check systemd's logs and show you how much time it took for your computer's startup sequence to finish. That's good to know but not helpful. If your startup sequence is slow, there must be something that takes too long to load, something to blame. That's precisely what systemd-analyze allows you to do: find who's to blame. Try it out with:
This will show a list of everything systemd loaded, starting from the most impactful entry and progressively moving toward the lightest one.
Tips: If you have a long list of entries, you can export the list to a text file with the command:
systemd-analyze blame >> NAME_OF_FILE.txt
It is easier to analyze the text file than the entries in the terminal.
Why have a printer service running if you don't even have a printer? If you find some services useless, you can easily disable them. Just use:
sudo systemctl disable NAME_OF_SERVICE --now
You should be sure they are useless, though, and that you will never need them. That's why it's worth checking what relies on them with:
sudo systemctl list-dependencies NAME_OF_SERVICE --reverse
Managing Your Startup Applications
The second part of the startup process relies on the desktop environment itself. Depending on your distribution and desktop environment, you can use different tools to control it. On Ubuntu, you can find that tool by visiting your app menu and typing
startup. Select the Startup Applications entry that will show up.
The Startup Applications Preferences window will appear, showing you all applications that load automatically after you log in.
To disable an app's automatic loading but keep its entry in case you want to re-enable it in the future, untick the checkbox on its left.
To fully remove an entry, click on it to select it and then click on Remove on the right.
If some entries aren't crucial for using your desktop, you can delay loading them so that the rest of the applications load faster. To do that, you must edit their entries and add an extra command before the one that launches them, manually introducing a delay. You can do this as follows:
sleep 60; command will add a 60-second delay to the startup application.
Adding an application to the startup list
This is also the spot from which you can add your own applications to the startup sequence. You can do this by clicking the Add button on the right.
Enter any name you wish for the startup item in the "Name" field and type your command in the aptly named "Command" field. Alternatively, you can click on the "Browse … " button on the field's right and select an executable file from the pop-up file dialog.
Finally, if you wish, enter a comment and click "Add" to add the command to the startup list.
Our latest tutorials delivered straight to your inbox