The agetty --noclear tty1 process does not end, resulting in a high CPU occupancy rate of the Raspberry Pi ubuntu

My Raspberry Pi 4b is installed with ubuntu server 18.04 graphical desktop

After modifying the boot option in raspi-config to boot into the desktop and enter the password automatically

Nothing is done after booting up, and the cpu occupancy rate has reached 30%

You can use task manager to view the CPU occupancy, or use the command htop to view. as follows

At first glance, a process called agetty --noclear tty1 occupies 100% of a certain core of the cpu

I found out that sometimes in the output of the "ps aux" command, the following processes can be seen:

/sbin/agetty --noclear tty1 linux

How did this process come about?

After the system is up, a login box will appear on the screen. This login box is made by this agetty. After logging in, the process automatically exits.

Similarly, when you press Ctrl + Alt + F1/2/3/4/5/6, the login interface that appears on the screen is also integrated by agetty.

But I have logged in, so why doesn't agetty log out yet?

That means tty1 is not logged in. The graphical interface is tty7. If you press Ctrl + Alt + F1 to enter the login interface of tty1, you will find that it is stuck and there is no prompt to enter the account password.

Later, I remembered that I once modified the boot login method in raspi-config to automatic login, as follows

sudo raspi-config

It will let you choose whether to open the desktop or the console when booting, and whether to log in automatically.

Facts have proved that this automatic login is useless. Maybe the system doesn't know your login password, so you can't log in all the time, and tty1 is stuck in the login interface, which leads to high CPU usage.

Therefore, in raspi-config, change the login method back to desktop or console. Don't choose automatic login!

-------------------------------------------------Minute Boundary ------------------------------------------------- -----------

Update:

It does not seem to be a problem with the login options.

1. Temporary solution: After each boot, htop finds the PID number of the item that occupies more CPU, sudo kill xxx 

2. Modify /boot/firmware/nobtcmd.txt, delete the console=tty1 inside, and fundamentally turn off the serial console

 

-------------------------------------------------Minute Boundary ------------------------------------------------- -----------

Update again:

It does not seem to be a problem with nobtcmd.txt.

I remembered that when I set the systemctl boot-up auto-start item in order to turn off the bluetooth, I opened a startup item called [email protected].

It appears that a new startup item called [email protected] is created under /etc/systemd/system/getty.target.wants, which is exactly the same as the default file [email protected] in this folder.

Maybe the two conflicted at boot time. The setting of [email protected] is completely unnecessary and useless.

Check which items are available at boot

sudo systemctl list-unit-files

Or filter to see which ones are booted up.

sudo systemctl list-unit-files | grep enabled

Then disable can disable the startup items, and stop can stop the services that have been started.

sudo systemctl disable [email protected]

At this time, the [email protected] file under /etc/systemd/system/getty.target.wants is also automatically deleted.

Restart, it might be fine

Guess you like

Origin blog.csdn.net/benchuspx/article/details/112402583