I'm using Packer to preconfigure my Raspberry Image with software and a two custom Fstab Files(fstab.rw, fstab.ro) the .rw Version is symlinked to /etc/fstab.
On booting the Image for the first time the symlink is replaced by a copy of the fstab.rw file.
So far i've removed the sed -i commands from the /lib/raspberrypi-sys-mods/firstboot and /lib/raspi-config/init_resize.sh script.
If i replace /etc/fstab with a symlink again after the firstboot process has been completed the Symlink stays after every boot.
I have grepped the lib folder for any more mentions of the fstab file without results.

Suggestions on how to track down whats changing the symlink are greatly appreciated.

  • The normal install modifies /etc/fstab to mount the partitions using PARTUUID. Interfere with this at your peril! If you want to customise this you will need to write a script to append your custom values.
    – Milliways
    Commented Jun 6 at 10:35
  • Yes i have already removed the Part where it replaces the UUID in the fstab since i'm mounting the boots and rootfs using labels. Before i boot the Image the symlink is there but in the firstboot process it gets overriden into a regular file.
    – user163234
    Commented Jun 6 at 11:09
  • If you know when it can be effectively replaced during boot after it has been replaced earlier during boot, why not just do that? This way you do not need to fuss around with hacking the "firstboot process" (if that's what's responsible -- I'm not saying it isn't, but you don't seem to have found definitive proof of that). This way the replacement version would never actually be used (or is it? I know there is an initial reboot triggered by the resize). You could try poking around the initramfs, but I at a glance I don't see anything in there.
    – goldilocks
    Commented Jun 6 at 12:23
  • Im 95% sure that some part of the inital Firstboot process is at fault here, since every boot afterwards doesnt change the fstab file. But yes i will go with my solution to replace it after the Raspberry Firstboot is completed for now.
    – user163234
    Commented Jun 6 at 12:38
  • 1
    You can use the inotify tools to monitor changes to the /etc/fstab file.
    – liaifat85
    Commented Jun 6 at 14:32


Your Answer

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

Browse other questions tagged or ask your own question.