Liam Kelly
Liam Kelly

Reputation: 3714

How to automating root filesystem cleaning without intramfs?

I have an embedded device that on extremely rare occasions will have a dirty root filesystem. System-D will halt boot with:

Give root password for maintainence
(or type control-D to continue):

These situations are very rare and can be solved by doing the following after entering the root password:

# mount -o remount,ro /
# fsck /dev/mmcblk1p3 

Is there anyway to automate this or even try to perform the cleaning when the filesystem is in use?

Upvotes: 1

Views: 58

Answers (1)

skowalak
skowalak

Reputation: 456

You can overwrite systemd emergency mode by editing the appropriate Unit file (or just systemctl edit emergency.service).

You can then add something like this:

[Service]
ExecStartPre=/bin/sh -c "mount -o remount,ro / && fsck /dev/mmcblk1p3 && /bin/systemctl reboot"

Upvotes: 1

Related Questions