Running lxc-ls as non-root should provide a nicer error message
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxc (Ubuntu) |
Fix Released
|
Low
|
Stéphane Graber |
Bug Description
You need root to run lxc-ls now, but this happens:
jorge@jilldactyl:~$ lxc-ls
lxc: Permission denied - opendir on lxcpath
Traceback (most recent call last):
File "/usr/bin/lxc-ls", line 200, in <module>
for container_name in lxc.list_
File "/usr/lib/
config_
ValueError: failure to list containers
I asked Serge:
<hallyn> jcastro: you have to run lxc-ls as root now
jcastro: however, it shouldn't give you a backtrace like that, just a nice error msg
<hallyn> so that's bug-worthy
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: lxc 1.0.0~beta1-
ProcVersionSign
Uname: Linux 3.12.0-7-generic x86_64
ApportVersion: 2.12.7-0ubuntu6
Architecture: amd64
CurrentDesktop: Unity
Date: Wed Jan 8 15:56:45 2014
EcryptfsInUse: Yes
InstallationDate: Installed on 2013-12-11 (28 days ago)
InstallationMedia: Ubuntu 13.10 "Saucy Salamander" - Release amd64 (20131016.1)
SourcePackage: lxc
UpgradeStatus: Upgraded to trusty on 2014-01-07 (1 days ago)
defaults.conf:
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxcsyslog:
Most of the occurrences of that bug will disappear with the next LXC milestone as lxc-ls will default to looking for user-owned containers rather than system ones.
However even with that change, it'll be technically possible to call list_containers on an unreadable directory and get that traceback. Sadly as this comes from liblxc, there isn't many ways to make the error prettier as the actual string is simply output on stderr...
What I could (and will eventually) do is have lxc-ls catch any exception raised by list_container and print a vague error saying "Unable to list containers" which is unfortunately as clear as I can make it...