SOLVED: Is there a way to enable the systemctl switch-root command after initrd.target in systemd version 255? (Arch Linux)

12510198@lemmy.blahaj.zone to Linux@lemmy.ml – 24 points –

Ive been tryna figure this out all day, Ive read the manual for systemctl and I didnt see anything about switch-root after the initrd target. I did see a --force option, however it didnt do anything. Before the upgrade to version 255, I would use a script or manually mount the partition, and then I would just do like systemctl switch-root /mnt and it would just switch to the other system in an instant as if I booted it normally. But ever since this update it just prints Not in initrd, refusing switch-root operation. and does nothing.

Is there a configuration file I can edit to allow switch-root after the initrd? Or is it like hard-coded and systemd would need patching and recompiling to allow for this? If so is there a way to just trick systemd into thinking its in the initrd and just let me switch-root?

I was dissappointed when I found out I couldnt just switch-root anymore. Any help, ideas, or suggestions will be much appreciated, thank you!

EDIT: To switch root in the new versions of systemd, you will have to mount the filesystem you want to switch root into to /run/nextroot and run systemctl soft-reboot, and it will switch into the root just like before.

2

Maybe this functionality was replaced by the next thing?

Automatic root filesystem soft-reboot: systemctl automatically reboots into a new root filesystem located at /run/nextroot/.

I just gave it a try on my system and it worked just like it did before! Ill have to change my scripts to mount to /run/nextroot instead of /mnt, but i am very relieved that it is still possible. I was having trouble with it all morning. Thank you so much for your reply! It is much appreciated!