snap remove "core" is not allowed

Bug #1589210 reported by Kentaro Kazuhama
104
This bug affects 23 people
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

When I installed "hello-world" snap package, also installed "ubuntu-core" snap package by its dependency.

After snap installation,I tried remove all snap packages by snap command
Snap command can remove "hello-world" snap package.But "ubuntu-core" snap package can't and display below.

$sudo snap remove ubuntu-core
~sudo password input~
error: cannot remove "ubuntu-core": snap "ubuntu-core" is not removable

Here is "snap changes" result.But ubuntu-core remove change does not display.

$ snap changes
ID Status Spawn Ready Summary
1 Done 2016-06-04T12:30:41Z 2016-06-04T12:36:51Z Install "hello-world" snap
2 Done 2016-06-05T08:41:11Z 2016-06-05T08:41:12Z Remove "hello-world" snap

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapd (Ubuntu):
status: New → Confirmed
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is currently true. Snapd prevents removal of the core snap. Perhaps we should allow it to be removed after all other snaps have been removed as well?

Revision history for this message
Mateusz Stachowski (stachowski-mateusz) wrote :

Yes it should be allowed if there are no other snaps.

Revision history for this message
fprietog (fprietog) wrote :

"Base" snap package has the same problem:

# snap remove base
error: cannot remove "base": snap "base" is not removable

Revision history for this message
Oliver Grawert (ogra) wrote :

not sure what the "base" snap would be ...

Revision history for this message
fprietog (fprietog) wrote :

That's the description:

Name Version Developer Notes Summary
base 16.04+20160525.05-00 canonical - Base content for snapd

It's contents are very similar to "ubuntu-core" package":

base:
-----
-rw-r--r-- 1 root root 0 may 25 20:55 base_16.04+20160525.05-00_amd64.snap
drwxr-xr-x 2 root root 1739 may 25 06:59 bin/
drwxr-xr-x 5 root root 109 may 25 06:59 boot/
drwxr-xr-x 4 root root 1597 may 25 06:58 dev/
drwxr-xr-x 77 root root 2367 may 25 06:59 etc/
drwxr-xr-x 3 root root 29 may 25 06:59 home/
drwxr-xr-x 18 root root 379 may 25 06:59 lib/
drwxr-xr-x 2 root root 43 may 25 06:57 lib64/
drwxr-xr-x 2 root root 3 may 25 06:57 media/
drwxr-xr-x 2 root root 32 may 25 20:55 meta/
drwxr-xr-x 2 root root 3 may 25 06:57 mnt/
drwxr-xr-x 2 root root 3 may 25 06:57 opt/
drwxr-xr-x 2 root root 3 abr 12 22:14 proc/
drwx------ 2 root root 46 may 25 06:59 root/
drwxr-xr-x 8 root root 115 may 25 06:58 run/
drwxr-xr-x 2 root root 2267 may 25 06:59 sbin/
drwxr-xr-x 2 root root 3 may 19 23:33 snap/
drwxr-xr-x 2 root root 3 may 25 06:57 srv/
drwxr-xr-x 2 root root 3 feb 5 10:48 sys/
drwxrwxrwt 2 root root 3 may 25 06:59 tmp/
drwxr-xr-x 11 root root 151 may 25 06:58 usr/
drwxr-xr-x 12 root root 160 may 25 06:59 var/
drwxr-xr-x 2 root root 3 may 25 06:59 writable/

