-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,33 @@ | ||
# dirtyboot | ||
Detect and log Linux reboot without clean shutdown | ||
|
||
Detect and log Linux boot not preceded by a clean shutdown. | ||
|
||
## Mechanism | ||
|
||
A systemd service, started early in the boot process, writes a marker file | ||
(`/var/lib/dirtyboot` by default). When the service is stopped, during system | ||
shutdown, the marker file is removed. | ||
|
||
Thus, if the marker file is already present the next time the service starts, | ||
it means the system wasn't shut down cleanly before rebooting. Whenever this | ||
condition occurs, the service writes a corresponding warning to the system log. | ||
|
||
## Inspecting dirty reboot warnings | ||
|
||
Run the command | ||
|
||
journalctl -t dirtyboot | ||
|
||
## Installation | ||
|
||
Put the systemd unit file in `/etc/systemd/system`, and the shell script to | ||
`/usr/sbin/dirtyboot`. Then enable the service using | ||
|
||
systemctl enable dirtyboot | ||
|
||
## Motivation | ||
|
||
I had an unstable system which tended to hang after long periods of idling. | ||
This simple tool was used to keep track of the number of hard resets I had to | ||
do to restore operation of a hung system. Since system log entries are | ||
timestamped, it also records the time interval between such hard resets. |