snapctl used from classic snaps with non-core bases on debian 9 is broken
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Confirmed
|
Medium
|
Unassigned |
Bug Description
Snapctl does not re-exec, and when it is used from a classic snap that has a non-core base, snapctl from the host is used instead. snapctl from the host on Debian 9 (from snapd 2.21) is broken in that it doesn't talk to the right socket, so it fails with "error: access denied".
See below for original description:
This was originally reported to us regarding our classic Certbot snap at https:/
It appears that installing the latest "core" snap (16-2.51) on Debian Stretch, causes the "snapctl" program and REST API to produce an "access denied" error when running "snapctl" on the host or inside a classic snap:
# snapctl
error: access denied
# curl --data '{"args":[]}' --unix-socket /run/snapd.socket http:/
/localhost/
{"type"
# snap list
Name Version Rev Tracking Publisher Notes
certbot 1.16.0 1201 latest/stable certbot-eff✓ classic
core 16-2.51 11187 latest/stable canonical✓ core
core20 20210429 1026 latest/stable canonical✓ base
hello-world 6.4 29 latest/stable canonical✓ -
Reproducing this can be done by:
1. Spinning up a Debian Stretch server
2. apt update && apt install snapd
3. snap install core
4. snapctl
If skipping step (3), no error is encountered at step (4).
Changed in snapd: | |
importance: | Undecided → Critical |
The problem is caused by a very old snapd deb 2.21; even though snapd itself re-execs into 2.51, snapctl from the host (i.e. 2.21) is still used when executing snapctl either from the host or from classic snaps. The old snapctl tries to use /run/snapd.socket (and is denied the access), while nowadays snapd expects snapctl to talk via /run/snapd- snap.socket. This can be observed also with 'snap run --shell certbot', followed by manual invocation of snapctl as detailed in the github issue linked in the description.
The problem isn't new though, it must have been the case for a few years already, I suppose the affected snap didn't use snapctl before.