ubuntu-core:
------------
-rw-r--r-- 1 root root 0 may 25 20:55 base_16.04+20160525.05-00_amd64.snap
drwxr-xr-x 2 root root 1739 may 25 06:59 bin/
drwxr-xr-x 5 root root 109 may 25 06:59 boot/
drwxr-xr-x 4 root root 1597 may 25 06:58 dev/
drwxr-xr-x 77 root root 2367 may 25 06:59 etc/
drwxr-xr-x 3 root root 29 may 25 06:59 home/
drwxr-xr-x 18 root root 379 may 25 06:59 lib/
drwxr-xr-x 2 root root 43 may 25 06:57 lib64/
drwxr-xr-x 2 root root 3 may 25 06:57 media/
drwxr-xr-x 2 root root 32 may 25 20:55 meta/
drwxr-xr-x 2 root root 3 may 25 06:57 mnt/
drwxr-xr-x 2 root root 3 may 25 06:57 opt/
drwxr-xr-x 2 root root 3 abr 12 22:14 proc/
drwx------ 2 root root 46 may 25 06:59 root/
drwxr-xr-x 8 root root 115 may 25 06:58 run/
drwxr-xr-x 2 root root 2267 may 25 06:59 sbin/
drwxr-xr-x 2 root root 3 may 19 23:33 snap/
drwxr-xr-x 2 root root 3 may 25 06:57 srv/
drwxr-xr-x 2 root root 3 feb 5 10:48 sys/
drwxrwxrwt 2 root root 3 may 25 06:59 tmp/
drwxr-xr-x 11 root root 151 may 25 06:58 usr/
drwxr-xr-x 12 root root 160 may 25 06:59 var/
drwxr-xr-x 2 root root 3 may 25 06:59 writable/

Dunno why I've it installed. I tested several packages and then removed them, but this one and ubuntu-core remains unremovables.

Revision history for this message
fprietog (fprietog) wrote :

Error in previous post, I've duplicated "base" contents listing. This is "ubuntu-core" listing:

ubuntu-core:
------------
drwxr-xr-x 24 root root 309 may 31 13:56 ./
drwxr-xr-x 4 root root 4096 jul 22 21:27 ../
drwxr-xr-x 2 root root 1739 may 31 13:54 bin/
drwxr-xr-x 5 root root 109 may 31 13:54 boot/
drwxr-xr-x 4 root root 1597 may 31 13:53 dev/
drwxr-xr-x 77 root root 2367 may 31 13:55 etc/
drwxr-xr-x 3 root root 29 may 31 13:54 home/
drwxr-xr-x 18 root root 379 may 31 13:54 lib/
drwxr-xr-x 2 root root 43 may 31 13:51 lib64/
drwxr-xr-x 2 root root 3 may 31 13:51 media/
drwxr-xr-x 2 root root 32 may 31 13:56 meta/
drwxr-xr-x 2 root root 3 may 31 13:51 mnt/
drwxr-xr-x 2 root root 3 may 31 13:51 opt/
drwxr-xr-x 2 root root 3 abr 12 22:14 proc/
drwx------ 2 root root 46 may 31 13:54 root/
drwxr-xr-x 8 root root 115 may 31 13:53 run/
drwxr-xr-x 2 root root 2267 may 31 13:54 sbin/
drwxr-xr-x 2 root root 3 may 19 23:33 snap/
drwxr-xr-x 2 root root 3 may 31 13:51 srv/
drwxr-xr-x 2 root root 3 feb 5 10:48 sys/
drwxrwxrwt 2 root root 3 may 31 13:55 tmp/
drwxr-xr-x 11 root root 151 may 31 13:53 usr/
drwxr-xr-x 12 root root 160 may 31 13:54 var/
drwxr-xr-x 2 root root 3 may 31 13:54 writable/

Revision history for this message
Oliver Grawert (ogra) wrote :

yes, that was a temporary experiment, the base package should long have been unpublished ...

Revision history for this message
fprietog (fprietog) wrote :

Well, with newest snapd 2.11 version there is a way to remove ubuntu-core snap package.

If you try:
$sudo snap remove ubuntu-core

You get the "snap "ubuntu-core" is not removable" error as expected.

But you can disable it with the command:
$sudo snap disable ubuntu-core

And, once disabled, it can be effectively removed using again:
$sudo snap remove ubuntu-core

Revision history for this message
Oliver Grawert (ogra) wrote :

alongside, the "base" package has now been unpublished in the store

Revision history for this message
Dan Watkins (oddbloke) wrote :

I've just hit this when attempting to transition to the core snap and I had to purge snapd itself to get rid of ubuntu-core.

