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

Launch Hanging on Ubuntu when snap version of Chromium is installed #7020

Closed
bhayward93 opened this issue Apr 15, 2020 · 22 comments · Fixed by #7039
Closed

Launch Hanging on Ubuntu when snap version of Chromium is installed #7020

bhayward93 opened this issue Apr 15, 2020 · 22 comments · Fixed by #7039
Labels

Comments

@bhayward93
Copy link

Current behavior:

cypress open does not open Cypress.
cypress run just seems to hang.

Logs:
https://pastebin.com/ULZwQEj8

Snapshot of behavior and logs:
https://files.gitter.im/cypress-io/cypress/g4g2/image.png

System:
image

Desired behavior:

Should be able to run tests.

Test code to reproduce

As this is happening prior to Cypress running I don't think its anything I can give reproduction steps for.

DEBUG=* $(npm bin)/cypress open
DEBUG=* $(npm bin)/cypress run

Are the commands I am running.

Versions

v4.3.0 and v4.4.0

@DieterE
Copy link

DieterE commented Apr 16, 2020

Same problem here. Happened after Ubuntu wanted to update so perhaps the list of last updated packages can be helpful:

cat /var/log/dpkg.log | grep " installed" | grep 2020-04-15
2020-04-15 18:32:56 status installed libssh-gcrypt-4:amd64 0.9.0-1ubuntu1.4
2020-04-15 18:32:57 status installed libssh-4:amd64 0.9.0-1ubuntu1.4
2020-04-15 18:32:57 status installed git-man:all 1:2.20.1-2ubuntu1.19.10.2
2020-04-15 18:32:57 status installed containerd:amd64 1.3.3-0ubuntu1~19.10.2
2020-04-15 18:32:58 status installed git:amd64 1:2.20.1-2ubuntu1.19.10.2
2020-04-15 18:33:03 status installed man-db:amd64 2.8.7-3
2020-04-15 18:33:03 status installed libc-bin:amd64 2.30-0ubuntu2.1
2020-04-15 18:55:28 status installed libxapian30:amd64 1.4.12-1
2020-04-15 18:55:28 status installed libept1.5.90:amd64 1.1+nmu3ubuntu1
2020-04-15 18:55:29 status installed synaptic:amd64 0.84.6ubuntu3
2020-04-15 18:55:29 status installed mime-support:all 3.63ubuntu1
2020-04-15 18:55:29 status installed hicolor-icon-theme:all 0.17-2
2020-04-15 18:55:29 status installed gnome-menus:amd64 3.32.0-1ubuntu1
2020-04-15 18:55:30 status installed libc-bin:amd64 2.30-0ubuntu2.1
2020-04-15 18:55:31 status installed man-db:amd64 2.8.7-3
2020-04-15 18:55:31 status installed desktop-file-utils:amd64 0.24-1ubuntu1
2020-04-15 21:38:54 status installed google-chrome-stable:amd64 81.0.4044.113-1
2020-04-15 21:38:54 status installed mime-support:all 3.63ubuntu1
2020-04-15 21:38:54 status installed gnome-menus:amd64 3.32.0-1ubuntu1
2020-04-15 21:38:56 status installed man-db:amd64 2.8.7-3
2020-04-15 21:38:56 status installed desktop-file-utils:amd64 0.24-1ubuntu1
2020-04-15 22:24:27 status installed libasound2-data:all 1.1.9-0ubuntu1.3
2020-04-15 22:24:27 status installed libasound2:amd64 1.1.9-0ubuntu1.3
2020-04-15 22:24:28 status installed libc-bin:amd64 2.30-0ubuntu2.1
2020-04-15 23:21:46 status installed docker.io:amd64 19.03.6-0ubuntu1~19.10.1
2020-04-15 23:21:49 status installed containerd:amd64 1.3.3-0ubuntu1~19.10.2
2020-04-15 23:21:51 status installed man-db:amd64 2.8.7-3
2020-04-15 23:44:49 status installed chromium-browser-l10n:all 79.0.3945.79-0ubuntu0.19.10.2
2020-04-15 23:44:50 status installed chromium-browser:amd64 79.0.3945.79-0ubuntu0.19.10.2
2020-04-15 23:44:54 status installed mime-support:all 3.63ubuntu1
2020-04-15 23:44:54 status installed hicolor-icon-theme:all 0.17-2
2020-04-15 23:44:54 status installed gnome-menus:amd64 3.32.0-1ubuntu1
2020-04-15 23:44:54 status installed desktop-file-utils:amd64 0.24-1ubuntu1
2020-04-15 23:45:54 status installed google-chrome-stable:amd64 81.0.4044.113-1
2020-04-15 23:45:55 status installed mime-support:all 3.63ubuntu1
2020-04-15 23:45:55 status installed gnome-menus:amd64 3.32.0-1ubuntu1
2020-04-15 23:45:56 status installed man-db:amd64 2.8.7-3
2020-04-15 23:45:56 status installed desktop-file-utils:amd64 0.24-1ubuntu1

