1

I would like to make a special boot option in grub2. When this boot option is selected as a boot target, it will mount as read only (instead of the normal read/write mode), and run a script that doesn't normally run when the system is booted with the normal grub boot option. Any idea on how can I do this?

I would prefer a solution that works with Ubuntu 18.04 server edition, but that's not a requirement, if there is a solution for any distribution whatsoever, I would like to read about it.

1 Answer 1

0

I think you should be more precise in what you want to achieve but here some hints you may look at to progress in year research

1/ To have a read-only OS you have to rethink how your distribution is built because you can't just put an option read-only and it will work, especially because your OS still needs to write to be able to work typically in the logs but also to access your hardware I'm not a specialist but usually the read-only OS are doing the writing in the RAM you can have look at the design of the live CDs of most common Linux distribution and also at squashfs which is a flier system dedicated for that, you will see that it's different from a persistent OS model. 2/ to launch a script at the startup ( if understand properly) you can have a look at the run-level and specify one which you will configure to run the script, also you can have look at system-d depending of when you want to launch your script.

Hope that helps

2
  • To have a read-only OS you have to rethink how your distribution is built - actually Ubuntu 18.04 already has a readonly mode called "Recovery Mode", see i.imgur.com/9DJV9Qu.png , so Ubuntu is capable of a readonly mode =/ Commented Sep 14, 2018 at 8:12
  • Yes but in this mode the root partition only is mounted as read only, that why you need to precise what exactly is your goal here. Commented Sep 17, 2018 at 14:53

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.