refresh app awareness: snapd thinks clion is running, but it isn't

Bug #1965468 reported by Alistair Buxton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
New
Undecided
Unassigned

Bug Description

```
al@al-desktop:~$ sudo snap refresh clion
error: cannot refresh "clion": snap "clion" has running apps (clion)
```

I can't find any evidence of clion actually running.

Please advise where I should look to diagnose this?

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: snapd 2.51.1+20.04ubuntu2
ProcVersionSignature: Ubuntu 5.4.0-96.109-generic 5.4.157
Uname: Linux 5.4.0-96-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu27.21
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: XFCE
Date: Fri Mar 18 02:11:59 2022
InstallationDate: Installed on 2018-05-07 (1410 days ago)
InstallationMedia: Xubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Alistair Buxton (a-j-buxton) wrote :
Revision history for this message
Alistair Buxton (a-j-buxton) wrote :

Okay I found the problem - a detached tmux session was still running inside the container.

The way you actually find this is to run `systemctl-cgls` and then look for the cgroup belonging to the snap. It will be something like `snap.clion.clion.e566369e-6a51-4497-84ba-d4f52f65291b.scope` and the processes running inside it will be listed directly below. Snapd wants there to be no processes in the cgroup before it will do the refresh.

Revision history for this message
Alistair Buxton (a-j-buxton) wrote :

PS I will leave this open because the tooling/docs/error messages when this happens could be more helpful. I had to go and read snapd source code to find out how it even determines that a snap is running.

Revision history for this message
Alberto Mardegan (mardy) wrote :

The code managing this situation actually has the information about the PIDs of the running processes.

Samuele, do you think we should print them as part of the error message?

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.