And as OP I'm on:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan

Normally I'd roll back the packages and be on my marry way but it seems apt does not support this, so I'll be moving on to a more stable distro. I'll keep this install around if any further testing is needed though.

@Lektro9
Copy link

Lektro9 commented Apr 16, 2020

I am also experiencing this issue, but I am using ubuntu 18.04.
For some reason cypress runs in my visual studio code, but not in Intellij/normal Terminal. Not sure why that is ...

Edit: After installing chromium it started to work again (was using google chrome before). Not sure if we have the same issue here, as DieterE has already installed chromium as you can see in the updated packages.

Edit2: I actually first uninstalled chromium from snapd and reinstalled with apt.

@jbpallingayan
Copy link

jbpallingayan commented Apr 16, 2020

stuck today on my work. i refresh everything but none of that resolve the issue. please help @bahmutov @jennifer-shehane

Fixed it by removing chromium browser on my laptop

@marinsagovac
Copy link

marinsagovac commented Apr 16, 2020

I also have that issue:

  • tried npm cache clean
  • xvfb reset
  • reinstall packages

Similar issue that I reported: #7027

Removed chromium from snapd and regular apt and now is worked.

@erosval
Copy link

erosval commented Apr 16, 2020

Thanks for reporting the problem, I have the same issue on my workstation.

I think removing Chromium is just a way to get around this, I think we need a fix.

In any case, I still haven't understood what the problem is, Chromium or cypress? Does anyone know?

@vteremasov
Copy link

vteremasov commented Apr 16, 2020

Thanks for the report. In my case: ubuntu 19.10 the same problem. Removing Chromium didn't help. Is there any progress on it?

UPD:

Removing Chromium actually helps. Forgot to remvoe it from snap package

@flotwig
Copy link
Contributor

flotwig commented Apr 16, 2020

I can reproduce this by installing Chromium as a snap instead of via apt.

Workaround:

Install Chromium via apt (apt install chromium-browser) instead

@c32hedge
Copy link

In my case, on Ubuntu 18.04, the test launcher window would open using cypress open, but would just sit there with no tests and a spinner indefinitely. I confirmed that Cypress launched as expected after uninstalling Chromium (it was installed as a snap).

@c32hedge
Copy link

One of my colleagues saw the following output in his Visual Studio Code terminal after running cypress open (also on Ubuntu 18.04 with Chromium installed as a snap):

