Discussion:
Cannot recover / migrate a Linux system due to systemd?
(too old to reply)
Justin Piszcz
2017-08-28 18:05:26 UTC
Permalink
Raw Message
Hello,

Question - Is it no longer possible (on distributions with systemd) to use
a rescue USB/CD to boot into a Linux environment that uses systemd?

Background- I've been using Linux for the past 20 years and I have always
been able to use Knoppix or System Recue CD to rescue/migrate/repair a
Linux system with:
boot: linux root=/dev/sda1

Thus, using the kernel+initrd built-in on the USB stick or CD and booting
into my system. Recently, I had to migrate my root filesystem from one
array to another and found I could no longer do this due to systemd.

I tried:
boot: linux root=/dev/sda1 init=/bin/bash # this gets me into the system as
it normally would

However, I cannot boot into the system normally like I could before with:
boot: linux root=/dev/sda1

The error with the System Rescue CD is it cannot find /sbin/init (as this
is a symlink to systemd)

I then tried:
boot: linux root=/dev/sda1 init=/lib/systemd/systemd

Then I get the following error:

[!!!!!!] Failed to mount API filesystems, freezing.
Freezing execution.

Workaround:
What I ended up having to do after several hours was give up trying to
rescue the machine with System Rescue CD, backup the root filesystem then
perform a fresh install of the distribution I am using (Debian) and then
boot to System Rescue CD, move the contents of my root filesystem back to
where they were before and leave boot, lib/modules in place and then reboot
and fix up any loose ends.

Is this the new method to re-install a skeleton OS and then move the
contents of root back or is there a better way-- is it possible to use
systemd and boot into a system like I did before? Was I missing a
particular flag or option?

Thanks,

Justin.
Mantas Mikulėnas
2017-08-28 19:21:10 UTC
Permalink
Raw Message
Post by Justin Piszcz
Hello,
Question - Is it no longer possible (on distributions with systemd) to use
a rescue USB/CD to boot into a Linux environment that uses systemd?
Background- I've been using Linux for the past 20 years and I have always
been able to use Knoppix or System Recue CD to rescue/migrate/repair a
boot: linux root=/dev/sda1
Thus, using the kernel+initrd built-in on the USB stick or CD and booting
into my system.
Kernel+initrd on the USB stick, but all remaining modules on the rootfs –
which could potentially have modules only for a *very different kernel
version* than the one on the USB stick. I am surprised this works at all
with highly-modular distro kernels.

(Well, I guess the initrd contains just enough modules for disk access and
stuff, and a rescue environment rarely needs much else...)
Post by Justin Piszcz
Recently, I had to migrate my root filesystem from one array to another
and found I could no longer do this due to systemd.
boot: linux root=/dev/sda1 init=/bin/bash # this gets me into the system
as it normally would
boot: linux root=/dev/sda1
The error with the System Rescue CD is it cannot find /sbin/init (as this
is a symlink to systemd)
boot: linux root=/dev/sda1 init=/lib/systemd/systemd
[!!!!!!] Failed to mount API filesystems, freezing.
Freezing execution.
I suspect this is also due to the kernel mismatch. Whether due to missing
modules, or due to the Knoppix kernel missing e.g. cgroup support, or due
to it being just *too old* for the installed systemd version...

(Or, if systemd was compiled with SMACK support, then failing to mount
/sys/fs/smackfs is considered to be critical, which I think is what the
sysadmin would expect.)

See src/core/mount-setup.c
<https://github.com/systemd/systemd/blob/master/src/core/mount-setup.c#L73-L118>
for which API filesystems are considered "critical".
--
Mantas Mikulėnas <***@gmail.com>
Lennart Poettering
2017-08-29 13:52:08 UTC
Permalink
Raw Message
Post by Justin Piszcz
Hello,
Question - Is it no longer possible (on distributions with systemd) to use
a rescue USB/CD to boot into a Linux environment that uses systemd?
That should just work.
Post by Justin Piszcz
Thus, using the kernel+initrd built-in on the USB stick or CD and booting
into my system. Recently, I had to migrate my root filesystem from one
array to another and found I could no longer do this due to systemd.
boot: linux root=/dev/sda1 init=/bin/bash # this gets me into the system as
it normally would
boot: linux root=/dev/sda1
The error with the System Rescue CD is it cannot find /sbin/init (as this
is a symlink to systemd)
If it's a symlink it should just work, and find the right binary to start.
Post by Justin Piszcz
boot: linux root=/dev/sda1 init=/lib/systemd/systemd
[!!!!!!] Failed to mount API filesystems, freezing.
Freezing execution.
Maybe the kernel you are using is simply too old or doesn't come with
the bits enabled that systemd needs for operating? Note that systemd
requires a few things from the kernel (cgroups for example) that
live distros that aren't using systemd themselves aren't enabling in
their kernel builds (or are enabling, but as a kmod, where we require
it to be built-in).

Our various test suites actually including booting VMs without
initrds, and hence the general concept should work fine -- as long as
the kernel has everything neeeded.
Post by Justin Piszcz
Is this the new method to re-install a skeleton OS and then move the
contents of root back or is there a better way-- is it possible to use
systemd and boot into a system like I did before? Was I missing a
particular flag or option?
Yes, this should just work, and continues to be supported. But of
course if there's a mismtach between the kernel you boot and the
requirements systemd makes things will fall apart.

Lennart
--
Lennart Poettering, Red Hat
Loading...