Trouble installing snapd on RHEL 8


#1

My team wants to test our snap out on Red Hat since many of our Linux users are on that. So, I’ve been trying to spin up a test machine. Been having trouble with the installation steps as defined in the documentation (https://snapcraft.io/docs/installing-snap-on-red-hat). Some details about my setup:

  • Red Hat 8 with trial subscription
  • Machine is a HyperV Gen 2 VM

Steps and results:

  • sudo rpm ... succeeds

  • sudo subscription-manager repos ... fails with the following errors:

    Error: 'rhel-*-optional-rpms' does not match a valid repository ID...
    Error: 'rhel-*-extras-rpms' doesn not match a valid repository ID...
    
  • sudo yum install snapd fails with the following errors:

    Problem 1: cannot install the best update candidate for package annobin-8.64-1.el8.x86_64
     - nothing provides librpm.so.3()(64bit) needed by annobin-8.64-1.el8.x86_64
     - nothing provides librpmio.so.3()(64bit) needed by annobin-8.64-1.el8.x86_64
    Problem 2: cannot install the best update candidate for package libidn2-2.0.5-1.el8.x86_64
     - nothing provides libunistring.so.0()(64bit) needed by libidn2-2.0.5-1.el8.x86_64
    

    Running the command again with --nobest reports the same errors but appears to complete successfully.

  • sudo yum install snapd fails with the following errors:

    Problem: package snapd-2.39.2-1.el7.x86_64 requires snapd-selinux = 2.39.2-1.el7, but none of the providers can be installed
     - conflicting requests
     - nothing provides policycoreutils-python needed by snapd-selinux = 2.39.2-1.el7.noarch
    
    The `--nobest` option does not work.
    
    

At this point, I’m stuck… I’m going to try installing directly onto bare metal, but we’ll see. I haven’t had problems with VMs before with other distros installing snapd or installing and running our snap.

Update: Tried with a bare metal machine, and same problem. New to Red Hat, but is this a subscription issue? Do trial subscriptions not have access to those repos?


#2

These errors look like your RHEL installation isn’t yet registered. Unfortunately, however, there’s another issue blocking the installation of snapd on RHEL 8 - it’s not yet in the EPEL 8 repository (I’ll update the docs to include this).

There is a post on building snapd manually for RHEL 8, but that’s obviously a more time consuming (and ambitious) method:


Installing snap on Red Hat Enterprise Linux (RHEL)
#3

Actually, I’ve just done this on a fresh RHEL 8 install and it’s straightforward. Here’s the complete set of commands I used:

$ sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
$ sudo subscription-manager repos --enable rhel-8-for-x86_64-appstream-rpms
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo dnf upgrade
$ sudo yum module install go-toolset
$ sudo yum install git spectool
$ git clone https://github.com/snapcore/snapd/
$ mv snapd ~/rpmbuild
$ cd ~/rpmbuild
$ spectool -g ./packaging/fedora/snapd.spec
$ sudo dnf builddep packaging/fedora/snapd.spec -y
$ rpmbuild -bb ./packaging/fedora/snapd.spec
$ sudo dnf localinstall RPMS/x86_64/snap-confine-2.41-0.el8.x86_64.rpm
$ sudo dnf localinstall RPMS/noarch/snapd-selinux-2.41-0.el8.noarch.rpm
$ sudo dnf localinstall RPMS/x86_64/snapd-2.41-0.el8.x86_64.rpm
$ sudo systemctl enable --now snapd.socket
$ snap install hello-world

A reboot/logout/login should put hello-world in the path.


#4

I’m not a Red Had Linux expert, but I’m pretty sure my machine is registered. I open the subscription manager, and it says my subscription is current (complete with Unregister button).

Building snapd simply isn’t an option. That’s not what our users should be expected to do. Is RHEL 8 pretty new? Is snapd available for 7.*?


#5

I agree. And yes, it’s available for RHEL 7.6+ through the EPEL repository, as outlined in the install page.


#6

I don’t suppose you know how to downgrade from 8 to 7.6? :slight_smile:


#7

Sorry, that sounds like a tough one! But we’re hopeful we can get snapd into EPEL for RHEL 8 very soon. I’ll post an update here when that happens.


#8

If you’re feeling brave, you can try a koji scratch build I ran yesterday: https://koji.fedoraproject.org/koji/taskinfo?taskID=37611605

Hopefully, we’ll be able to get an epel8 branch f in our snapd package in Fedora soon(ish), what should unblock the package.