Not able to install snapd Fedora 35

[user00@fedora ~]$ sudo dnf install snapd
Last metadata expiration check: 0:47:54 ago on Mon 21 Mar 2022 06:15:01 PM PDT.
Dependencies resolved.
================================================================================
 Package             Architecture  Version                 Repository      Size
================================================================================
Installing:
 snapd               x86_64        2.54.4-1.fc35           updates         14 M
Installing dependencies:
 snap-confine        x86_64        2.54.4-1.fc35           updates        2.3 M

Transaction Summary
================================================================================
Install  2 Packages

Total download size: 16 M
Installed size: 63 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): snap-confine-2.54.4-1.fc35.x86_64.rpm    2.4 MB/s | 2.3 MB     00:00    
(2/2): snapd-2.54.4-1.fc35.x86_64.rpm           6.7 MB/s |  14 MB     00:02    
--------------------------------------------------------------------------------
Total                                           6.5 MB/s |  16 MB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : snap-confine-2.54.4-1.fc35.x86_64                      1/2 
error: lsetfilecon: (/usr/libexec/snapd/snap-confine;62392e58, system_u:object_r:snappy_confine_exec_t:s0) Invalid argument
error: Plugin selinux: hook fsm_file_prepare failed

Error unpacking rpm package snap-confine-2.54.4-1.fc35.x86_64
  Installing       : snapd-2.54.4-1.fc35.x86_64                             2/2 
error: unpacking of archive failed on file /usr/libexec/snapd/snap-confine;62392e58: cpio: (error 0x2)
error: snap-confine-2.54.4-1.fc35.x86_64: install failed

Error unpacking rpm package snapd-2.54.4-1.fc35.x86_64
  Verifying        : snap-confine-2.54.4-1.fc35.x86_64                      1/2 
  Verifying        : snapd-2.54.4-1.fc35.x86_64                             2/2 

Failed:
  snap-confine-2.54.4-1.fc35.x86_64          snapd-2.54.4-1.fc35.x86_64         

Error: Transaction failed
[user00@fedora ~]$ sudo dnf remove snapd
[sudo] password for user00: 
No match for argument: snapd
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!
[user00@fedora ~]$

2 Likes

sudo dnf update
then
I install snap follow guide from this link:
https://snapcraft.io/docs/installing-snap-on-fedora

https://www.cyberciti.biz/faq/install-snapd-on-fedora-linux-system-dnf-command/

$ snap list
Name  Version    Rev    Tracking       Publisher   Notes
core  16-2.54.4  12821  latest/stable  canonicalâś“  core
$ snap --version
snap    2.54.4-1.fc35
snapd   2.54.4-1.fc35
series  16
fedora  35
kernel  5.16.15-201.fc35.x86_64

Hi @trihoang8 , welcome to the community! Please take a look at the introductory posts in the #start-here category if you’ve not had a chance to do so yet.

I don’t see a bug about this in the bug list, and it installed fine on my F35 (and F36) system here. On my system, it installed 3 packages, though: snapd snap-confine snap-selinux.

$ sudo dnf install snapd
[sudo] password for asinha: 
Last metadata expiration check: 3:23:24 ago on Tue 22 Mar 2022 05:34:14 GMT.
Dependencies resolved.
========================================================================================================================================
 Package                            Architecture                Version                              Repository                    Size
========================================================================================================================================
Installing:
 snapd                              x86_64                      2.54.4-1.fc35                        updates                       14 M
Installing dependencies:
 snap-confine                       x86_64                      2.54.4-1.fc35                        updates                      2.3 M
 snapd-selinux                      noarch                      2.54.4-1.fc35                        updates                      232 k

Transaction Summary
========================================================================================================================================
Install  3 Packages

Total download size: 16 M
Installed size: 63 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): snapd-selinux-2.54.4-1.fc35.noarch.rpm                                                           3.1 MB/s | 232 kB     00:00    
(2/3): snap-confine-2.54.4-1.fc35.x86_64.rpm                                                             17 MB/s | 2.3 MB     00:00    
(3/3): snapd-2.54.4-1.fc35.x86_64.rpm                                                                    48 MB/s |  14 MB     00:00    
----------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                    39 MB/s |  16 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                1/1 
  Running scriptlet: snapd-selinux-2.54.4-1.fc35.noarch                                                                             1/3 
  Installing       : snapd-selinux-2.54.4-1.fc35.noarch                                                                             1/3 
  Running scriptlet: snapd-selinux-2.54.4-1.fc35.noarch                                                                             1/3 
  Installing       : snap-confine-2.54.4-1.fc35.x86_64                                                                              2/3 
  Installing       : snapd-2.54.4-1.fc35.x86_64                                                                                     3/3 
  Running scriptlet: snapd-2.54.4-1.fc35.x86_64                                                                                     3/3 
