Just like restarting a server when the memory is low, I’ve had a recent problem with kernel panics on my Raspberry Pi, and I’ve found a terrible solution to fix it: Just reboot.
Because I’m lazy, I asked ChatGPT to write me up a startup script to do this for me, and here’s what I have now:
To set the
panic timeout value on Ubuntu Server 20.04 and later versions, you can create a systemd service unit file.
Here are the steps to create a systemd service unit file:
- Open a terminal window on your Ubuntu Server.
- Create a new service unit file with the following command:
sudo nano /etc/systemd/system/panic-timeout.service
This will open a new file named
panic-timeout.servicein the nano text editor with superuser privileges.
- Add the following lines to the file:
This service unit file sets the panic timeout to 60 seconds.
- Save the file by pressing
Ctrl+O, then exit nano by pressing
- Reload the systemd daemon to recognize the new service unit file with the following command:
sudo systemctl daemon-reload
- Enable the service unit file to run at boot time with the following command:
sudo systemctl enable panic-timeout.service
- Reboot the server to test the service unit file. After the server reboots, the
panic-timeout.servicewill automatically run the
echocommand and set the panic timeout to 60 seconds.
That’s it! With these steps, you can set the
panic timeout value on the latest versions of Ubuntu Server.
Well there you have it! Don’t forget to follow along for more terrible ideas!