Error while removing snap

Hello ,

My snap looks like below:


name: lenovo-wwan-dpr
version: …

confinement: strict
base: core20

grade: stable

parts:

apps:
wwan-dpr:
daemon: oneshot
plugs:
- xx
command: bin/X1

dpr-fcc-unlock:
command: bin/X2
plugs:
- xxx


When i try removing snap after installing, I am always getting below error:

-> error: snap “lenovo-wwan-dpr” has “service-control” change in progress
Just for information: Binary x1 is launching Binary X2.

Do , i need to add some attributes to fix it. Any information regarding this will be helpful.
Thank you !!

Can you attach the output of snap changes ? Specifically, there should be a change that is in Doing state, please attach the output of snap change <id> of that change as well.

Thank you for your comments.

271 Done today at 15:27 JST today at 15:27 JST Install “lenovo-wwan-dpr” snap from file “lenovo-wwan-dpr_1.0.2-wwan-dpr_amd64.snap”
272 Done today at 15:28 JST today at 15:28 JST Connect lenovo-wwan-dpr:modem-manager to snapd:modem-manager
273 Done today at 15:28 JST today at 15:28 JST Connect lenovo-wwan-dpr:hardware-observe to snapd:hardware-observe
274 Doing today at 15:28 JST - Running service command

Yes , i can see Doing . Is there a way , i can forcefully remove snap ?
command snap change <id> doesnot work for me like snap change <274> or snap change 274

So if you run snap change 274 there’s no output? Can you check the journal maybe? Running sudo journalctl --since 15:28 should produce sufficient output.

No output but using ‘snap tasks 274’ , i can see below:
Status Spawn Ready Summary
Doing today at 15:28 JST - Run service command “start” for services [“wwan-dpr”] of snap “lenovo-wwan-dpr”

To test my modification locally , I have executed below commands:

  1. snap install -dangerous lenovo-wwan-dpr-.xxxx.snap
  2. snap connect lenovo-wwan:hardware-observe
  3. snap connect lenovo-wwan:modem-manager
  4. snap start lenovo-wwan-dpr

You can run snap abort 274 to abort the change and then you should be able to remove the snap. FWIW I would look into why the service cannot be started. Probably inspecting the journal will help.

Still i was unable to remove snap. I saw binary running . So , i killed process as i have mentioned below and then it worked.

I found that binary i.e ‘/snap/lenovo-wwan-dpr/x1/bin/X2’ was running . So , i just kill the process by check id using ‘ps -ef’. After than i can remove snap . So , its working now.

Thank you for supporting on this issue

Hello @mborzecki . While testing my updated snap , i am getting this issue again i.e error while removing snap . Although, i can fix this by manually killing process of binary but i think there might be some way to be fixed from snap side or else , i am missing something.

Issue Log:

root@nitin-ThinkPad-X1-Nano-Gen-1:/home/nitin# snap remove lenovo-wwan-dpr error: snap “lenovo-wwan-dpr” has “service-control” change in progress

Jounalctl log during this issue is below:

  • dbus-daemon[1567]: [session uid=1000 pid=1567] Activating via systemd: service name=‘org.freedesktop.Tracker1.Miner.Extract’ unit=‘tracker-extract.service’ requested by ‘:1.2’ (uid=1000 pid=1563 comm="/usr/libexec/tracker-miner-fs " label=“unconfined”)
  • systemd[1555]: Starting Tracker metadata extractor…
  • tracker-extract[4562]: Set scheduler policy to SCHED_IDLE
  • tracker-extract[4562]: Setting priority nice level to 19
  • systemd[1555]: Started Tracker metadata extractor.
  • systemd[1555]: tracker-extract.service: Succeeded.
  • dbus-daemon[1567]: [session uid=1000 pid=1567] Successfully activated service ‘org.freedesktop.Tracker1.Miner.Extract’
  • dbus-daemon[1567]: [session uid=1000 pid=1567] Activating via systemd: service name=‘org.freedesktop.Tracker1.Miner.Extract’ unit=‘tracker-extract.service’ requested by ‘:1.2’ (uid=1000 pid=1563 comm="/usr/libexec/tracker-miner-fs " label=“unconfined”)
  • systemd[1555]: Starting Tracker metadata extractor…
  • tracker-extract[4590]: Set scheduler policy to SCHED_IDLE
  • tracker-extract[4590]: Setting priority nice level to 19
  • dbus-daemon[1567]: [session uid=1000 pid=1567] Successfully activated service ‘org.freedesktop.Tracker1.Miner.Extract’
  • systemd[1555]: Started Tracker metadata extractor.
  • systemd[1555]: tracker-extract.service: Succeeded.

Any information regarding this will be helpful. Thank you

Which means that there is a running change related to this snap. Inspect the output of snap changes for any changes that are in doing state. Then you can run snap change <id> for a specific change and see what is happening there.

Thank you for this information … I will check this and get back with update soon …

Hello @mborzecki I can see below log . I am not sure, if i am missing something … It will be helpful, if you can update , in case i am missing something ? Thank you

From the logs, lenovo-wwan-dpr is waiting for systemd to report that its services have been started. Journal logs from the time of the installation would be more useful. The startup job be killed by systemd if it doesn’t complete within the default timeout (usually 90s) and the install will fail. I see that there is another install which run just minutes before which failed too. Ultimately you need to figure out why the services do not start.

Thank you … Still i am checking and trying to find root cause, as i didn’t get any extra information from previously shared journalctl log .

Below is what i am doing, I am not sure if i am using services correctly for my snap or not ? Any comments on below?

“Application A” (binary) -> using “system call (“xxx”)” Launches “Application b” (binary) which will keep running correctly. I have made “Application A” as daemon which is “oneshot” so that it restarts after every reboot .

In this case, when i explicitly kill running process of “Application b” binary then i am able to perform “snap remove xx”

Also , While installing it always shows "snap has “install-snap” change in progress’ and when i reboot system , snap gets started correctly but while removing snap it shows ““lenovo-wwan-dpr” has “service-control” change in progress

a oneshot daemon is expected to return immediately after it ran … try using simple or forking instead …

@ogra Thank you … By changing daemon to “simple” fix this issue although i am still doing some more testing on it…