How can I make Linux reboot instead of remounting the filesystem as read-only?
Linux systems sometimes remount the root file system as read-only, e.g. if there's an I/O error.
I have a machine that becomes useless when this happens, and I end up rebooting it manually.
Is there a way to make Linux just automatically reboot when this happens? A read-only mount is useless to me.
I deduce you are using ext3 or ext4 as the file system. If so, you can mount it with the errors=panic
option and configure watchdog
to reboot your system in case a panic happen.
While more complex than roelvanmeer's answer (which I upvoted), it has the added bonus of working for all panic-level kernel crash.
As suggested by NikitaKipriyanov, setting the panic=5
kernel boot option can be a simpler alternative to watchdog
(which has more configuration options but it is slightly more complex as result).
Maybe not a very pretty solution, but my first thought would be to run a command from cron every minute:
test -w / || reboot