1

I’ve just run into a curious situation. To set up a new server, I logged into the OS preinstalled by the hosting provider and performed a pivot_root to a tmpfs so I could unmount the drives and reconfigure RAID. Having done that, I did another pivot_root to the newly created FS and ran kill -TERM 1 (which is the same as systemctl daemon-reexec). This is where things went wrong as the new FS didn’t yet have the systemd package installed, and systemd ended up executing /bin/sh for some reason.

Now the system is in a strange state where a /bin/sh is running as PID 1, at least that’s what /proc/1/exe shows. Obviously rebooting fixes this, but in general, can such a situation be rectified without a reboot?

1
  • 3
    Maybe, if you can get the sh to exec something. May 5 '20 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.