debug kernel commandline break snap service refreshes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Triaged
|
High
|
Alfonso Sanchez-Beato |
Bug Description
With the debug kernel command line (or alternatively the systemd.
Specifically, our usages of the systemctl command will fail to run properly, because systemd will see that we are running systemctl from inside a systemd unit (i.e. as a child process of snapd.service), and it will add debugging messages like this:
```
$ systemctl show --property=
Bus n/a: changing state UNSET → OPENING
Bus n/a: changing state OPENING → AUTHENTICATING
Successfully forked off '(pager)' as PID 25124.
Showing one /org/freedeskto
Bus n/a: changing state AUTHENTICATING → RUNNING
Sent message type=method_call sender=n/a destination=
Got message type=method_return sender=
Unit snap.lxd.
Bus n/a: changing state RUNNING → CLOSED
Type=
Id=snap.
ActiveState=
UnitFileState=
```
When our code expects only this output (which is also what you see without these debug options set):
```
$ systemctl show --property=
Type=
Id=snap.
ActiveState=
UnitFileState=
```
Confusingly, running systemctl from a normal shell even with these options enabled does not trigger the additional output, the systemctl command must be run from a systemd unit.
This affects the `snap services` command any any refreshes of snaps with services as snapd will fail to understand the status of the service when refreshing and thus will fail the refresh.
Changed in snapd: | |
importance: | Undecided → High |
status: | New → Triaged |
assignee: | nobody → Ian Johnson (anonymouse67) |
Changed in snapd: | |
assignee: | Ian Johnson (anonymouse67) → nobody |
It seems that systemctl in this state will output the debug commands to stderr and the normal output we parse to stdout, but in snapd we are combining those two streams when running the command, so the fix for now is just to not combine those streams when running systemctl.