Unofficial snapd repository for Amazon Linux 2

We are currently rebuilding the package and pushing them to a custom repository. You can grab the YUM repo file right here: https://people.canonical.com/~mvo/snapd/amazon-linux2/snapd-amzn2.repo

If EPEL is enabled in your system, you may need to be a bit more specific when installing snapd, so instead of

$ yum install snapd

you may need to run

$ yum install snapd-2.47.1-1.amzn2.1

The package is based on the EPEL one, with the main difference that SELinux is disabled (since it’s not supported by AMZN2 kernel anyway), and /snap -> /var/lib/snapd/snap symlink is avaialble out of the box.

We want to make the repository a bit more official and eventually host it at snapcraft.io.

You can also add this at the inside the /etc/yum.conf file to disable snapd packages from EPEL:

[main]
...
exclude=snapd-*.el7 snap-*.el7
2 Likes

glad to see there’s now a repo for amazon linux 2, but why is the package not in sync with latest release?

To date the latest is 2.48.2 while the repo only offers 2.47.1

Thanks for trying out the repository. We’ve pushed an update, snapd-2.48.2-1.amzn2.1 should be available now.

Thanks for your prompt response! Will certainly try out the new release. That being said, hopefully the whole process can be fully automated in near future? To put this to production use the timely availability of update is critical.

Thanks again for the push, appreciate it.

The repository has been updated to include snapd 2.50 release.

Hey @mborzecki, thanks for the work but unfortunately I cannot install snapd like in your instructions. I tried yum install snapd-2.47.1-1.amzn2.1 but got No package snapd-2.47.1-1.amzn2.1 available I then tried to find the newest version at https://people.canonical.com/~mvo/snapd/amazon-linux2/repo/sources/packages/ and tried to install $ sudo yum install snapd-2.51-1.amzn2.1 but same result. I am using Amazon Linux 2 with centos rhel fedora. Could you help me sort out this issue? I would be very grateful :slight_smile: Thanks already!

Do you have EPEL enabled on your machine?

Edit:

Checked on my AMZN2 system, things seem to work ok:

google:amazon-linux-2-64 /# yum repolist
Loaded plugins: langpacks, priorities, update-motd
216 packages excluded due to repository priority protections
repo id                                                                         repo name                                                                                             status
amzn2-core/2/x86_64                                                             Amazon Linux 2 core repository                                                                            25526
amzn2extra-epel/2/x86_64                                                        Amazon Extras repo for epel                                                                                   1
epel/x86_64                                                                     Extra Packages for Enterprise Linux 7 - x86_64                                                        13403+216
snapd-amzn2/x86_64                                                              snapd packages for Amazon Linux 2                                                                             4
repolist: 38934

And a snapd from that repo is properly listed:

google:amazon-linux-2-64 /# yum list snapd\*
Loaded plugins: langpacks, priorities, update-motd
216 packages excluded due to repository priority protections
Available Packages
snapd.x86_64                                                                                  2.51-1.el7                                                                            epel       
snapd-debuginfo.x86_64                                                                        2.51-1.amzn2.1                                                                        snapd-amzn2
snapd-devel.noarch                                                                            2.51-1.el7                                                                            epel       
snapd-glib.x86_64                                                                             1.58-1.el7                                                                            epel       
snapd-glib-devel.x86_64                                                                       1.58-1.el7                                                                            epel       
snapd-glib-tests.x86_64                                                                       1.58-1.el7                                                                            epel       
snapd-qt.x86_64                                                                               1.58-1.el7                                                                            epel       
snapd-qt-devel.x86_64                                                                         1.58-1.el7                                                                            epel       
snapd-qt-qml.x86_64                                                                           1.58-1.el7                                                                            epel       
snapd-qt-tests.x86_64                                                                         1.58-1.el7                                                                            epel       
snapd-selinux.noarch                                                                          2.51-1.el7                                                                            epel       

As mentioned before, you can install it passing the complete version information:

google:amazon-linux-2-64 /# yum install snapd-2.51-1.amzn2.1
Loaded plugins: langpacks, priorities, update-motd
216 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package snapd.x86_64 0:2.51-1.amzn2.1 will be installed
--> Processing Dependency: snap-confine(x86-64) = 2.51-1.amzn2.1 for package: snapd-2.51-1.amzn2.1.x86_64
--> Running transaction check
---> Package snap-confine.x86_64 0:2.51-1.amzn2.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                        Arch                                     Version                                           Repository                                     Size
===============================================================================================================================================================================================
Installing:
 snapd                                          x86_64                                   2.51-1.amzn2.1                                    snapd-amzn2                                    16 M
