Trouble installing snapd on RHEL 8

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?

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:

1 Like

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.

1 Like

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.*?

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

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

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.

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.

Does anyone have an estimate on when snapd will be available for RHEL 8?

It all depends on being able to get a branch and build a package for EPEL8 on the Fedora infrastructure. Perhaps @Conan_Kudo has more details.

Except the EPEL repo for RHEL 7 isn’t updated as frequently as one would like. It’s still only providing 2.39.2 from June at the moment, which means it doesn’t have important things like the SELinux policy updates from 2.39.3, let alone the improvements/fixes from the three major releases since then.

Well, there’s nothing we could have done though. The real issue was with koji/bodhi https://pagure.io/releng/issue/8676 Now that it finally got fixed, we should be able to push updates for EPEL7 again.

1 Like

I’ve introduced snapd for EPEL 8, as noted here.

Thanks for the update. The new packages are now in EPEL 8, and I’ve updated the RHEL docs accordingly. I’ll do the same for CentOS 8 (you might want to try them out, @craxal).

Sorry I didn’t say anything earlier. I’ve tested it out on a RHEL 8 machine, and it all works perfectly. Thank you very much!

Hi, I try to install snapd on my centos 8 and there currently the same problem with dependency to newer version of snapd-selinux-2.42.1-1.el8.noarch. So if you can pls fix it for centos too. Thx.

Problem: package snapd-2.42.1-1.el8.x86_64 requires snapd-selinux = 2.42.1-1.el8, but none of the providers can be installed