question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with .snap files

See original GitHub issue

Describe the bug For some reason, I cannot install .snap files built with electron-builder:

yarn electron:build
sudo snap install --dangerous dist_electron/app-name_1.0.0_amd64.snap

I get the following error:

error: cannot install snap file: snap is unusable due to bad permissions; contact developer

I’ve never built / installed .snap files before, so I’m not sure if I’m doing it right or not. I manually changed permissions of the snap file to read & write and selected Allow executing file as program and then tried to install it again, but I got the same error.

Then I ran journalctl -u snapd and here’s the last line from it, not sure if that’s what causes the problem:

loka 12 14:59:25 name-VirtualBox snapd[546]: container.go:199: in snap "app-name": "meta/gui/icon.png" should be world-readable, and isn'

Someone opened a similar issue in the electron-builder’s repo: https://github.com/electron-userland/electron-builder/issues/5067 But my problem is I get the error trying to install the .snap, so even though it gets built successfully, clearly there’s something wrong with the build config and I’m not sure if it’s a problem with vue-cli-plugin-electron-builder or electron-builder or if it’s something I’m doing wrong.

vue.config.js

...
builderOptions: {
  icon: 'build/icon.png',
  snap: {
    confinement: 'devmode',
    grade: 'devel'
  },
  linux: {
    target: 'snap',
    icon: 'build/icon.png',
    category: 'system',
    maintainer: 'name'
  }
  ...
}
...

Build log

 INFO  Building app with electron-builder:
  • electron-builder  version=21.2.0 os=5.4.0-48-generic
  • writing effective config  file=dist_electron/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=diskusage@1.1.3, xxhash-addon@1.3.0 platform=linux arch=x64
  • rebuilding native dependency  name=diskusage version=1.1.3
  • rebuilding native dependency  name=xxhash-addon version=1.3.0
  • packaging       platform=linux arch=x64 electron=10.1.3 appOutDir=dist_electron/linux-unpacked
  • building        target=snap arch=x64 file=dist_electron/app-name_1.0.0_amd64.snap
 DONE  Build complete!

Environment:

  • OS: Ubuntu 20.04 x64
  • electron: 10.1.3
  • vue-cli-plugin-electron-builder: 1.4.6 (the issue occurs in the latest 2.0.0-rc.4 as well)

Relevant docs:

Snapcraft: https://snapcraft.io/docs/electron-apps Electron-builder: https://www.electron.build/configuration/snap

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nklaymancommented, Oct 18, 2020

Okay, thanks for testing that. I’ve been pretty busy lately but when I get the chance I’ll test the snap target myself and see if I can figure out what is going wrong.

0reactions
aleksey-hoffmancommented, Oct 30, 2020

@nklayman thanks for testing it, mate. I tried that. Turns out, in my case, the cause of the problem had nothing to do with the config properties themselves. For some unimaginable reason, the icon that I specified build/icon.png in the config had some read permissions denied (only on Ubuntu as well).

I just changed all the file’s permissions to read & write, and it got installed successfully after that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | Snapcraft documentation
Troubleshooting ; Connection refused error, Slow snap downloads ; Missing binaries, Home directory location ; Domain served /home directories, chmod errors ; Too ......
Read more >
The problem with snaps is that they are a stupid way to ...
First off snap packages don't waste a lot of disk space because they avoid duplication of shared dependencies by using file hashes. Snap...
Read more >
How to deal with *.snap files if it shows "cannot remove active ...
I have successfully removed 2 similar snap files using the snap remove command. It's these two files that cause problems.
Read more >
anbox: snap is unusable due to missing files - linux - Super User
Your Answer. Thanks for contributing an answer to Super User! Please be sure to answer the question. Provide details and share your research!...
Read more >
Why I Have a Problem with Snaps - YouTube
Why do I dislike Snaps ? What is the problem with Ubuntu packaging apt software with snaps ? Which of the package programs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found