Skip to content

xenconsoled logging not working

The logging is not working because :

  • in "/etc/default/xen", there is only one variable "XENCONSOLED_TRACE"
  • in "/etc/init.d/xen", in func "xenconsoled_start_real()", the start command only uses "XENCONSOLED_ARGS", which is empty as not defined

To test logging, I quickly created "XENCONSOLED_ARGS" in "/etc/default/xen" with "-i --log=all --replace-escape --timestamp=all" (but last two are user dependent).
Note that if "--log-dir=DIR" is not provided, the default "/var/log/xen/console" is used, BUT logging won't work until the directory exists (I tested it) !

I think the correct way to implement the fix is to mimick the systemd unit vars (see "https://salsa.debian.org/xen-team/debian-xen/-/blob/master/tools/hotplug/Linux/systemd/xenconsoled.service.in" or "https://xenbits.xen.org/gitweb/?p=xen.git;a=blob_plain;f=tools/hotplug/Linux/systemd/xenconsoled.service.in;hb=HEAD" although identical at time of writing), so alter "/etc/default/xen" like that :

#XENCONSOLED_TRACE=[none|guest|hv|all] # this line already exists, just append following lines
#XENCONSOLED_LOG_DIR=/var/log/xen/console # this directory MUST exist !
# note i added USER before ARGS, so the init script does not need changes -> hmm may not be true
#XENCONSOLED_USER_ARGS=[-t, --timestamp=none|guest|hv|all] [-o, --overflow-data=discard|keep] [--replace-escape]
# finally, concatenate everything for the variable used in "/etc/init.d/xen"
#XENCONSOLED_ARGS=-i --log=$XENCONSOLED_TRACE --log-dir=$XENCONSOLED_LOG_DIR $XENCONSOLED_USER_ARGS

In "/etc/default/xen", I dunno if I can use vars which are defined in itself. If not possible, just add a few vars to the init script.
Also, need to find a way to create the log directory, I guess it's only possible in the init script ? Or simpler, just warn the user in "/etc/default/xen" that (s)he has to create it manually. I didn't have any error report when logging was "activated" but the dir wasn't created.

PS: I have no idea what the "-i" does (I copied it from the shistemd unit file), nor the "-o|--overflow-data" (logging happens in a file, so wtf ? Maybe is it to mimick the real "xl dmesg" size, which is hardcoded at 16k ?).

Note this is only a draft, so RFC ;)

Edited by Cyril REBERT