Is UnionFS the best way to setup a read only dietpi? Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
djcjf
Posts: 11
Joined: Thu Jun 03, 2021 8:04 am

Is UnionFS the best way to setup a read only dietpi?

Post by djcjf »

Hi there another question for you all, Is UnionFS still the best way to setup a read only dietpi?

Or is there a better method for DietPi users specifically?

I was planning to follow this guide which worked decently on the Pi 1 running Raspbian Lite

"https://www.kurokesu.com/main/2015/12/3 ... operation/"

I need to setup my system this way in order to protect it from un safe power loss which is common while traveling with this system, The guide explains how to write a script to easily switch between read/write and read only mode which will allow for one to make changes or to apply updates as the users see fit...

I'll be applying this to a Pi4 8GB running DietPi 64Bit this time around, Should I change anything specifically during setup for this to work well with the DietPi Distro, I'm already aware logs goto ram by default which is good since it makes this procedure much easier...

Any suggestions are greatly appreciated thanks! 🙂
User avatar
Joulinar
Posts: 4783
Joined: Sat Nov 16, 2019 12:49 am

Re: Is UnionFS the best way to setup a read only dietpi?

Post by Joulinar »

Hi,

I don't know how UnionFS is working but I did some test in the past using overlayroot. It was working quit well and was easy to setup.

viewtopic.php?p=24920#p24920
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
djcjf
Posts: 11
Joined: Thu Jun 03, 2021 8:04 am

Re: Is UnionFS the best way to setup a read only dietpi?

Post by djcjf »

Joulinar wrote: Fri Jun 04, 2021 11:40 am Hi,

I don't know how UnionFS is working but I did some test in the past using overlayroot. It was working quit well and was easy to setup.

viewtopic.php?p=24920#p24920
I just tested UnionFS, absolutely broke my system, I tried to back track the installation but I was locked into Read Only mode and couldn't switch via the Script from that article... Let's just say it doesn't work as well as it did on my Pi 1 with Raspbian 😅

Thus I reinstalled DietPi quickly and I'm back to where I left off prior to messing with UnionFS...

I'll be trying your suggestion as that definitely looks like the best option at the moment...

Honestly thanks for guiding me into the right direction I truly appreciate it!
djcjf
Posts: 11
Joined: Thu Jun 03, 2021 8:04 am

Re: Is UnionFS the best way to setup a read only dietpi?

Post by djcjf »

Joulinar wrote: Fri Jun 04, 2021 11:40 am Hi,

I don't know how UnionFS is working but I did some test in the past using overlayroot. It was working quit well and was easy to setup.

viewtopic.php?p=24920#p24920
Hi I'm back after some testing and I'm currently stuck with an unexpected issue, I followed the instructions from that Forum Post you linked to install OverlayFS it seems to be half working on my end I'm probably missing something, After a reboot I'm definitely in read only as any files created are temporary and removed every reboot although the "rootwork" command isn't being found even though I edited the bash file...

I've also noticed that Samba is no longer accessible even though it's reporting zero errors and successfully running same goes with Minidlna simply not showing up on the lan even though it's running...

Any idea what I missed to cause all these issues?
djcjf
Posts: 11
Joined: Thu Jun 03, 2021 8:04 am

Re: Is UnionFS the best way to setup a read only dietpi?

Post by djcjf »

djcjf wrote: Sat Jun 05, 2021 3:10 pm
Joulinar wrote: Fri Jun 04, 2021 11:40 am Hi,

I don't know how UnionFS is working but I did some test in the past using overlayroot. It was working quit well and was easy to setup.

viewtopic.php?p=24920#p24920
Hi I'm back after some testing and I'm currently stuck with an unexpected issue, I followed the instructions from that Forum Post you linked to install OverlayFS it seems to be half working on my end I'm probably missing something, After a reboot I'm definitely in read only as any files created are temporary and removed every reboot although the "rootwork" command isn't being found even though I edited the bash file...

I've also noticed that Samba is no longer accessible even though it's reporting zero errors and successfully running same goes with Minidlna simply not showing up on the lan even though it's running...

Any idea what I missed to cause all these issues?
Update: A Friend with a little more in depth Linux knowledge helped me solve the issue with "rootwork" below you'll find step by step instructions for those struggling with the same issue... although I would also like to mention that the other issues I was having related with Samba and MiniDLNA was definitely unrelated and caused by router issue...

Fix for "rootwork" Command

First off change directory to the location where you unzipped overlayroot most likely in dietpi users home folder.

Code: Select all

cd "overlayroot directory"
Now simply execute the rootwork script so we can write some changes to the system..

Code: Select all

./rootwork
Copy the rootwork script to "/usr/local/bin" this is where custom user scripts are stored...

Code: Select all

cp "overlayroot directory" /rootwork /usr/local/bin
Exit out of chroot....

Code: Select all

exit
And finally reboot the SBC...

Code: Select all

reboot
The fix is pretty much self explanatory, simply copy the rootwork script to the local bin directory which is used for custom user scripts... after a reboot the rootwork command works perfectly!
User avatar
Joulinar
Posts: 4783
Joined: Sat Nov 16, 2019 12:49 am

Re: Is UnionFS the best way to setup a read only dietpi?

Post by Joulinar »

yes indeed rootwork would need to be placed in a path already know or the path to rootwork would need to be added to environment variable. 8)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
djcjf
Posts: 11
Joined: Thu Jun 03, 2021 8:04 am

Re: Is UnionFS the best way to setup a read only dietpi?

Post by djcjf »

Joulinar wrote: Sat Jun 05, 2021 11:00 pm yes indeed rootwork would need to be placed in a path already know or the path to rootwork would need to be added to environment variable. 8)
Now that root is protected thanks to the overlay should I consider setting the boot partition as readonly via "dietpi-drive_manager" or would that break more things then help?
User avatar
Joulinar
Posts: 4783
Joined: Sat Nov 16, 2019 12:49 am

Re: Is UnionFS the best way to setup a read only dietpi?

Post by Joulinar »

Hi,

usually there is not that much r/w operation done on the bootFS. I'm not 100% sure if it contains some DietPi files that are written on boot.

If you worry about data corruption on your SD card, you might think of replacing the SD card by a small USB stick.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply