2

I have a Raspberry Pi running Raspbian GNU/Linux 10 (buster). The Pi is running on a microSD-Card with a read-only boot partition and activated overlay-filesystem (both is currently deactivated for testing).

The fake-hwclock.data (current system time) is written to (and read from) a mounted USB, so that when the machine reboots, it starts on the "current" time (last time before reboot) and not the time from before the overlay filesystem has been enabled.

To make sure that important logs are also saved, these are written to the USB too.

The USB is mounted with the following line (/etc/fstab):

/dev/sda1 /mnt/storage ext4 defaults,user,noatime 0 0

All of this is (or was) working fine. But since i removed the sudoer privileges from the pi user aswell as set a password for the root user, the RasPi starts (about every 2nd time) in emergency mode - even though, the pi user should have the privileges to mount the USB (see "user" in /etc/fstab).

In emergency mode I'm able to print the journal logs, using journalctl -xb:

mnt-storage.mount: Found ordering cycle on local-fs-pre.target/start
mnt-storage.mount: Found dependency on systemd-remount-fs.service/start
mnt-storage.mount: Found dependency on systemd-fsck-root.service/start
mnt-storage.mount: Found dependency on fake-hwclock.service/start
mnt-storage.mount: Found dependency on mnt-storage.mount/start
mnt-storage.mount: Job local-fs-pre.target/start deleted to break ordering cycle starting with mnt-storage.mount/start
[ SKIP ] Ordering cycle found, skipping Local File Systems (Pre)

When reading this, I understand (please correct me if I'm wrong) that local-fs-pre.target has a dependency on fake-hwclock.service which in turn has a dependency on mnt-storage.mount - which then breaks the boot cycle.

  • Does the pi user need sudoer rights to mount the USB on startup?
  • Shouldn't the "user" param in /etc/fstab solve that problem?
  • Could the root user be causing problems because I set its password? (???)
10
  • It is difficult to see what you are trying to do. Nothing writes to the boot partition (except firmware updates) it doesn't even NEED to be mounted! After 10 years with 8 (or more) Pi most running 24/7I have only had 2 SD Cards wear out.
    – Milliways
    Commented Jul 27, 2022 at 10:25
  • This isn't the boot partition, this is the USB stick which is (or should be) mounted on /mnt/storage --> mnt-storage.mount. I am not really familiar with systemd, so please tell me if I'm off the track here.
    – eDonkey
    Commented Jul 27, 2022 at 10:31
  • This still makes no sense. If you don't have a user with root privileges the system would be unusable. If you want to write system/log files to storage it NEEDS to mounted by root before boot.
    – Milliways
    Commented Jul 27, 2022 at 10:56
  • 2
    "I don't have any experience with Pi, i just read some article" -> By analogy, if you had never ridden in a car before and read a bunch of articles about car crashes online, you might decide never to try such a crazy thing. Unless you have a real reason to do this, don't bother. I'm not promising you won't have one later (there are some use cases where it might be justified), but the great majority of pi users, including all of the top users here, have not had to do this as far as I am aware, and we've been using Pis for the better part of a decade.
    – goldilocks
    Commented Jul 27, 2022 at 13:57
  • 1
    Damn, alright. I was really sure, that tI *$!@# up my user permissions. Thanks anyways for the information (and pointing the problem out again)! - I was having tunnel vision. Oh and btw i disabled the overlayfs. ;)
    – eDonkey
    Commented Jul 28, 2022 at 14:42

1 Answer 1

2

Your Question addresses 2 issues- SD Card reliability and pi user permissions and seems to conflate them.

It has long been recognised that having a default username/password is a security risk. Changing password is simple and encouraged, but changing user pi is NOT.

User 0 on Raspberry Pi OS is "special" and built into many of the programs.

The recent Update to Raspberry Pi OS Bullseye removes the default “pi” user and creates a user the first time you boot a newly-flashed Raspberry Pi OS image.

For existing systems update adds a mechanism to change the name of user 0 sudo rename-user. This is also available on updated Buster installations. This may require pi to have sudo privileges.

Rather than changing user 0 or adding a root login it is better to change default username and add additional accounts with restricted privileges.

2
  • Sorry, but 1. where did I ask anything about SD card reliability? I simply made a statement about my setup. 2. It seems I had (or still have) a very flawed understanding of the Linux user permissions. But I don't see, where your answer actually answers my question(s)? It's not that I don't think that information is useful - it is, thank you! - but I think adding an explanation as to why my assumptions about the user permissions were wrong, would've been far more helpful (as well as answering my actual question).
    – eDonkey
    Commented Aug 3, 2022 at 6:59
  • @eDonkey your question was based on trying to avoid writing to SD Card - which goldilicks addressed. I admit this was an assumption on my part, but you did not explain how this is different to the hundreds of similar questions. The answer above is meant as a helpful guide to normal practice for someone who stated "I don't have any experience with Pi, i just read some article"
    – Milliways
    Commented Aug 3, 2022 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.