Ambiguous error message when juju-store-lock is not removed and has restrictive permissions

Bug #1769070 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Low
Unassigned

Bug Description

Somehow I got into the state where juju client returns "cannot get current controller name: permission denied". The error is actually due to juju store lock having root:root owner set. If I remove the lock file juju client continues on without issues.

The bug is about making the error more user-friendly.

/snap/conjure-up/998/bin/juju --version
2.3.7-artful-amd64

strace -f /snap/conjure-up/998/bin/juju status
...
[pid 12971] openat(AT_FDCWD, "/tmp/juju-store-lock-6331373035633863", O_RDONLY|O_CREAT|O_CLOEXEC, 0600) = -1 EACCES (Permission denied)
[pid 12980] <... select resumed> ) = 0 (Timeout)
[pid 12971] ioctl(2, TCGETS <unfinished ...>
[pid 12980] futex(0xc420562910, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 12971] <... ioctl resumed> , {B38400 opost isig icanon echo ...}) = 0
[pid 12971] write(2, "\33[91m", 5) = 5
[pid 12971] write(2, "ERROR", 5ERROR) = 5
[pid 12971] write(2, "\33[0m", 4) = 4
[pid 12971] write(2, " cannot get current controller n"..., 55 cannot get current controller name: permission denied
) = 55

➜ ~ stat /tmp/juju-store-lock-6331373035633863
  File: /tmp/juju-store-lock-6331373035633863
  Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 1ch/28d Inode: 27667636 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-05-03 09:11:40.325220604 +0200
Modify: 2018-05-03 09:11:40.325220604 +0200
Change: 2018-05-03 09:11:40.325220604 +0200
 Birth: -

➜ ~ sudo rm /tmp/juju-store-lock-6331373035633863

➜ ~ sudo chown ubuntu:ubuntu /home/ubuntu/.local/share/juju/controllers.yaml

➜ ~ juju status
Model Controller Cloud/Region Version SLA
default vmaas vmaas 2.3.6 unsupported

...

Revision history for this message
John A Meinel (jameinel) wrote :

Most likely this is due to running some sort of "sudo juju XXX" (eg status) command.
You should never *need* sudo for any juju commands anymore (the only one you ever did was 'juju bootstrap' with juju 1.x).
There is already a bug about ~/.local/share/juju/* should not end up owned as root after a "sudo juju *" command. (We update those files with atomic replace, but I think we missed chowning them before replacing).
/tmp/* could be tried to be nice, but certainly we should give a better error message.

Changed in juju:
importance: Undecided → Medium
status: New → Triaged
tags: added: bitesize lock usability
Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This bug has not been updated in 2 years, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

Changed in juju:
importance: Medium → Low
tags: added: expirebugs-bot
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.