workspace-new fails with permission errors

Bug #1346873 reported by Stuart Bishop
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Mojo: Continuous Delivery for Juju
Fix Released
High
Unassigned

Bug Description

workspace-new is attempting to read lxc config files, but does not have permission to do so. /var/lib/lxc is only accessible to root:

stub@belch:~/src/canonical-mojo-specs$ mojo workspace-new /home/stub/src/canonical-mojo-specs/is/mojo-is-postgresql test-wip
Traceback (most recent call last):
  File "/usr/bin/mojo", line 9, in <module>
    load_entry_point('mojo==0.1.7', 'console_scripts', 'mojo')()
  File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 435, in main
    run_with_args(args)
  File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 411, in run_with_args
    args.func(args)
  File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 94, in create_workspace
    project = mojo.Project(project_name, series)
  File "/usr/lib/python2.7/dist-packages/mojo/__init__.py", line 259, in __init__
    self.container = container_class(self.name, self.series)
  File "/usr/lib/python2.7/dist-packages/mojo/contain.py", line 44, in __init__
    self.load_config()
  File "/usr/lib/python2.7/dist-packages/mojo/contain.py", line 32, in wrapped
    return method(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mojo/contain.py", line 101, in load_config
    with open(os.path.join(self.LXC_DIR, self.container_name, "config")) as cf:
IOError: [Errno 13] Permission denied: '/var/lib/lxc/mojo-is-postgresql.trusty/config'

Related branches

Tom Haddon (mthaddon)
information type: Proprietary → Public
affects: canonical-mojo → mojo
Tom Haddon (mthaddon)
Changed in mojo:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Haw Loeung (hloeung) wrote :

I think this is related to LP: #1412692 (Need to manually fix permissions after install). LP: #1420379 is of interest as well to use unprivileged containers.

Revision history for this message
Robert Bruce Park (robru) wrote :

This worked for me:

sudo chgrp mojo /var/lib/lxc
sudo chmod 750 /var/lib/lxc

Revision history for this message
Paul Collins (pjdc) wrote :

I've proposed a merge to detect and warn about this situation.

Revision history for this message
Paul Collins (pjdc) wrote :

My detect-and-merge branch has been merged. I'll mark this Fix Committed on the assumption that LXC is essentially in maintenance mode and that LXD is the way forward.

Changed in mojo:
status: Confirmed → Fix Committed
Paul Collins (pjdc)
Changed in mojo:
status: Fix Committed → Fix Released
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.