[22587:0416/200905.090092:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id

@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs investigating Someone from Cypress needs to look at this labels Apr 16, 2020
@flotwig
Copy link
Contributor

flotwig commented Apr 16, 2020

I've managed to fix the browser detection in #7039; however, when launching Chromium as a snap, it exits because of permission issues writing to the Cypress profile dir:

[20417:20417:0416/114702.946821:ERROR:process_singleton_posix.cc(280)] Failed to create /home/flotwig/.config/Cypress/cy/development/browsers/chromium-stable/interactive/SingletonLock: Permission denied (13)
[20417:20417:0416/114702.946937:ERROR:chrome_browser_main.cc(1408)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start multiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption.

Guessing that this is because the snap's sandboxing only allows it to write to certain locations, and the Cypress profile dir falls outside of those locations. Anyone know how to change the locations the snap is allowed to access?

@erosval
Copy link

erosval commented Apr 16, 2020

Is it possible to run cypress without chromium (even if installed with snap) and possibly report the problem with a message on the UI?

Why is the error present even when I execute cypress with the run --browser firefox command?

@flotwig
Copy link
Contributor

flotwig commented Apr 16, 2020

Why is the error present even when I execute cypress with the run --browser firefox command?

@erosval Internally, that command runs the regular browser detection and then filters "firefox" from the list of detected browsers, so it hangs in the same place. It should probably be optimized to only lookup browsers matching the passed flag.

Try passing --browser /absolute/path/to/firefox to launch by a path directly, it might work since it should bypass browser detection entirely.


Is it possible to run cypress without chromium (even if installed with snap) and possibly report the problem with a message on the UI?

Yeah, in the meantime, Cypress could still detect the Snap version of Chromium, and add a warning to it in the GUI that it may fail to launch. But I'd like to do some investigation to see if there's an easy way for users to fix this... for example, if it's possible to whitelist the Cypress profile dir manually, which would be like a one-time fix we can document and point users to.

@bhayward93
Copy link
Author

bhayward93 commented Apr 16, 2020

Also solved by uninstalling the snap version of Chromium. Thanks @Lektro9 & @jbpallingayan.

@flotwig flotwig changed the title Launch Hanging on Ubuntu Launch Hanging when snap version of Chromium is installed Apr 16, 2020
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Apr 16, 2020
@jennifer-shehane jennifer-shehane changed the title Launch Hanging when snap version of Chromium is installed Launch Hanging on Ubuntu when snap version of Chromium is installed Apr 17, 2020
@ghost
Copy link

ghost commented Apr 17, 2020

Seems the apt version of chromium is updated now too :( Mine is installed using apt, as exposes the same behavior

@flotwig
Copy link
Contributor

flotwig commented Apr 17, 2020

Looks like in Ubuntu 19.10, the developers started shipping apt install chromium as a snap: https://askubuntu.com/a/1185098/844221

There's a link to this PPA which can be used to install Chromium as a regular binary, as a workaround: https://launchpad.net/~saiarcot895/+archive/ubuntu/chromium-dev


Side note: I use a fork of Ubuntu called Pop_OS, I am also on 19.10 but it seems like my chromium package is sourced from Pop_OS, which is why I'm still seeing the binary when installing from apt:

Get:1 http://ppa.launchpad.net/system76/pop/ubuntu eoan/main amd64 chromium amd64 79.0.3945.130-1~deb10u1~19.10~pop2 [57.8 MB]

@ghost
Copy link

ghost commented Apr 17, 2020

For those on Ubuntu 19.10 and above who doesn't want to use a ppa there's a pure snap based solution too.

First close chromium and chromium.launcher then change the channel on snap:

$ sudo snap save chromium # optional, backup
$ sudo snap switch --beta chromium
$ sudo snap refresh chromium

Edit: looks like my workaround was a one-off on my machine, so the PPA suggested earlier is probably a safer bet.

A possibly useful comment from TheLukeMcCarthy on Stack Overflow:

"I uninstalled Chromium and re-installed using apt. It didn't remove the snap link in /usr/local/bin/chromium-browser so it seemed to reinstall snap chromium when I run cypress. I finally got it to work when I uninstalled chromium, manually deleted the link /usr/local/bin/chromium-browser installed Chromium with apt when manually create the link /usr/local/bin/chromium-browser again"

@Anomen
Copy link

Anomen commented Apr 18, 2020

Hello everyone,

Just to let you know that removing chromium from snap solved my issue.
Ubuntu 19.10 here.

@ghost
Copy link

ghost commented Apr 19, 2020

@Anomen are you running without Chromium on your system, then?

@Anomen
Copy link

Anomen commented Apr 19, 2020

Yes, I use Chrome, not Chromium-browser. Sometimes I liked having chromium for a few tests, but since I haven't used it for a long time, it doesn't bother me to uninstall it.

The command that I ran to remove chromium was: sudo snap remove chromium

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 20, 2020

The code for this is done in cypress-io/cypress#7039, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Apr 20, 2020
@ghost
Copy link

ghost commented Apr 20, 2020

And a workaround that doesn't require any changes in packages, change the path for the command until the patch is on npm:

For fish shells:

env PATH="/home/rohdef/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin /usr/bin:/sbin:/bin" nom run ...

for bash and similar:

PATH="/home/rohdef/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin /usr/bin:/sbin:/bin" npm run ...

Make sure to adjust the path for your system, so start by doing echo $PATH and ensure that you don't leave important things out, and make sure not to have /snap/bin in your path

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 20, 2020

Released in 4.4.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.4.1, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 20, 2020
@cypress-bot cypress-bot bot added the stage: needs review The PR code is done & tested, needs review label May 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.