Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

systemd makes it the most easy. all you need is systemctl switch-root ROOT. on other inits, you usually need to replace /sbin/init, then use some non-portable (sysvinit is not the only competitor) method of telling init to re-exec itself. sometimes that method doesn't even stop the running services, so you need to either manually stop them, or kill them.


You can do it non-destructively by bind mounting a binary from ramfs over /bin/init

When it reexecs, the new binary can kill and umount everything and switch roots. If it fails somehow, you just reboot and everything is back to normal.


In what situations would you expect a re-exec to stop the services? The normal case is that the reexec preserves state.


IIRC, some init implementations have this capability. I'm not saying that it's good in general, but just that it facilitates this particular case.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: