tests: lxd console code breaks when using lxd as snap

Bug #1745663 reported by Joshua Powers
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

Running the integration tests using the lxd backend fails when lxd is installed as a snap:

The failure is a result of the tests/cloud_tests/platforms/lxd.py:_setup_console_log() function attempting to modify the configuration:

49 cfg = "lxc.console.logfile=%s" % logf
50 orig = self._pylxd_container.config.get('raw.lxc', "")
51 if orig:
52 orig += "\n"
53 self._pylxd_container.config['raw.lxc'] = orig + cfg

LXD logs: https://paste.ubuntu.com/26465860/
My lxd setup/config: https://paste.ubuntu.com/26465838/

The specific issue I believe is that LXD as a snap is confined and does not have access to /tmp (need to confirm this) hence the error message:

console.c:lxc_console_create:561 - No such file or directory - failed to open console log file "/tmp/LXDInstance-cloud-test-ubuntu-xenial-image-modification-em88d5kzvxzdrzsgod029n8iztb/console.log"

Related branches

Joshua Powers (powersj)
description: updated
Revision history for this message
Scott Moser (smoser) wrote :

I talked with stgraber.
We have a couple options:
a.) if installed from snap, use
   some path down /var/snap/lxd as a console log path
  /var/snap/lxd/common/consoles (chmod 1777) or

b.) use console --show-log
this requires liblxc > 3.0.

We could put into place code that did 'a' when it needed to (util.which('lxc').startswith('/snap')) and used 'b' if it could.

Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Scott Moser (smoser) wrote : Fixed in Cloud-init 18.1

This bug is believed to be fixed in cloud-init in 18.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Confirmed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.