Skip to content

shell.openExternal no longer works on Linux #1348

Closed

Description

@kevinsawicki

On Ubuntu 14.04 with Atom Shell 0.22.3 require('shell').openExternal('http://github.com') does not seem to work. I have both Firefox and Chromium installed on that VM.

See atom-archive/feedback#40 for other reports.

Similar to #623

Activity

  1. lee-dohm commented on Apr 2, 2015

    @lee-dohm
    Contributor

    Also see: https://discuss.atom.io/t/none-of-the-menu-items-under-help-work/15818

    Is it possible to make openExternal throw an exception if it fails so that situations like these can display a meaningful error message?

  2. deepak1556 commented on Apr 4, 2015

    @deepak1556
    Member

    @kevinsawicki does xdg-open http://github.com work on your VM ?

    agree with @lee-dohm , would a boolean status suffice or a reason for failure needs to be thrown, the latter needs some work.

  3. jplatte commented on Apr 4, 2015

    @jplatte

    I have the same problem. I'm using i3-wm where I manually start gnome-settings-daemon to do the environment stuff. I'm exporting BROWSER="firefox" through ~/.bashrc, and have it set in the GNOME control center. xdg-open <http-link> does work, although it opens the link in chromium for some reason.

  4. despairblue commented on Apr 8, 2015

    @despairblue

    could this be linked to atom/settings-view#456 ?

  5. jplatte commented on Apr 8, 2015

    @jplatte

    @despairblue Yeah, seems like the same problem.

  6. despairblue commented on Apr 9, 2015

    @despairblue

    Found my problem:

    1. I click a link
    2. Atom open issues xdg-open (synchronously)
    3. xdg-open opens chrome (synchronously again)
    4. chrome complains about something and doesn't quit:
    The setuid sandbox is not running as root. Common causes:
      * An unprivileged process using ptrace on it, like a debugger.
      * A parent process set prctl(PR_SET_NO_NEW_PRIVS, ...)
    Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
    

    5. everyone waits...

  7. despairblue commented on Apr 9, 2015

    @despairblue

    ah, not quite, it simply forks the never quitting chrome instance into the background and returns, which at least does not lock up atom.

  8. subesokun commented on Apr 20, 2015

    @subesokun

    Not sure if this information helps to track down the issue, but when manually spawning a process like

    {spawn} = require 'child_process'
    cmd = spawn('chromium-browser', ['--no-sandbox', 'https://www.google.com'])

    then Chromium starts up. If I leave away the --no-sandbox flag then I get a similar error as in #1348 (comment)

    [9784:0416/151609:ERROR:browser_main_loop.cc(170)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    App load time: 224ms
    ...
    The setuid sandbox is not running as root. Common causes:
      * An unprivileged process using ptrace on it, like a debugger.
      * A parent process set prctl(PR_SET_NO_NEW_PRIVS, ...)
    Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
    The program 'atom' received an X Window System error.
    This probably reflects a bug in the program.
    The error was 'BadWindow (invalid Window parameter)'.
      (Details: serial 789 error_code 3 request_code 40 minor_code 0)
      (Note to programmers: normally, X errors are reported asynchronously;
       that is, you will receive the error a while after causing it.
       To debug your program, run it with the --sync command line
       option to change this behavior. You can then get a meaningful
       backtrace from your debugger if you break on the gdk_x_error() function.)
    

    Most likely setting the flag --disable-setuid-sandbox will be already sufficient so that Chromium correctly starts up, but of course from security aspect it's very critical to disable the sandbox or setuid-sanbox.

    With Firefox as default browser I had no issues and shell.openExternal works for me. I've changed the default browser via sudo update-alternatives --config x-www-browser

    Edit: Maybe also this link helps for better understanding of the Chromium sandbox concept https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment

  9. despairblue commented on Apr 20, 2015

    @despairblue

    If chrome/chromium is already started the, --no-sandbox does nothing harmful, since the new not-sandboxed instance will just tell the other sandboxed instance to open a new tab, that tab is then sandboxed. The culprit is just if no browser is open already. First it will open the chrome/chromium not-sandboxed and second xdg-open will still block and freeze atom.

  10. anaisbetts commented on Apr 20, 2015

    @anaisbetts
    Contributor

    I can't see how this is anything but a Chrome bug, maybe file it on their issue tracker? If they don't work with xdg-open then that's a big problem that is unrelated to Atom

  11. subesokun commented on Apr 20, 2015

    @subesokun

    Not sure if it's a pure Chrome bug. If I run xdg-open directly from the shell with Chromium as default browser it works. Also in my example above #1348 (comment) I don't use xdg-open at all but still face the same issue. Seems like the Node process environment of electron doesn't behave well with Chromium so that it fails to run the setuid sandbox as root in case the Chromium process gets spawned out of electron (whyever Chromium wants to do such...)

  12. subesokun commented on Apr 20, 2015

    @subesokun

    It seems to be also not a particular bug of Node as this small script works without problem when running directly via Node

  13. zcbenz commented on Apr 22, 2015

    @zcbenz
    Contributor

    Fixed by #1454.

  14. project0 commented on Aug 21, 2015

    @project0

    still doesnt work on linux and chromium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions