:: Re: [DNG] installing OpenRC on runn…
Top Page
Delete this message
Reply to this message
Author: tito
Date:  
To: dng
Subject: Re: [DNG] installing OpenRC on runnng system
On Sun, 30 Jul 2023 22:00:31 +0000
Manfred Wassmann via Dng <dng@???> wrote:

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

Hi,
this is not true in your case as only sysv-rc is removed,

/.
/etc
/etc/init.d
/etc/rc0.d
/etc/rc1.d
/etc/rc2.d
/etc/rc3.d
/etc/rc4.d
/etc/rc5.d
/etc/rc6.d
/etc/rcS.d
/lib
/lib/init
/lib/init/rc
/lib/init/rcS
/usr
/usr/share
/usr/share/doc
/usr/share/doc/sysv-rc
/usr/share/doc/sysv-rc/README.Debian
/usr/share/doc/sysv-rc/README.runlevels.gz
/usr/share/doc/sysv-rc/changelog.Debian.gz
/usr/share/doc/sysv-rc/changelog.gz
/usr/share/doc/sysv-rc/copyright
/usr/share/doc/sysv-rc/init.d-README
/usr/share/doc/sysv-rc/rc0.d-README
/usr/share/doc/sysv-rc/rc1.d-README
/usr/share/doc/sysv-rc/rc2-5.d-README
/usr/share/doc/sysv-rc/rc6.d-README
/usr/share/doc/sysv-rc/rcS.d-README
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/sysv-rc
/etc/init.d/README
/etc/init.d/rc
/etc/init.d/rcS
/etc/rc0.d/README
/etc/rc1.d/README
/etc/rc2.d/README
/etc/rc3.d/README
/etc/rc4.d/README
/etc/rc5.d/README
/etc/rc6.d/README
/etc/rcS.d/README

and there is no init binary to be seen, so everything you need is still there, only
/etc/init.d/rc
/etc/init.d/rcS
have been changed by the openrc package, tusly if you can
temporarily restore them you will be able to reboot the system
without any problem.

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


There is no new init in you example case.

> > 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:


No. You stated: I would like to install OpenRC on my running Daedalus system
so it is replacing sysvinit with openrc.

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


Of course I have tested it in a vm, otherwise I would have written untested.

>
> > System reboots normally,
>
>
> No it doesn't. The /sbin/reboot won't work, at least with systemd-init


We are talking about Daedalus here, there is no systemd-init to be found.
BTW even replacing systemd with sysvinit could be done in a running system
(same for openrc but untested so far).

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


You complained and asked how to cleanly reboot a system
after having changed sysvinit with openrc and this is the cleanest
way in the sense that the system is shutdown by the same
init system that booted it with no other voodoo involved.
At reboot the bind mounts are gone and the system boots
cleanly with the new init system.
Only minor cleanup is needed afterwards.

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


That will change nothing in this case.

Ciao,
Tito