Installing for dependencies:
 snap-confine                                   x86_64                                   2.51-1.amzn2.1                                    snapd-amzn2                                   2.8 M

Transaction Summary
===============================================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 18 M
Installed size: 52 M
Is this ok [y/d/N]: ^C

Hey, thanks for the super fast answer. Unfortunately it is still not working.
I tried your commands and got this:
Epel seems to be enabled:

(base) [ec2-user@ip-10-0-0-89 ~]$ yum repolist
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
217 packages excluded due to repository priority protections
repo id                                                                                                                 repo name                                                                                                                                    status
amzn2-core/2/x86_64                                                                                                     Amazon Linux 2 core repository                                                                                                                   25,526
amzn2extra-docker/2/x86_64                                                                                              Amazon Extras repo for docker                                                                                                                        42
amzn2extra-epel/2/x86_64                                                                                                Amazon Extras repo for epel                                                                                                                           1
epel/x86_64                                                                                                             Extra Packages for Enterprise Linux 7 - x86_64                                                                                               13,404+217
repolist: 38,973

Listing snapd results in this:

(base) [ec2-user@ip-10-0-0-89 ~]$ yum list snapd\*
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
217 packages excluded due to repository priority protections
Available Packages
snapd.x86_64                                                                                                                                2.51-1.el7                                                                                                                     epel
snapd-devel.noarch                                                                                                                          2.51-1.el7                                                                                                                     epel
snapd-glib.x86_64                                                                                                                           1.58-1.el7                                                                                                                     epel
snapd-glib-devel.x86_64                                                                                                                     1.58-1.el7                                                                                                                     epel
snapd-glib-tests.x86_64                                                                                                                     1.58-1.el7                                                                                                                     epel
snapd-qt.x86_64                                                                                                                             1.58-1.el7                                                                                                                     epel
snapd-qt-devel.x86_64                                                                                                                       1.58-1.el7                                                                                                                     epel
snapd-qt-qml.x86_64                                                                                                                         1.58-1.el7                                                                                                                     epel
snapd-qt-tests.x86_64                                                                                                                       1.58-1.el7                                                                                                                     epel
snapd-selinux.noarch                                                                                                                        2.51-1.el7                                                                                                                     epel

But still not able to download it:

(base) [ec2-user@ip-10-0-0-89 ~]$ sudo yum install snapd-2.51-1.amzn2.1
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
217 packages excluded due to repository priority protections
No package snapd-2.51-1.amzn2.1 available.
Error: Nothing to do

Can you spot my mistake?
Here is my system information:

(base) [ec2-user@ip-10-0-0-89 ~]$ cat /etc/*release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
Amazon Linux release 2 (Karoo)

Thanks for taking so much time to help me!

You need to add the snapd repository which is linked at the very top. The version of snapd from EPEL is built against RHEL repositories, but AMZN2 repositories are outdated and thus the package cannot be installed.

Just cd /etc/yum.repos.d && wget https://people.canonical.com/~mvo/snapd/amazon-linux2/snapd-amzn2.repo.

Ah well I missed that, it works now, thank you very much! Have a great day!

I’m using Amazon Linux 2 on Aarch64.

So if you could create a repository for Aarch64, I would be very happy.

AFAICT Amazon Linux 2 aarch 64 images are not available for download and I don’t have an instance. You can always grab the srpm from the repository and build it yourself. https://people.canonical.com/~mvo/snapd/amazon-linux2/repo/sources/packages/snapd-2.51-1.amzn2.1.src.rpm

The packages have been updated to 2.53.2.

Hi,

Can you please improve on the systemd service by adding EnvironmentFile=-/etc/environment I have to manually add them back each time after the rpm updated as my servers are behind a proxy.

Or should a request be logged on the snapd github?

The packages use /etc/sysconfig/snapd which is what is expected of any package coming from Fedora/EPEL. The packages provided in the repository are a rebuild of what is available in EPEL, but with SELinux disabled (as Amazon’s own repositories provide outdated versions of selinux policy). I intend to keep them as close as possible to what is in EPEL.

As an admin you can drop a *.conf override file in /etc/systemd/system/snapd.service.d/ directory with the following content:

[Service]
Environment=-/etc/environment

Which also means you don’t have to edit anything after updating the packages.

1 Like

Thank you! This works great!

Just created an account here to thank you @mborzecki ! Cheers !

@mborzecki Is the repo for AMZN2 being continuously updated? Last updated was in November last year.

Yes, I’ll be pushing the update to 2.54.3 soon.

1 Like

Sorry for the delay. The 2.54.3 packages have been uploaded.