Michael Vogt (mvo)
summary: - snap remove failed ubuntu-core snap package
+ snap remove "core" on classic not allowed
Changed in snapd (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Florin Andrei (florin-andrei) wrote : Re: snap remove "core" on classic not allowed

Still no luck:

# snap remove core
error: cannot remove "core": snap "core" is not removable

Since I enabled snap, mounting USB volumes, either automatically or manually, is broken. And I can't even get rid of snap. Effectively snap has broken my system. This is really, really bad.

Speaking in general, disallowing users to revert things such as package installation is an extremely bad idea; it leads to frustration and a poor user experience.

Revision history for this message
John Lenton (chipaca) wrote :

@Florin, USB mounting broken? Could you file a separate bug about that? (it certainly works here! :-) )

Revision history for this message
Michael Vogt (mvo) wrote :

@florian: Thanks for your bugreport. And sorry to hear that snap is giving you trouble. You can get rid of snap by doing: "apt purge snapd". This will remove everything including the core snap.

Having said that I'm keen to hear more about the USB mounting issue you have? What kind of error do you get? Could you attach your /var/log/syslog file maybe? This might give us a clue what is going on.

Thanks,
 Michael

Revision history for this message
Uli.Heller (uli-heller) wrote :

I think I do have a similar issue:

$ snap list
Name Version Rev Developer Notes
core 16-2.26.9 2381 canonical -

$ sudo snap remove core
error: cannot remove "core": snap "core" is not removable

$ df
...
/dev/loop1 82432 82432 0 100% /snap/core/2381
...

$ sudo umount /snap/core/2381

$ sudo snap remove core
core removed

Maybe this helps?

Revision history for this message
azrobbo (azrobbo) wrote :

This issue still exists in 17.04, with a few differences:

* The snap is called "core" and not "ubuntu-core"
* sudo snap remove core - returns the same message as above: snap "core" is not removable
* However, trying to umount "core" fails if snapd.service is running

My fix was to:
(1) use 'df' to find the mount point of "/snap/core/*"
(2) stop the snap service
(3) umount /snap/core/xxxx
(4) start snap service
(5) use snap remove core - which then worked

---
Here's the abbreviated output

$ snap list
Name Version Rev Developer Notes
core 16-2.26.14 2462 canonical -

$ df # use output to find the mount point "/snap/core/xxxx"

$ sudo umount /snap/core/2462 # this failed on my system, unlike poster above
umount: /snap/core/2462: target is busy
...

$ sudo systemctl stop snapd
Warning: Stopping snapd.service, but it can still be activated by: snapd.socket

$ sudo umount /snap/core/2462 # umount worked with snapd stopped

$ sudo systemctl start snapd # start snapd again in order to use 'snap remove' command

$ df # verify that starting the snap service didn't remount "core" (it didn't)
...
{"/snap/core/xxxx" not listed}
...

$ sudo snap remove core # success!
core removed

---
Verify Removal:

$ sudo snap list
No snaps are installed yet. Try "snap install hello-world"

$ ls -l /snap/core
...
{nothing listed}

Revision history for this message
Ricardo (nu118yt3) wrote :

Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty

To be able to remove the 'core' snap, i had to follow @azrobbo instructions at #16:

$ sudo service snapd restart
$ df
$ sudo umount /snap/core/xxxx
$ sudo snap remove core

So my doubt is, why do i need to restart the 'snapd' service on a fresh booted machine?!
Does it hook any process on boot?!

Revision history for this message
Guy Rouillier (guy-rouillier) wrote :

Commenting on this old post I found via search because Uli.Heller's suggestion worked for me to remove the snap core18 from Ubuntu 19.04. The core18 snap was mounted thusly:

/dev/loop13 55808 55808 0 100% /snap/core18/1066

First I disabled it:

snap disable core18

Then I unmounted it:

umount /dev/loop13

and then I could remove the snap:

snap remove core18

tags: added: focal jammy
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

Here is a fresh test in Ubuntu lunar:

# snap remove core
error: cannot remove "core": snap "core" is not removable: snap is used by the model

$ snap info snapd
[...]
installed: 2.58.3 (18596) 52MB snapd

tags: added: kinetic lunar
tags: added: mantic
summary: - snap remove "core" on classic not allowed
+ snap remove "core" is not allowed
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.