Created symlink /etc/systemd/system/sockets.target.wants/snapd.socket → /usr/lib/systemd/system/snapd.socket.
Created symlink /etc/systemd/user/sockets.target.wants/snapd.session-agent.socket → /usr/lib/systemd/user/snapd.session-agent.socket.

  Running scriptlet: snapd-selinux-2.54.4-1.fc35.noarch                                                                             3/3 
  Running scriptlet: snapd-2.54.4-1.fc35.x86_64                                                                                     3/3 
  Verifying        : snap-confine-2.54.4-1.fc35.x86_64                                                                              1/3 
  Verifying        : snapd-2.54.4-1.fc35.x86_64                                                                                     2/3 
  Verifying        : snapd-selinux-2.54.4-1.fc35.noarch                                                                             3/3 

Installed:
  snap-confine-2.54.4-1.fc35.x86_64              snapd-2.54.4-1.fc35.x86_64              snapd-selinux-2.54.4-1.fc35.noarch             

Complete!

Have you made any changes to your dnf configuration that is preventing the selinux package from being installed?

2 Likes

Thank you for responding Afiadi. I think I’m going to reinstall if I can’t get it figured out in a few days…

[user00@fedora ~]$ sudo dnf update
[sudo] password for user00:
Fedora 35 - x86_64 - Updates 20 kB/s | 8.0 kB 00:00
Fedora 35 - x86_64 - Updates 1.3 MB/s | 3.5 MB 00:02
Fedora Modular 35 - x86_64 - Updates 44 kB/s | 15 kB 00:00
Dependencies resolved.

snapd and snap-confine both have snap-selinux as a Requires in the spec, so I can only assume that snapd-selinux was somehow already installed beforehand and separate from the other snapd programs. It could be that it was successfully installed in a previous attempt but snapd and snap-confine were left uninstalled when the cpio error happened.

The cpio error seems to indicate that either the downloaded RPM was corrupt (unlikely) or that something funny is happening on the filesystem, such as perhaps a directory exists where RPM is trying to install a file, etc. I notice that these “guides” seem to ask you to symlink to /snap but I’m wondering if snap-confine is trying to set that directory up for you but can’t because of the existing, unexpected symlink. If you made that symlink to /snap already, you might try removing it and then try installing snapd again with dnf.

1 Like

I’m a noob just moved away from Windows to Linux two weeks ago. Yes you are correct on your first paragraph; snap was working prior and snap apps was installed; I will look into how to remove the symlink to /snap as and reinstalling snapd. Thank you much Scott!

2 Likes

Thank you Ankur for responding. It was working fine until I messed it up. Did not made changes to dnf. This is good learning for me since I moved away from Windows to Linux two weeks ago. Thank you again.

2 Likes

No worries. In general, it’s not good to mix dnf based packages with software installed using other methods—compiling from source or from installer binaries/scripts and so on.

The packages we receive using dnf from the standard Fedora (and RPM Fusion repos if enabled) have been tested to work well with all the packages that these repositories provide—this is what distributions do pretty much. The same cannot be said of other third party repositories/sources—one must check these each time to verify.

Next, packages from the standard repos will always install in the correct locations—we use the Filesystem Hierarchy Standard:

https://www.pathname.com/fhs/

https://docs.fedoraproject.org/en-US/packaging-guidelines/#_filesystem_layout

So anything else should not be installed in these standard directories because it will mess with the system package files. The most common scenario is to install stuff in an alternative file system hierarchy under /opt. That way we don’t mess with the standard system files. (For programming and software development, most languages now permit virtual environments where packages of various versions can be installed without affecting/overwriting/conflicting with system packages.)

The last note I have is that it’s generally a good idea to keep /home on a different partition. That way when we’re experimenting if stuff breaks, a reinstall fixes it and you just re-use your user folder in /home by creating the same user during the reinstall. So all the user specific settings and data is reused.

1 Like

Thank you much Ankur!

2 Likes