Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4416

Raspberry Pi OS • OS unmounts /boot WAYYYY too fast.

$
0
0
If I have a running unit, doing it's embedded system thing, and I type 'sudo shutdown -r now" on a console...

The embedded s/w goes mad spewing messages about 'can't this' and 'missing that' . I eventually worked out that what it is unhappy about is the sudden disappearance of the /dev/mmcblk0p1 partition mounted on /boot.
I use files in there to remember
time-of-last-boot, number of boots
hardware version
factory settings
essentially stuff about the unit that is that is almost-read-only and bloody-important. I don't currently set the partition ro during operation, but it is intended that I can and maybe one day I would.
Those files are read ad-hoc by periodic scripts, and the scripts expect the files to live longer than the script does.

The mount just vanishes the moment I hit enter on the shutdown command. I have my own code to umount it, but in a very low-level service, and not until after everything that might want to read files out of /boot have been closed.

After some googling I see that systemd now takes over mounting ( and more distressingly umounting ) stuff.
My guess is that because it has not been told that /boot is required while any of my active application is running, it thinks it's optional and just shuts it down as soon as it fetches it's hat.

Now I know where to look I see this systemd file /run/systemd/generator/boot.mount

-------------------------------------------------------------------
# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
Requires=systemd-fsck@dev-mmcblk0p1.service
After=systemd-fsck@dev-mmcblk0p1.service

[Mount]
What=/dev/mmcblk0p1
Where=/boot
Type=vfat[
Options=defaults,nofail
-------------------------------------------------------------------


I see that you can add wantedby lines to mount files, so I could do 'wantedby=bloody low level thing' if that would tell it to keep its hands off.

In the end I want /boot mounted really early ( as I thought it was without systemd getting involved ), and then I don't want it unmounted automatically.
-----------

So can I just delete the systemd mount file, without bricking the board? Or do I have to dance nicely with it and add stuff to it telling it not to umount anything.

All help appreciated

David.

Statistics: Posted by myshkin-uk — Mon Feb 12, 2024 5:21 pm — Replies 2 — Views 93



Viewing all articles
Browse latest Browse all 4416

Trending Articles