[Pkg-xen-devel] Bug#597403: xen-utils-common: need to run restorecon in /etc/init.d/xend on SE Linux systems

Russell Coker russell at coker.com.au
Sun Sep 19 12:45:06 UTC 2010


Package: xen-utils-common
Version: 4.0.0-1
Severity: important

After running modules_setup you need to have the following line:
    [ -x /sbin/restorecon ] && /sbin/restorecon -R /dev/xen


The reason is that the module load causes the kernel to create device nodes in
the devtmpfs.  This bypasses the udev code for labelling the device node and
results in xenstored being unable to access /dev/xen/evtchn and therefore
not working.

In Squeeze+1 this will probably be fixed by upstream changes to the kernel and
udev.

But for Squeeze it would be good if this could get included.  It's one line of
shell code that results in nothing being done if policycoreutils is not
installed.  I can't imagine any way that such a change could break anything.


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-xen-686 (SMP w/1 CPU core)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages xen-utils-common depends on:
ii  gawk                      1:3.1.7.dfsg-5 GNU awk, a pattern scanning and 
pr
ii  lsb-base                  3.2-23.1       Linux Standard Base 3.2 init 
scrip
ii  udev                      160-1          /dev/ and hotplug management 
daemo
ii  xenstore-utils            4.0.1~rc6-1    Xenstore utilities for Xen

xen-utils-common recommends no packages.

xen-utils-common suggests no packages.

-- Configuration Files:
/etc/init.d/xend changed:
PATH=/usr/lib/xen-common/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Xen daemons"
VERSION=$(xen-version)
ROOT=/usr/lib/xen-$VERSION
XEND="$ROOT"/bin/xend
XENCONSOLED="$ROOT"/bin/xenconsoled
XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
XENSTORED="$ROOT"/bin/xenstored
XENSTORED_DIR="/var/run/xenstored"
XENSTORED_PIDFILE="/var/run/xenstore.pid"
[ "$VERSION" ] || exit 0
[ -x "$XEND" ] || exit 0
[ -r /etc/default/xend ] && . /etc/default/xend
. /lib/init/vars.sh
. /lib/lsb/init-functions
modules_setup()
{
	modprobe xenfs 2>/dev/null
	modprobe xen-evtchn 2>/dev/null
}
xenfs_setup()
{
	[ -e "/proc/xen/capabilities" ] && return 0
	log_progress_msg "xenfs"
	[ -d "/proc/xen" ] || return 1
	mount -t xenfs xenfs /proc/xen || return 1
	return 0
}
capability_check()
{
	[ -e "/proc/xen/capabilities" ] || return 1
	grep -q "control_d" /proc/xen/capabilities || return 1
	return 0
}
xend_start()
{
	log_progress_msg "xend"
	$XEND status && return 1
	$XEND start || return 2
	i=0
	while [ $i -lt 10 ]; do
		$XEND status && return 0 || true
		i=$(($i + 1))
		sleep 1
	done
	return 2
}
xend_stop()
{
	log_progress_msg "xend"
	$XEND status || return 0
	$XEND stop || return 1
}
xenconsoled_start()
{
	log_progress_msg "xenconsoled"
	start-stop-daemon --start --quiet --pidfile "$XENCONSOLED_PIDFILE" --
exec "$XENCONSOLED" --test > /dev/null \
		|| return 1
	start-stop-daemon --start --quiet --pidfile "$XENCONSOLED_PIDFILE" --
exec "$XENCONSOLED" -- \
		$XENCONSOLED_ARGS --pid-file="$XENCONSOLED_PIDFILE" \
		|| return 2
}
xenstored_start()
{
	log_progress_msg "xenstored"
	start-stop-daemon --start --quiet --pidfile "$XENSTORED_PIDFILE" --
exec "$XENSTORED" --test > /dev/null \
		|| return 1
	[ -d "$XENSTORED_DIR" ] || mkdir -p "$XENSTORED_DIR"
	start-stop-daemon --start --quiet --pidfile "$XENSTORED_PIDFILE" --
exec "$XENSTORED" -- \
		$XENSTORED_ARGS --pid-file="$XENSTORED_PIDFILE" \
		|| return 2
}
case "$1" in
  start)
	log_daemon_msg "Starting $DESC"
	modules_setup
    [ -x /sbin/restorecon ] && /sbin/restorecon -R /dev
	xenfs_setup
	case "$?" in
		0) ;;
		*) log_end_msg 1; exit ;;
	esac
	capability_check
	case "$?" in
		0) ;;
		*) log_end_msg 255; exit ;;
	esac
	xenstored_start
	case "$?" in
		0|1) ;;
		*) log_end_msg 1; exit ;;
	esac
	xenconsoled_start
	case "$?" in
		0|1) ;;
		*) log_end_msg 1; exit ;;
	esac
	xend_start
	case "$?" in
		0|1) ;;
		*) log_end_msg 1; exit ;;
	esac
	log_end_msg 0
	;;
  stop)
	capability_check
	case "$?" in
		0) ;;
		*) exit ;;
	esac
	log_daemon_msg "Stopping $DESC"
	xend_stop
	case "$?" in
		0|1) log_end_msg 0 ;;
		*) log_end_msg 1 ;;
	esac
	;;
  restart|force-reload)
	capability_check
	case "$?" in
		0) ;;
		*) exit ;;
	esac
	log_daemon_msg "Restarting $DESC"
	xend_stop
	case "$?" in
		0|1)
		xend_start
		case "$?" in
			0) log_end_msg 0 ;;
			*) log_end_msg 1 ;;
		esac
		;;
		*) log_end_msg 1 ;;
	esac
	;;
  *)
	echo "Usage: $0 {start|stop|restart|force-reload}" >&2
	exit 3
	;;
esac
exit 0


-- no debconf information





More information about the Pkg-xen-devel mailing list