Solving the On battery power, so skipping file system check Error on Debian Based Systems

If you're running a web server on a Debian-based system, it's crucial to maintain the integrity of your file system. An unexpected error message can be concerning. One such message is "On battery power, so skipping file system check.” This message is primarily associated with laptops which use power management software to extend battery life.

### Understanding the Issue

This message originates from the `fsck` service, which is responsible for checking and repairing Linux file systems during boot-up. Debian and other systems use `fsck` to ensure your file system is healthy to avoid data loss or corruption.

However, when you're booting up your system on battery power, Debian might be configured to skip the file system check to preserve battery life. This is based on the assumption that battery-powered boot-ups are likely to be a result of mobility situations (like travel), during which a user would prefer a faster boot-up time over a full system check.

### Addressing the Error

To solve this error message and ensure a file system check occurs every time the system boots up, regardless of power source, you'll need to edit a system configuration file. The `fsck` service on Debian systems is controlled by a program called `laptop-mode-tools` or is managed through systemd's `systemd-fsck` service. You can fine-tune either of these to change the behavior on battery power.

#### Method 1: Configuring Laptop-Mode-Tools

If you have `laptop-mode-tools` installed, proceed with these steps:

1. Open a terminal window.

2. Type the following command to open the `laptop-mode.conf` using `vi` (a text editor):

sudo vi /etc/laptop-mode/laptop-mode.conf

3. Press `i` to switch to insert mode.

4. Locate the line that reads something similar to `BATT_CHECK_FILESYSTEMS=0`.

5. Change the `0` to `1`. This will ensure that file system checks are not skipped while on battery power.

6. Once done, press `Esc` to exit insert mode.

7. Type `:wq` and press enter to write the changes and quit `vi`.

8. Restart the laptop-mode service with:

sudo systemctl restart laptop-mode.service

#### Method 2: Configuring systemd-fsck

Systems without `laptop-mode-tools` may handle power management directly through systemd.

1. Open a terminal window.

2. To ensure `fsck` is executed even when on battery, we need to create an override file for the `systemd-fsck` service. Use `vi` to edit this file:

sudo systemctl edit systemd-fsck-root.service

3. This will open an empty file. Type the following to override the power management setting:


4. Save the changes by pressing `Esc`, typing `:wq`, and hitting Enter.

5. Reload systemd with:

sudo systemctl daemon-reload

#### Confirming the Changes

To make sure your changes are reflected and to test whether the file system check runs on battery power:

1. Reboot your Debian system while on battery power.

2. Observe the boot-up process. You should see the `fsck` process running without skipping due to the battery power state.

### Final Thoughts

It's important to note that enabling `fsck` while on battery power might increase the boot-up time and consume more battery charge. If you're running a critical web server, consider the implications of having downtimes during the boot-up process.

Remember, system integrity is paramount, but so is understanding the trade-offs between power management and system checks. By addressing the "On battery power, so skipping file system check" error, you can ensure your system's reliability without being dependent on the power source at boot time.

Happy system administration!

Author: admin

Leave a Reply

Your email address will not be published. Required fields are marked *