How to check the reason for a system reboot in Linux?
In a Linux system, you can view the reason for system reboot by following these steps:
- Use the dmesg command to view system logs:
The dmesg command can display kernel logs from system startup, including the reasons for system restarts. Use the following command to view them: - Search for the keyword “reset” in the system log using the command “dmesg”.
- Check the system reboot history with the last command:
The last command can display the login and reboot history of the system. Use the following command to view: - most recent system restart
- View the log files in the /var/log directory:
The Linux system records the reasons for system reboots in various log files located in the /var/log directory, commonly including /var/log/messages, /var/log/syslog, and others. Use the following command to view the reasons for reboots in the log files: - Search for the keyword “reboot” in the /var/log/messages file.
The methods above are common, but the specifics of how to check the reasons for a system reboot may vary depending on the Linux distribution and system configuration.