Installing snap on openSUSE


#1

Snap can be installed from the command line on openSUSE Leap 42.3, Leap 15 and Tumbleweed.

Add the repository

You need first add the snappy repository from the terminal. Leap 15 users, for example, can do this with the following command:

$ sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.0 snappy
...
Repository 'snappy' successfully added

Swap out openSUSE_Leap_15.0 for either openSUSE_Leap_42.3 or openSUSE_Tumbleweed if you’re using a different version of openSUSE.

With the repository added, import its GPG key:

$ sudo zypper --gpg-auto-import-keys refresh

Finally, upgrade the package cache to include the new snappy repository:

$ sudo zypper dup --from snappy

Install snapd

Snap can now be installed with the following:

$ sudo zypper install snapd

You then need to either reboot, logout/login or source /etc/profile to have /snap/bin added to PATH.

Additionally, enable and start both the snapd and the snapd.apparmor services with the following commands:

$ sudo systemctl enable snapd
$ sudo systemctl start snapd

Tumbleweed users also need to run the following:

$ sudo systemctl enable snapd.apparmor
$ sudo systemctl start snapd.apparmor

You now have snapd installed and ready to go.

Troubleshooting

If you don’t see the snapd update on your system, make sure the repository is refreshing correctly. If it’s not, remove and re-add the repository with the following command (–refresh is important):

$ sudo zypper removerepo snappy
$ sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.0 snappy

As above, replace openSUSE_Leap_15.0 with your specific version of openSUSE.


Snap Documentation
Installing snapd
Installing snapd
#2

There is no need to do a full distribution upgrade with sudo zypper dup as it could have unintended consequences to the system. There is also a typo in the command for adding a repository (the ` character at the end of the command).

The more adequate and much safer way to add a repository in OpenSuse, accept its GPG key and activate the repo would be:

$ sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.0 snappy
$ sudo zypper --gpg-auto-import-keys refresh
$ sudo zypper dup --from snappy

#3

Thanks for the these suggestions and the typo catch. I’ve updated the guide accordingly.


#4

Well, if we’re making things simpler, why not just use the upstream repo’s suggested name and then auto-pull missing keys during update. :wink:

sudo zypper ar --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.0/system:snappy.repo
sudo zypper --gpg-auto-import-keys dup --from system_snappy

#5

Missing an important step to activate snapd.apparmor.service. Without it applications won’t start after reboot.

sudo systemctl enable snapd.apparmor
sudo systemctl start snapd.apparmor

#6

I just tested it, and you’re right - I’ve updated the text. Thank you!


#7

Failed to enable unit: Unit file snapd.apparmor.service does not exist.


#8

Could you tell us which version of openSUSE you’re using and I’ll give it a go. Thanks.


#9

UPDATE: I apologize, I spoke too soon, I fixed the issue, for some reason my repositories had system:/snappy/openSUSE_Leap_15.0 set for snappy instead of openSUSE_Tumbleweed
For anyone else having trouble, I was able to fix the issue by listing, removing and adding the correct repository with

zypper lr -d

replace 13 with the # listed for snappy

sudo zypper rr 13

and then update properly with the correct Tumbleweed repo URL

sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed snappy
sudo zypper dup --from snappy
sudo systemctl enable snapd.apparmor.service

I’ve been getting the same for a while now, I first noticed it about a month ago and have gotten it with every update since and I update regularly, running OpenSUSE Tumbleweed

The following product is going to be upgraded:
openSUSE Tumbleweed  20190214-0 -> 20190219-0

(143/143) Installing: snapd-2.37.3-lp150.1.1.x86_64 ...................................................................................................................................................................................................................................[done]
Additional rpm output:
Please reboot, logout/login or source /etc/profile to have /snap/bin added to PATH.
On a Tumbleweed system you need to run: systemctl enable snapd.apparmor.service

brbfapping@dagobah:~> systemctl enable snapd.apparmor.service
Failed to enable unit: Unit file snapd.apparmor.service does not exist.
brbfapping@dagobah:~> sudo systemctl enable snapd.apparmor
Failed to enable unit: Unit file snapd.apparmor.service does not exist.

#10

@degville

here, snapd.service is installed & up (?), but there’s no trace of snapd.apparmor.service

lsb_release -rd
	Description:    openSUSE Leap 15.0
	Release:        15.0

zypper lr Snappy
	Alias          : Snappy
	Name           : Snappy
	URI            : https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.0
	Enabled        : Yes
	GPG Check      : (r ) Yes
	Priority       : 99 (default priority)
	Autorefresh    : On
	Keep Packages  : Off
	Type           : rpm-md
	GPG Key URI    :
	Path Prefix    :
	Parent Service :
	Keywords       : ---
	Repo Info Path : /etc/zypp/repos.d/Snappy.repo
	MD Cache Path  : /var/cache/zypp/raw/Snappy

zypper dup --from Snappy
zypper install snapd
rpm -qa | grep -i snapd
	snapd-2.37.4-lp150.1.1.x86_64

systemctl enable snapd
systemctl enable snapd.apparmor
	Failed to enable unit: Unit file snapd.apparmor.service does not exist.

systemctl list-units --all | grep -i snap | grep service
  snapd.failure.service                                                                                                                      	loaded    inactive   dead      Failure handling of the snapd snap                                            
  snapd.service                                                                                                                              	loaded    active     running   Snappy daemon                                                                 

systemctl status snapd -l
	● snapd.service - Snappy daemon
	   Loaded: loaded (/usr/lib/systemd/system/snapd.service; enabled; vendor preset: disabled)
	  Drop-In: /etc/systemd/system/snapd.service.d
	           └─override.conf
	   Active: active (running) since Mon 2019-03-25 16:09:15 PDT; 5s ago
	 Main PID: 8269 (snapd)
	    Tasks: 10 (limit: 9830)
	   CGroup: /system.slice/snapd.service
	           └─8269 /usr/lib/snapd/snapd

	Mar 25 16:09:14 dev04.lan snapd[8269]: AppArmor status: apparmor not enabled
	Mar 25 16:09:14 dev04.lan snapd[8269]: daemon.go:379: started snapd/2.37.4-lp150.1.1 (series 16; classic; devmode) opensuse-leap/15.0 (amd64) linux/5.0.3-lp150.6.g2a31831-de.

Is that^^ still current instruction, and a dependency has changed? Is there additional install step required?


#11

Those are applicable only to openSUSE Tumbleweed for now. We believe that once the snapd package migrates to the openSUSE repository it will also not be needed because snapd will be added to the system presets package, which will enable appropriate services automatically.