3

Wondering why I'm unable to install snap packages, while in software center and using sudo snap install .... It gives me an error and I'm unable to discern what's causing it nor am I able to find others with the same issue.

software center error

So when I try to install it using terminal, I get the full error:

~$ sudo snap install pycharm-community --classic
error: cannot perform the following tasks:
- Download snap "pycharm-community" (103) from channel "stable" (cannot read device key pair: cannot find key pair)

This is happening with every package I attempt to install, I'm just showing PyCharm as an example. Any pointers or anyone having the same issue that's found a resolution?

Update:

I have checked /var/lib/snapd/device/private-keys-v1 and it contains nothing.

I also ran:

sudo snap refresh core --edge

And got this error:

error: cannot perform the following tasks:
- Download snap "core" (6990) from channel "edge" (cannot read device key pair: cannot find key pair)

I am unsure if I need to install from a repo or how to correctly install it.

Jab
  • 83

2 Answers2

2

Simply purge as described here with

sudo apt autoremove --purge snapd

Then install

sudo apt install snapd snapd-xdg-open

Sources:

How can I safely remove snap without breaking apparmor

https://websiteforstudents.com/how-to-install-pycharm-on-ubuntu-16-04-17-10-and-18-04/

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • 1
    Damn!! I missed the bounty. I should have written my comment as an answer. – Kulfy May 11 '19 at 11:39
  • Doing this will of course remove all of your snap packages. I don't know why I even considered doing it. This answer is very dangerous. And why installing snapd-xdg-open instead of snapd? – bomben Sep 24 '21 at 17:39
  • @bomben To the best of my knowledge snapd-xdg-open is A D-Bus-activatable helper service allowing snaps to launch URLs on the host where its installed. If you actually parse the command provided you'll see it's installing snapd as well as snapd-xdg-open, not INSTEAD of. – Elder Geek Oct 01 '21 at 22:37
0

Try to check /var/lib/snapd/device/private-keys-v1 directory.

In my case it was empty. I was unable to find the key generation command, so as a workaround I copied private key from that directory of another system and it worked.

However, I'm not sure it's the best possible solution. Try snap apps now won't start with "cannot perform readlinkat()" error answer before using the workaround. I wanted to test it, but I couldn't reproduce key absence again (by renaming private-keys-v1 dir).