Bug 216944 - sys-apps/openrc: needs to create /reboot on reboot for openvz systems
|
Bug#:
216944
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: Linux
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: base-system@gentoo.org
|
Reported By: asowden@12ngstreet.com
|
|
Component: baselayout
|
|
|
URL:
|
|
Summary: sys-apps/openrc: needs to create /reboot on reboot for openvz systems
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2008-04-08 19:47 0000
|
Openvz (and maybe other virtualisation systems?) require a /reboot file to be
created immediately prior to reboot, to flag the host node to restart the
virtual server. If this file is not created, the host node has no way to
distinguish a reboot from a shutdown, and the virtual server will be left
stopped.
For normal reboot, the last openrc script to run is /etc/init.d/halt.sh. This
script already has been modified to support virtual systems. A simple
additional change will create the needed file at the right time:
diff -ur a/init.d/halt.sh.in b/init.d/halt.sh.in
--- a/init.d/halt.sh.in 2008-04-02 17:35:28.000000000 +0100
+++ b/init.d/halt.sh.in 2008-04-08 19:32:51.000000000 +0100
@@ -28,6 +28,7 @@
# 1) we don't need (and by default can't) umount anything (VServer) or
# 2) the host utils take care of all umounting stuff (OpenVZ)
if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then
+ [ "$1" = "reboot" -a "${RC_SYS}" = "OPENVZ" ] && >/reboot
if [ -e @SYSCONFDIR@/init.d/"$1".sh ]; then
. @SYSCONFDIR@/init.d/"$1".sh
else
Reproducible: Always
Steps to Reproduce:
1.Install openrc on otherwise stable system
2.Start VPS under OpenVZ
3.Attempt to reboot by '/sbin/reboot' or '/sbin/shutdown -r now'
Actual Results:
VPS shuts down instead of rebooting
Expected Results:
VPS should have been restarted by the host node following a request to reboot
Creating a /reboot file before issuing the reboot request fixes the problem.
The suggested fix will not cater for '/sbin/reboot -f'.
/etc/init.d/reboot.sh could be modified, but this script is part of the init
package (sysvinit on my system) which does not "know" about virtual servers.
Openrc seems the logical package to me.
The suggested fix will not work on some older openvz systems. On these
systems, a bug in openvz means that killall5 (invoked by halt.sh) actually
kills the init process, which prevents the rest of halt.sh from running (the
system does however shutdown). See
http://bugzilla.openvz.org/show_bug.cgi?id=533.
it belongs in reboot.sh, not halt.sh
Does Vserver need this or only OpenVZ?
(In reply to comment #2)
> Does Vserver need this or only OpenVZ?
no, not needed, since sys_reboot is virtualized, and can distinguish between
shutdown and restart
Openrc-0.2.1-r2 includes the fix for openvz bug 215167, but not this one.
Re-opened.
Logically I agree with comment 1 that the fix should be in reboot.sh.
However, RC_SYS is a variable set by the openrc scripts, and using it in
reboot.sh, which is part of sysvinit, creates an implicit cross-package
dependency. The current version of reboot.sh already references an old
variable left over from the earlier version of baselayout (RC_DOWN_INTERFACE).
To keep package boundaries clear, I'd modify halt.sh, part of openrc, which
already contains logic that relies on RC_SYS.
gah. I closed the wrong bug. sorry.
(In reply to comment #5)
> To keep package boundaries clear, I'd modify halt.sh, part of openrc, which
> already contains logic that relies on RC_SYS.
Can't fault that logic. I've fixed halt.sh accordingly and attributed the fix
to you in my git repo. Will be in openrc-0.2.3 or newer.
I can confirm that openrc now fixes this problem (0.2.4 tested).
Many thanks.