I have got my own initramfs running its own init script. After doing some things, it finally calls switch_root and executes the init script of the system, which is mounted in /mnt.
Now I want to get back to the initramfs' init script when Linux shuts down (so the init script from linux quits)
But because im calling exec switch_root /mnt /blah/init
, the script terminates when Linux shuts down. But I want to do some things after that in my initramfs, which is not possible that way.
What I can do is chroot /mnt
instead of switch_root ...
, so when Linux shuts down, im back inside the init script. But this has the nasty side effect that some applications such as netctl will refuse to work, because they are called from inside a chrooted system.
So what I need is a way to switch_root
into the system and finally get back to the initramfs.