Ticket #116 (closed defect: fixed)

Opened 2 years ago

Last modified 23 months ago

openvz needs empty /reboot file when rebooted

Reported by: arjan@anymore.nl Owned by: roy
Priority: minor Milestone:
Component: rc Version: 0.2
Keywords: openvz reboot Cc:

Description

If init can detect whether it is running inside an OpenVZ container, could you make sure it creates an empty /reboot file when the reboot command is issued? OpenVZ, Virtuozzo and other virtualization techniques require this so they know the container must be rebooted.

Attachments

strace-rc-sys.txt Download (10.1 KB) - added by arjan@anymore.nl 2 years ago.
strace of 'rc --sys'

Change History

comment:1 Changed 2 years ago by roy

/etc/init.d/halt.sh, lines 28 through 38 should already do this ....

Changed 2 years ago by arjan@anymore.nl

strace of 'rc --sys'

comment:2 Changed 2 years ago by arjan@anymore.nl

Those lines of code check for the contents of the RC_SYS environment variable, which should be coming from one of these scripts: /etc/init.d/functions.sh, "${RC_LIBDIR}"/sh/rc-functions.sh, or /etc/rc.conf.

/etc/init.d/functions.sh doesn't contain RC_SYS or RC_LIBDIR (so the second file can't even be loaded), and /etc/rc.conf doesn't contain RC_SYS. So halt.sh has no means of checking what the system type is. The environment variable doesn't exist either.

If I execute 'rc --sys' as used in /lib/rc/sh/init.sh, I get nothing at all. I guess this should have been 'OPENVZ' in my case. This is OpenRC version 0.2.5, as installed by Gentoo ~x86, btw.

I have attached an strace of 'rc --sys', because there may be a problem detecting OpenVZ.

comment:3 Changed 2 years ago by roy

  • Status changed from new to accepted

RC_SYS is set put into the environment by rc, and rc halls halt.sh with that environment. The init.sh hack is there because rc cannot work out RC_SYS until /proc is mounted.

So this means rc is NOT working out you're in OpenVZ.
Here's the logic in the git tree

/proc/vz/veinfo EXIST
/proc/vz/version NOT EXIST
If above true then set OpenVZ

Does this patch fix your issue?

 http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commitdiff;h=9312aec3adc3fcc92a8c194dc950d421b3caa338

comment:4 Changed 23 months ago by arjan@anymore.nl

Yes, this patch fixes the missing /reboot file issue. Will this also get in a future release? Thank you.

comment:5 Changed 23 months ago by roy

  • Status changed from accepted to closed
  • Resolution set to fixed

This patch will be in openrc-0.3.0 which should be out this week.

Note: See TracTickets for help on using tickets.