this post was submitted on 09 Dec 2023
23 points (96.0% liked)

Linux

45601 readers
664 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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.

top 2 comments
sorted by: hot top controversial new old
[–] [email protected] 12 points 7 months ago (1 children)

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/.
[–] [email protected] 6 points 7 months ago

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!