How to clean up startup items of Linux system boot ?, Clean linux boot
Generally, Linux distributions for general purposes start various service processes at startup, including many services that you may not need. -- David Both
In this article, navigate to reboot to view boot item 09%. Which services can be disabled? 37% what happened when the guest system was started? 62%
Most Linux distributions start various service processes at startup, many of which you cannot use at all: Bluetooth, Avahi, modulation and demodulation manager, or pppd-dns, you don't even know what these are.
Fortunately, we have Systemd, which brings us a lot of tools to help us check the status of system startup. Of course, we can also control the running options during system startup. I will explain in detail how to disable some useless processes, provided that the release version of The Systemd class is used.
View startup items
Normally, you can use/etc/init.d
View the service items started during system boot. However, systemd uses different display methods. The following commands are used to display the process items at startup.
As you can see, there is a Bluetooth in the header. I don't need to use it. How should I disable it and prevent it from starting after it is turned on?
After completing the preceding operations, use the following command to determine whether the operation is successful.
The deactivation here is not complete, because other service processes can still invoke it. If you want to completely stop the boot from starting, uninstalling is not a good method. Just mask it like below:
I recommend that you uninstall the SDK after it is used for a period of time without causing any negative impact.
Run the following command to obtain the service list:
One thing to note: the starting and disabling statuses of static services cannot be changed, because static services are dependent on other processes, and they are not running on their own.
Which services are prohibited?
How do you know what services you need and which services can be safely disabled? It always depends on your personalized needs.
Here are some examples of service processes. Many service processes are release-specific, so you should check your release documents (such as google or StackOverflow ).
Bytes
Accounts-daemon.serviceIs a potential security risk. It is part of the AccountsService. AccountsService allows the program to obtain or operate user account information. I don't think there is a good reason for me to allow such background operations, so I chose to mask the mask service process. Bytes
Avahi-daemon.serviceIt is used for zero-configuration network discovery, so that computers can easily find printers or other hosts in the network. I always disable it and don't miss it. Bytes
Brltty. serviceSupports Braille devices, such as Braille displays. Bytes
Debug-shell.serviceA huge security vulnerability is opened (this service provides a password-free root shell to help debug the systemd problem). Unless you are using this service, never start the service. Bytes
ModemManager. serviceThis service is a daemon activated by the ingress. It is used to provide mobile broadband (2G/3G/4G) interfaces. If you do not have this interface, whether it is a built-in interface, you do not need to use the service either through a Bluetooth-paired phone or a USB adapter. Bytes
Pppd-dns.serviceIt is a theme of computer development. If you use Dial-Up to access the Internet, keep it; otherwise, you do not need it. Bytes
Rtkit-daemon.serviceIt sounds terrible. It sounds like rootkit. But you need this service because it is a real-time kernel scheduler. Bytes
Whoopsie. serviceIs the Ubuntu Error Reporting Service. It is used to collect Ubuntu system crash reports and send reports to https://daisy.ubuntu.com. You can safely prohibit it from starting or permanently uninstall it. Bytes
Wpa_supplicant.serviceIt is only required when you use Wi-Fi connection.
What happens when the system starts?
Systemd also has other commands to help us debug problems during startup. This command can be used to reproduce all messages at system startup.
Inputjournalctl -b -1
Command to reproduce your last startup information,journalctl -b -2
You can reproduce the last 2nd boot times, and so on.
This command prints all the information, which may cause some interference, because sometimes you do not need to pay attention to all the information, you only need to check the key part. Therefore, we can use the filter function to quickly find the target. Let's try to use process 1 as an example.
From these messages, we can determine whether a process is being started or is about to be started.
One of the most useful command toolssystemd-analyze blame
This command can display the process time consumed and help us find the process with the longest time consumed.
This particular example does not have any exceptions, but if there is a system startup bottleneck, this command will be able to find it.
Via: https://www.linux.com/learn/cleaning-your-linux-startup-process
Author: David Both
Translator: penghuster
Proofread: wxy