Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 216944
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo's Team for Core System packages <base-system@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Anthony Sowden <asowden@12ngstreet.com>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 216944 depends on: Show dependency tree
Bug 216944 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   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.

------- Comment #1 From SpanKY 2008-04-08 20:32:48 0000 -------
it belongs in reboot.sh, not halt.sh

------- Comment #2 From Doug Goldstein 2008-04-08 20:37:15 0000 -------
Does Vserver need this or only OpenVZ?

------- Comment #3 From Benedikt Böhm 2008-04-08 21:20:12 0000 -------
(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

------- Comment #4 From Doug Goldstein 2008-04-15 05:55:32 0000 -------
fixed in openrc-0.2.1-r2

------- Comment #5 From Anthony Sowden 2008-04-15 16:41:58 0000 -------
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.

------- Comment #6 From Doug Goldstein 2008-04-15 16:49:13 0000 -------
gah. I closed the wrong bug. sorry.

------- Comment #7 From Roy Marples 2008-04-15 21:51:05 0000 -------
(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.

------- Comment #8 From Anthony Sowden 2008-05-16 13:32:55 0000 -------
I can confirm that openrc now fixes this problem (0.2.4 tested).

Many thanks.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug