:: Re: [DNG] installing OpenRC on runn…
Forside
Slet denne besked
Besvar denne besked
Skribent: Manfred Wassmann
Dato:  
Til: dng
Emne: Re: [DNG] installing OpenRC on runnng system
On Sun, Jul 30, 2023 at 2:13 PM tito via Dng <dng@???> wrote:

> On Sun, 30 Jul 2023 11:58:19 +0000
> Manfred Wassmann via Dng <dng@???> wrote:
>
> [...]


> > apt install openrc
> > > [...]
> >
> > 0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
> > > Need to get 246 kB of archives.
> > > After this operation, 2,165 kB of additional disk space will be used.
> > > Do you want to continue? [Y/n]
> >
> >
> > and after that question the interesting part starts. What you generally
> > have to observe when replacing the init package in a running system is
> that
> > after the removal of the old package the binary of the running pid 1
> > process will be gone as well as any helper software that init needs to
> > cleanly shut down the system and you can't simply stop the old pid 1 init
> > process as all other processes of the running system were spawned from
> it.
> > The new init will not be able to perform a clean shutdown either or even
> > any shutdown at all, because it is not running yet.
> Hi,
> It could be done easier and cleaner, as root:
>


Sorry, it looks like you didn't get the point. What I wrote above is a
general discussion of the problems replacing a running init system. The
recipe to perform it is below. Now to your script:

cp /lib/init/rc /lib/init/rc.bak
> cp /lib/init/rcS /lib/init/rcS.bak
>
> apt install openrc
>
> cp /lib/init/rc.bak /lib/init/rc
> cp /lib/init/rcS.bak /lib/init/rcS
> mount -o ro,bind //lib/init/rc /etc/init/rc
> mount -o ro,bind //lib/init/rcS /etc/init/rcS
> /sbin/reboot
>


Firstly, have you tested that? I bet no! It's not only about the rc
scripts.


> System reboots normally,



No it doesn't. The /sbin/reboot won't work, at least with systemd-init
running and deinstalled. You are not even able to terminate the running
systemd-init by sending it a signal which normally would initiate a
shutdown. I tested that.


> then after reboot clean up:
>
> rm /lib/init/rc*
>


Secondly,

# mount -a -o remount-ro
[power-cycle]

does seem a lot simpler to me -- and it works, always.
Plus after having mounted all vital partitions r/o even powercycling
performs a clean shutdown. The only way to improve this method would to go
into single-user mode before de-/installing the packages so there is a
minimal set of running processes only.