2

I don't know if there is something wrong with my computer, but every time after a power outage, my file system gets corrupted. I have tried using fsck to fix this, but as soon as I start opening programs, the File System goes into read only mode again. I have found no way to fix this, and my only option is to erase my OS partition and reinstall Ubuntu all over again. Has anyone had this problem and been able to fix it? I think I can avoid this problem if I find a way for my system to automatically shut down when it's low on battery. Thoughts?

Things I have tried:

  • fsck partion: works, but only temporarily
  • mount -o remount,rw /: doesn't work. The system is write-protected
  • reinstall Ubuntu: WORKS! but I don't want to have to do it every time I have a power outage.
Thomas
  • 6,143
  • 12
  • 30
  • 36
Keren
  • 23
  • 3
  • 2
    1. My Ubuntu installed in laptops shut down automatically, when battery is getting low. This should work for you too. But if you are busy working with the computer, you must let it shut down (as soon as possible, when there is a warning). Maybe, if the battery is too worn out, this will not work. 2. Create good backups. For example, if you clone your system with [Clonezilla](https://clonezilla.org), you can easily (and rather quickly) restore it from the Clonezilla image (a directory with a number of files, where the big files are compressed). – sudodus Jan 26 '19 at 14:08
  • Yeah, I dual booted my computer, so my Ubuntu doesn't inherently do that. I'll look for ways to get that behavior. Thanks! – Keren Jan 26 '19 at 14:27
  • Which version of Ubuntu are you running? (for example Ubuntu 18.04.1 LTS) What computer is it (brand name and model)? – sudodus Jan 26 '19 at 14:30
  • I'm running Ubuntu 18.04 and I have an Alienware 13 R2. – Keren Jan 26 '19 at 15:57
  • I'm using ext7, which I'm guessing it's like ext4? When it's booting, it does try to replay the data journalling, but it fails since the file system is read only at that point. – Keren Jan 26 '19 at 16:06
  • I have not heard about `ext7` before. I'm using `ext4`. I don't know, but maybe `ext7` is still experimental, and lacks some functionality. You can try this time to use `ext4` (which is standard in Ubuntu) in order to see, if you have better luck next time, when there is a power outage. Maybe you are willing to force a power outage (by pulling the plug)? – sudodus Jan 26 '19 at 16:31
  • 1. Does your computer shut down gracefully, when you initiate shutdown manually? 2. Have you installed some special program packages or done any tweaks (except `ext7`) that might have an impact on automatic shutdown when the battery is getting low? – sudodus Jan 26 '19 at 16:36
  • I'm not sure at what point I chose to use ext7. I know that's the one because that's the partition I have to fix when the power outage happens. I guess it does shut down gracefully, since it works fine if I initiate the shutdown. I haven't installed any special programs. The issue mainly happens when I forget to charge my computer, put it to sleep, and it's low on battery so it dies on its own. Then when I try to bring it back up, it will be off and corrupted. – Keren Jan 26 '19 at 16:50
  • Your latest comment indicates, that you have an `ext4` file system, but that it is located in parttion with the number 7, probably `/dev/sda7`. You can check with the command line `sudo lsblk -f` either the live system (booted from USB or DVD) or from the installed system. – sudodus Jan 26 '19 at 16:55
  • Oh yeah, it's partition 7 with file system ext4. – Keren Jan 26 '19 at 16:58

1 Answers1

1

Test

I have a Toshiba laptop from 2013, that I use for testing purposes.

I made a fresh installation of Ubuntu 18.04.1 LTS, made it up to date with

sudo apt update
sudo apt full-upgrade

and rebooted to have the current kernel version and everything up to date. Then I unplugged the power and let it run (most of the time playing music videos) until it started to warn about low battery. I watched it closely and at about 5% remaining power it shut down automatically and gracefully.

I plugged in the power connection again, let it charge for slightly more than one minute (so that there should be enough power for the booting process). You may need 5 minutes or more if the battery is getting tired.

Then I booted and it was successful, except that I had to turn off airplane mode for wifi. I tested a few things and they seem to work correctly.

I shutdown and booted from a live drive and checked the file system,

sudo e2fsck -f /dev/sda1

Everything looks good, there was no complaint.

Conclusion

Ubuntu 18.04.1 LTS fully up to date (today, 2019-01-26) can shutdown gracefully, when the battery is getting low in my Toshiba.

I don't think dual booting should make any difference, because the same system will be installed, although the partition number of the root partition will be different.

If Ubuntu shuts down gracefully, when you initiate it manually, the automatic shutdown should work too, unless you have modified some setting, or if the battery supervisor does not work with the computer's hardware.

I suggest that you check that the battery supervisor works with your computer's hardware.

sudodus
  • 45,126
  • 5
  • 87
  • 151
  • I'll accept your answer. I found out you can also manually set when to shut down, etc. through gnome configuration, and while this does gracefully shut down Ubuntu, my file system still randomly goes into Read Only. I have a feeling it might be something else. – Keren Jan 29 '19 at 21:15
  • @Keren, Taking that feeling into account, what could we look at? Maybe there is a problem with the hardware: You can check the [S.M.A.R.T. information](https://askubuntu.com/questions/972978/fsck-reports-that-filesystem-still-has-errors-what-should-i-do-now/972983#972983) of your drive, and you can [check the RAM with memtest](https://askubuntu.com/questions/917961/can-i-boot-memtest86-if-im-using-uefi/917998#917998). – sudodus Jan 30 '19 at 05:42