Creating a readonly system [solved] Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply

Creating a readonly system [solved]

Post by bibomator »

Dear all,

this is my first post - I could not find anybody mentioning a similar problem here - maybe the community can help (and I guess this topic is also interesting for others).

My name is Birk, I'm utilizing quiet some raspberry for different purposes (Video recorder, pihole, home automation, octoprint) and I really like the lightweight dietPi distribution.

My goal it to create a dietpi read only system. Application would be something like a small webradio using mpd, maybe an octoprint, printserver etc.
Major goal: I just want to "switch it off" (This also increases highly the WAF (woman acceptance factor)) :P without shutting the system down.

I got more or less everything working using my script which I published here: ... (relevant lines: 46-73)

only thing missing is the resolv.conf
I tried several solutions:
1) Simply move it to /tmp and create a symbolic link to it
2) Create a dhclient-enter-hooks (seems to create the destination file to late)
3) Modify the /sbin/dhclient-script

The symbolic link solution is recommended in a lot of Linux posts but unfortunately doesn't do the trick.

I using some Raspberry first generation and 3rd generation systems.

Hope somebody can give a hint.
Last edited by bibomator on Wed Nov 29, 2017 7:34 pm, edited 1 time in total.

Re: Creating a readonly system

Post by bibomator »

I just tried another thing:

I put the following scrip here /etc/network/if-pre-up.d/c_resolve

Code: Select all


/usr/bin/touch /tmp/resolv.conf
chmod 777 /tmp/resolv.conf
echo "#hello world - preup" >>/tmp/resolv.conf
It creates the resolv.conf (I also see three times the hello world) but unfortunately the real nameserver information are not written to it...

Re: Creating a readonly system [solved]

Post by bibomator »

It turned out I overlooked that in the original (not tinkert system) the file /etc/resolv.conf is itself a symbolic link to /etc/resolvconf/run/resolv.conf
Due to the fact that /etc/resolvconf/run is a symbolic link to /run and my script mounts /run on a tmp filesystem..... nothing to do.

If anybody is interested: I posted the now working script here: ... e/readonly
Posts: 8
Joined: Fri Mar 16, 2018 3:03 pm

Re: Creating a readonly system [solved]

Post by BennyBubble »

Does this script works with the latest version of dietpi?

Post Reply