Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap fails to build on Ubuntu 20.04 (multipass problem) #83

Closed
3 tasks done
ghost opened this issue Jul 21, 2020 · 9 comments
Closed
3 tasks done

Snap fails to build on Ubuntu 20.04 (multipass problem) #83

ghost opened this issue Jul 21, 2020 · 9 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jul 21, 2020

Preflight Checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Issue Details

  • Electron Forge Version:
    • 6.0.0-beta.52
  • Electron Version:
    • 9.1.1
  • Operating System:
    • Ubuntu 20.04 LTS x64
  • Last Known Working Electron Forge version::
    • None

Expected Behavior

Builds the {app's name}.snap in out/make/snap/x64.

Actual Behavior

I've configured build to .deb, zip and snap. They build sucefully except snap, which gives this error:

✖ Making for target: snap - On platform: linux - For arch: x64

An unhandled error has occurred inside Forge:
An error occured while making for target: snap
Command failed with a non-zero return code (2):
/snap/bin/snapcraft snap --target-arch=amd64 --output=/home/user/app/out/make/snap/x64/app_1.0.0_amd64.snap
Error: Command failed with a non-zero return code (2):
/snap/bin/snapcraft snap --target-arch=amd64 --output=/home/user/app/out/make/snap/x64/app_1.0.0_amd64.snap
    at ChildProcess.<anonymous> (/home/user/app/node_modules/@malept/cross-spawn-promise/src/index.ts:155:16)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:482:12)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

As you see, this error says nothing.
I know it seems fixed in electron/forge#1531, but snapcraft apt package has been depercated (maybe because it now uses Multipass snap).

To Reproduce

Repo:
https://github.com/humanoide123/app
Clone, yarn install and yarn run make (or do the same with npm)
Manual:

  • Get Ubuntu 20,04 (seems to work on older versions which have the snapcraft apt package)
  • Run yarn create electron-app app-name --template=typescript-webpack (I'm using yarn, but guess it's not important)
  • Install @electron-forge/maker-snap as devDependency (yarn add -D @electron-forge/maker-snap)
  • Add the following to package.json:
{
  name: '@electron-forge/maker-snap'
  config: {
    summary: 'Pretty Awesome'
  }
}
  • Run yarn run make or node_modules/bin/electron-forge make

Additional Information

  • Run with debug enabled outputs this:
 Making for target: snap - On platform: linux - For arch: x64An error occurred with the instance when trying to delete with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
✖ Making for target: snap - On platform: linux - For arch: x64
An unhandled error has occurred inside Forge:
An error occured while making for target: snap
Command failed with a non-zero return code (2):
/snap/bin/snapcraft snap --target-arch=amd64 --output=/home/user/app/out/make/snap/x64/app_1.0.0_amd64.snap
Error: Command failed with a non-zero return code (2):
/snap/bin/snapcraft snap --target-arch=amd64 --output=/home/user/app/out/make/snap/x64/app_1.0.0_amd64.snap
    at ChildProcess.<anonymous> (/home/user/app/node_modules/@malept/cross-spawn-promise/src/index.ts:155:16)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:482:12)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

It seems not important except for the message "An error ocurred with the instance... Ensure that Multipass is setup correctly and try again". Seems like a problem when invoking Multipass (i've already used snapcraft on another project, so I'm sure Multipass problem is not mine)

  • Forge configuration in package.json:
"forge": {
      "packagerConfig": {
        "executableName": "app"
      },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin",
            "linux"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-snap",
          "config": {
            "summary": "lorem ipsum dominum"
          }
        }
      ],
      "plugins": [
        [
          "@electron-forge/plugin-webpack",
          {
            "mainConfig": "./webpack.main.config.js",
            "renderer": {
              "config": "./webpack.renderer.config.js",
              "entryPoints": [
                {
                  "html": "./src/index.html",
                  "js": "./src/renderer.ts",
                  "name": "main_window"
                }
              ]
            }
          }
        ]
      ]
    }
@malept
Copy link
Member

malept commented Jul 21, 2020

I would suggest using an Ubuntu 18.04 container (e.g. malept/electron-forge-container:node-10) until a solution is found. Unfortunately, I don't have much free time available to debug why the version of snapcraft from Ubuntu 20.04 doesn't work.

@malept malept transferred this issue from electron/forge Jul 22, 2020
@welcome
Copy link

welcome bot commented Jul 22, 2020

👋 Thanks for opening your first issue here! If you have a question about using electron-installer-snap, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@malept
Copy link
Member

malept commented Jul 22, 2020

Since this is really an electron-installer-snap issue, I've moved it to that repository.

@ghost
Copy link
Author

ghost commented Jul 22, 2020

Ok, I can wait.
For me, seems like a problem because of the differences between Apt's (deprecated) snapcraft and snap's snapcraft. Snaps are very different from .debs. Snaps mount something like their own system (under /snap/{snap-name}), so maybe it's calling Multipass in a wrong place.
I'm gonna look at the code. Maybe can help :)

@markibanez
Copy link

Same error on Ubuntu 19.10

@davidwinter
Copy link

davidwinter commented Nov 29, 2020

I'm experiencing this same issue on Ubuntu 20.10. I've migrated from electron-builder which was able to build snap artefacts fine. Not working at all with electron-forge.

I have snapcraft 4.4.2 installed via snap.

Electron Forge Version:

6.0.0-beta.54

Electron Version:

11.0.2

Operating System:

Ubuntu 20.10 x64

@davidwinter
Copy link

@markibanez would suggest looking at this package that I've created as this one appears to not be maintained anymore: https://github.com/davidwinter/electron-forge-maker-snap

@abulka
Copy link

abulka commented Jun 23, 2021

I'm unable to build snaps on either 18.04 or 20.04 - see electron/forge#1652 (comment)

Is this project being maintained? Is there any further diagnostic information I can send that would help?

@davidwinter
Copy link

@abulka would suggest looking at this package that I've created as this one appears to not be maintained anymore: https://github.com/davidwinter/electron-forge-maker-snap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants