Installing snap on openSUSE

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

Older openSUSE releases:

The snap daemon, snapd, is only built for currently supported openSUSE releases. See support lifetime for details about which releases are currently within the support timeframe.

Add the repository

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

sudo zypper addrepo --refresh \
  https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed \
  snappy

Swap out openSUSE_Tumbleweed for your chosen openSUSE distribution, such as openSUSE_Leap_15.5.

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.

Now enable and start the snapd service with the following command:

sudo systemctl enable --now snapd

Run the following to enable and start the snapd.apparmor service:

sudo systemctl enable --now snapd.apparmor

At this point, we recommend restarting your machine. 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 two commands (--refresh is important), replacing openSUSE_Tumbleweed with your specific version of openSUSE:

sudo zypper removerepo snappy
sudo zypper addrepo --refresh \
    https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed \
    snappy

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

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

1 Like

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

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
1 Like

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

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

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

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.
1 Like

@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?

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.

1 Like

Hey, sorry for bumping but I assume this is the topic for suggesting changes to this page. I think you could replace the

$ sudo systemctl enable snapd
$ sudo systemctl start snapd

with

$ sudo systemctl enable --now snapd

instead.

Citing the systemctl man page: Note that this does not have the effect of also starting any of the units being enabled. If this is desired, combine this command with the --now switch, or invoke start with appropriate arguments later.

Thanks.

Hello, and yes, this is exactly the right topic for suggesting changes! And I think you’re right - a single line is easier to copy and it’s still clear what’s going on. I’ll update the doc - thank you!

1 Like

I just installed Leap 15.2 and I’ve tried everything I’ve seen here including all the suggestions but I’m unable to get snap to work. I see it is installed but I cannot start it.

sudo systemctl enable --now snapd produces: “Job for snapd.service failed because the control process exited with error code. …”

Trying the solution offered above, sudo systemctl enable snapd.apparmor, I get “Failed to enable unit: Unit file snap.apparmor.service does not exist.”

Yet when I rerun zypper install snapd, I get “…‘snapd’ is already installed. No update candidate for ‘snapd-2.48.2-lp152.1.1.x86_64’. The highest available version is already installed.”

Sorry you’re having problems - I’ve just followed the instructions on a fresh Leap 15.2 install (in an x86 VM) and everything worked as expected.

Could you try sudo journalctl --no-pager -u snapd and snap version? For reference, here’s the output from the system I just installed:

$ sudo journalctl --no-pager -u snapd
[sudo] password for root: 
-- Logs begin at Wed 2021-01-20 10:59:47 GMT, end at Wed 2021-01-20 11:19:40 GMT. --
Jan 20 10:59:49 localhost systemd[1]: Starting Snap Daemon...
Jan 20 10:59:50 localhost snapd[994]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network
Jan 20 10:59:50 localhost snapd[994]: daemon.go:347: started snapd/2.48.2-lp152.1.1 (series 16; classic; devmode) opensuse-leap/15.2 (amd64) linux/5.3.18-lp152.19-default.
Jan 20 10:59:50 localhost snapd[994]: daemon.go:440: adjusting startup timeout by 40s (pessimistic estimate of 30s plus 5s per snap)
Jan 20 10:59:50 localhost systemd[1]: Started Snap Daemon.
Jan 20 11:03:32 localhost.localdomain snapd[994]: api.go:1007: Installing snap "snap-store" revision unset
Jan 20 11:05:46 localhost.localdomain snapd[994]: storehelpers.go:551: cannot refresh: snap has no updates available: "core", "core18", "gnome-3-34-1804", "gtk-common-themes", "hello-world", "snap-store"

$ snap version
snap           2.48.2-lp152.1.1
snapd          2.48.2-lp152.1.1
series         16
opensuse-leap  15.2
kernel         5.3.18-lp152.19-default

Can you double check whether apparmor is installed in your system? On my Tumbleweed system I have the following packages:

maciek@sloop:~ rpm -qa apparmor\* | sort
apparmor-abstractions-3.0.1-1.2.noarch
apparmor-docs-3.0.1-1.2.noarch
apparmor-parser-3.0.1-1.2.x86_64
apparmor-parser-lang-3.0.1-1.2.noarch
apparmor-profiles-3.0.1-1.2.noarch
apparmor-rpm-macros-1.0-6.3.noarch
apparmor-utils-3.0.1-1.2.noarch
apparmor-utils-lang-3.0.1-1.2.noarch

I guess zypper in apparmor-parser should be enough to pull in the right dependencies. Although it’s a bit weird why those would be missing from your system, since the snapd explicitly requires the apparmor-parser package.

I show it installed but when this is where I cannot go further:

bryan@OpenSUSE Leap:~> sudo systemctl enable --now snapd.apparmor
Failed to enable unit: Unit file snapd.apparmor.service does not exist.
bryan@OpenSUSE Leap:~> rpm -qa apparmor* | sort
apparmor-abstractions-2.13.4-lp152.2.3.1.noarch
apparmor-docs-2.13.4-lp152.2.3.1.noarch
apparmor-parser-2.13.4-lp152.2.3.1.x86_64
apparmor-parser-lang-2.13.4-lp152.2.3.1.noarch
apparmor-profiles-2.13.4-lp152.2.3.1.noarch
apparmor-utils-2.13.4-lp152.2.3.1.noarch
apparmor-utils-lang-2.13.4-lp152.2.3.1.noarch

Sorry, I didn’t notice you are using Leap. Something is not quite right though, the package is built without AppArmor support in Leap, the instructions about enabling snapd.apparmor provided in earlier posts apply to Tumbleweed only.

Can you paste the output of journalctl -u snapd --no-pager ?

bryan@OpenSUSE Leap:~> journalctl -u snapd --no-pager
Hint: You are currently not seeing messages from other users and the system.
Users in the ‘systemd-journal’ group can see all messages. Pass -q to
turn off this notice.
No journal files were opened due to insufficient permissions.

Can you try adding sudo? i.e. sudo journalctl -u snapd --no-pager