22

First the caveat: I understand that this question involves Mate and a Raspberry Pi so if you consider it outside the realm of this forum just ignore it. But on the chance that it may be helpful or typical of something involving snaps or that platform, here goes.

I decided to try and install the nextcloud snap. It threw a ton of errors and seemed to freeze in the middle of the process (for over an hour). I killed it and just decided to try and remove it. The install looked like....

$ sudo snap install nextcloud
2016-06-24T08:48:29-04:00 ERROR cannot setup apparmor for snap "nextcloud": cannot load apparmor profile "snap.nextcloud.apache": cannot load apparmor profile: exit status 1
apparmor_parser output:
Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
Use --subdomainfs to override.

2016-06-24T08:53:29-04:00 ERROR cannot setup apparmor for snap "nextcloud": cannot load apparmor profile "snap.nextcloud.apache": cannot load apparmor profile: exit status 1
apparmor_parser output:
Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
Use --subdomainfs to override.

[|] Setup snap "nextcloud" security profiles

When I try snap remove nextcloud I get

error: cannot remove "nextcloud": snap "nextcloud" has changes in progress

What I would primarily like to do is properly remove the snap and recover the space from the partition it created. If partition is the correct term??

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0  46.6M  0 loop /snap/ubuntu-core/120
loop1         7:1    0 113.9M  0 loop /snap/nextcloud/12
mmcblk0     179:0    0  14.9G  0 disk
├─mmcblk0p1 179:1    0    64M  0 part /boot
└─mmcblk0p2 179:2    0  14.8G  0 part /

I tried

snap abort nextcloud

and got

error: cannot find change with id "nextcloud"

I should also note that it doesn't show up as installed as I get only the following

$ snap list
Name Version Rev Developer Notes
ubuntu-core 16.04+20160531.12-01 120 canonical -

Though it does show up in....

$ snap interfaces
:network nextcloud
:network-bind nextcloud

I tried

$ snap changes
ID   Status  Spawn                 Ready  Summary
1    Doing   2016-06-24T12:39:20Z  -      Install "nextcloud" snap

$ sudo snap abort 1

$ snap changes
ID   Status  Spawn                 Ready  Summary
1    Abort   2016-06-24T12:39:20Z  -      Install "nextcloud" snap

But the partition is still there.

** Update, I ran the entire process again for debugging purposes and just let it sit after the "snap abort 1" command. At some point something seems to have completed in the background because lsblk shows nothing and the snap interfaces query shows nothing.

44

The snap command is actually made up of two components, server and client. You're interacting with the client. When you cancelled the install operation on the client side that's the only place you cancelled it-- the client. So it stopped showing you that it was installing, but it was still installing (this is a bug). (Update: This bug was fixed in snapd v2.20.1.)

On the server side, all of this stuff is happening in "changes." You can read more about them here, but for your purposes, you want to just abort this specific change. To do that, run:

$ snap changes
<snip>
203  Doing   2016-06-24T12:17:45Z  -  Install "nextcloud" snap

Note the ID, 203, and the fact that it's "Doing" it right now. To abort that operation, you use the change ID:

$ sudo snap abort 203

And the change should stop. However, I must say that the fact that the change froze partway through does not bode well for your ability to abort it. If it doesn't work, perhaps try rebooting. If that still doesn't seem to have fixed it and you're okay losing all your snaps and their data, you can completely reset the snapd state with this script.

  • Going to upvote for now because the script does indeed get rid of the partition and that was stated as my primary goal. I did that and then went back through the entire process to collect error messages and updated the question to reflect that information as well as the fact that as you stated the freezing indicated that the abort and removal would not work. I'll give it a day to see if there is a cleaner way to just get rid of nextcloud and if not will accept this because of the efficacy of the script. Thanks – Dennis Jun 24 '16 at 13:26
  • I'm a little confused regarding the "partition" to which you refer. Snapd doesn't partition anything. To what exactly are you referring? – Kyle Jun 24 '16 at 14:21
  • I updated the information in the question. I may have the terminology wrong, but I'm talking about what looks like a partition to me that shows up in lsblk. They also show up in file managers as disks though I'm apparently not clear on what the containers are. You can also see by the update at the end that your advice to abort the particular process did in fact work (if I had been patient). – Dennis Jun 24 '16 at 15:20
  • Side note, I see from your blog that you are apparently "the man" on this topic. If there is anything I can provide that would be useful re: why this didn't work in the first place please let me know. – Dennis Jun 24 '16 at 15:24
  • Haha, oh hardly, I just write sometimes. Snaps are simply squashfs images which are then mounted into place in /snap, which is what you're seeing there. Regarding the failure, it looks like some kernel issues on armhf for MATE. Would you mind logging a bug with this information so we can properly investigate? – Kyle Jun 24 '16 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.