Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if linux shuts down for too long?

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "linux shutdown time is too long how to do", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "linux shutdown time is too long how to do" this article.

Check which processes will cause Linux to shut down for a long time

If you want to find out what the problem is, you should check what happened the last time your phone was turned off. Use this command to gain the power of "I know what you did in your last conversation" (the pun of I Know What You Did Last Summer).

Journalctl-rb-1

The journalctl command allows you to read the system log. Use the option-b-1 to filter the log of the last session started. When you use the option-r, the logs are displayed in reverse chronological order.

In other words, the journalctl-rb-1 command displays the Syslog before the last shutdown of the Linux system. This is where you need to analyze the long shutdown of the Linux system.

No journal log? Here's what you should do.

If you don't have a journal log, make sure your distribution uses systemd.

Even on some Linux distributions that use systemd, journal logs are not activated by default.

Please confirm that / var/log/journal exists. If it does not exist, create it:

Sudo mkdir / var/log/journal

You should also check the contents of the / etc/systemd/journald.conf file and make sure that the Storage value is set to automatic (auto) or persistent (persistent).

Did you find anything suspicious in the log? Is there a process / service that refuses to stop? If so, investigate whether it can be deleted without side effects, or if it can be reconfigured. Please don't delete things blindly here. You should know something about this process.

Speed up shutdown in Linux by reducing the default stop timeout (quick fix)

The default wait time for shutdown is usually set to 90 seconds. After this time, your system will try to force the service to stop.

If you want your Linux system to shut down quickly, you can change this wait time.

You can find all the systemd settings in the configuration file located at / etc/systemd/system.conf. There should be a lot of lines starting with # in this file. They represent the default values for each entry in the file.

It is best to make a copy of the original document before starting.

Sudo cp / etc/systemd/system.conf / etc/systemd/system.conf.orig

Look for DefaultTimeoutStopSec here. It may be set to 90 seconds.

# DefaultTimeoutStopSec=90s

You have to change this value to something more convenient, such as 5 seconds or 10 seconds.

DefaultTimeoutStopSec=5s

If you don't know how to edit the configuration file in the terminal, you can use this command to open the file in the system's default text editor (such as Gedit) for editing:

Sudo xdg-open / etc/systemd/system.conf

Change Shutdown Time Settings Ubuntu

Don't forget to delete the # before DefaultTimeoutStopSec. Save the file and restart the system.

This will help you reduce the shutdown delay of your Linux system.

Watchdog problem!

Linux has a module called watchdog that monitors whether certain services are running. It can be configured to automatically restart the system when it hangs due to a software error.

It is not common to use watchdogs on desktop systems because you can shut down or restart the system manually. It is often used on remote servers.

First check to see if the watchdog is running:

Ps-af | grep watch*

If your system is running watchdogs, you can change the ShutdownWatchdogSec value from 10 minutes to a lower value in the systemd configuration file / etc/systemd/system.conf.

The above is all the contents of the article "what to do if the linux shuts down for too long". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report