Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading