Creating a readonly system [solved] Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
bibomator
Posts: 3
Joined: Tue Nov 28, 2017 7:34 pm

Creating a readonly system [solved]

Post by bibomator » Tue Nov 28, 2017 8:07 pm

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:
https://github.com/bdynamic/raspberry_t ... ly_prep.sh (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 6:34 pm, edited 1 time in total.

bibomator
Posts: 3
Joined: Tue Nov 28, 2017 7:34 pm

Re: Creating a readonly system

Post by bibomator » Tue Nov 28, 2017 9:00 pm

I just tried another thing:

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

Code: Select all

#!/bin/bash

/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...

bibomator
Posts: 3
Joined: Tue Nov 28, 2017 7:34 pm

Re: Creating a readonly system [solved]

Post by bibomator » Wed Nov 29, 2017 6:37 pm

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: https://github.com/bdynamic/raspberry_t ... e/readonly

BennyBubble
Posts: 8
Joined: Fri Mar 16, 2018 2:03 pm

Re: Creating a readonly system [solved]

Post by BennyBubble » Thu Aug 22, 2019 3:22 pm

Does this script works with the latest version of dietpi?

-ben

Post Reply