You are not logged in.

#1 2014-07-10 19:56:11

leniviy
Member
Registered: 2009-05-23
Posts: 177

how to boot in readonly mode for maintenance?

I tried to temp change kernel options in grub menu. Changed "rw quiet" to "ro 1".
It really disables graphical mode and enables maintenance prompt, but root is mounted rw.

Last edited by leniviy (2014-07-10 20:04:12)


Arch 64, xfce4

Offline

#2 2014-07-10 20:01:23

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: how to boot in readonly mode for maintenance?

I have a 4 G partition on which I have a minimal install for these tasks.  Maybe someone else will answer your question.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2014-07-10 20:56:40

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: how to boot in readonly mode for maintenance?

Forgive my ignorance, but wouldn't maintenance logically require write access to the filesystem? How do you fix something without being able to change it?

Offline

#4 2014-07-10 21:07:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: how to boot in readonly mode for maintenance?

Can you remount it ro?

Offline

#5 2014-07-10 22:35:38

tritron4
Member
Registered: 2012-04-14
Posts: 153

Re: how to boot in readonly mode for maintenance?

adding 1  before rw works for me. You can use mount -o remount ro /

Offline

#6 2014-07-10 22:40:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,575
Website

Re: how to boot in readonly mode for maintenance?

Mount ro and specify init=/usr/bin/bash on the kernel line.

Without an otherwise specified init, init=systemd.  Systemd remounts the / according to your /etc/fstab (if it is mounted ro in the initrams, which is what the kernel line option does).  With init=/bin/bash, nothing will be (re)mounted unless you explicitly specify it.  Note, though that this would include any/all other partitions.

Systemd's "rescue" target may work similarly, but I have no relevant experience with it.

EDIT: But note, this is just trying to answer the question as you stated it.  I too wonder what use this would be - what maintenance can you do if you can't modify the system?

Last edited by Trilby (2014-07-10 22:43:14)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2014-07-11 05:25:12

leniviy
Member
Registered: 2009-05-23
Posts: 177

Re: how to boot in readonly mode for maintenance?

Trilby wrote:

I too wonder what use this would be - what maintenance can you do if you can't modify the system?

Yesterday I needed to run `zerofree`.


Arch 64, xfce4

Offline

#8 2014-07-11 05:27:20

leniviy
Member
Registered: 2009-05-23
Posts: 177

Re: how to boot in readonly mode for maintenance?

karol wrote:

Can you remount it ro?

I tried. It prints "busy". I also tried:
lsof | grep -e "[[:digit:]]\+w"
, but it only prints devices and pipes

5b01ea6a7a42b6488c1a60ad3f654649.png

Last edited by leniviy (2014-07-11 05:38:44)


Arch 64, xfce4

Offline

#9 2014-07-11 05:52:19

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: how to boot in readonly mode for maintenance?

Change the kernel command line to 'ro' and then also add 'systemd.mask=systemd-remount-fs.service'.  This will mount the rootfs read-only in the initramfs, but should also prevent the system from parsing the fstab for the / mountpoint.

I have not tried this, but in my head, it totally works... smile

Offline

Board footer

Powered by FluxBB