Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: lxd console code breaks when using lxd as snap #3104

Closed
ubuntu-server-builder opened this issue May 11, 2023 · 2 comments
Closed

tests: lxd console code breaks when using lxd as snap #3104

ubuntu-server-builder opened this issue May 11, 2023 · 2 comments
Labels
launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1745663

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2018-02-22T22:33:37.834212+00:00
date_created = 2018-01-26T18:43:39.569995+00:00
date_fix_committed = 2018-02-22T22:33:37.834212+00:00
date_fix_released = 2018-02-22T22:33:37.834212+00:00
id = 1745663
importance = medium
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1745663
milestone = None
owner = powersj
owner_name = Joshua Powers
private = False
status = fix_released
submitter = powersj
submitter_name = Joshua Powers
tags = []
duplicates = []

Launchpad user Joshua Powers(powersj) wrote on 2018-01-26T18:43:39.569995+00:00

Running the integration tests using the lxd backend fails when lxd is installed as a snap:
https://paste.ubuntu.com/26465769/

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"

@ubuntu-server-builder ubuntu-server-builder added the launchpad Migrated from Launchpad label May 11, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2018-01-26T21:18:32.179594+00:00

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
/var/snap/lxd/common/lxd/logs/CONTAINER-NAME/console.log

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.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2018-02-22T22:33:38.737682+00:00

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant