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

[Bug]: Crash on start (Ubuntu 24.04) #2007

Open
3 of 5 tasks
enriqueism opened this issue Apr 25, 2024 · 9 comments
Open
3 of 5 tasks

[Bug]: Crash on start (Ubuntu 24.04) #2007

enriqueism opened this issue Apr 25, 2024 · 9 comments
Labels
bug Something isn't working electron-issue It's an Electron or Electron related dependencies issue (not YTM-Desktop issue) help wanted Extra attention is needed

Comments

@enriqueism
Copy link

Preflight Checklist

  • I use the latest version of YouTube Music (Application).
  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.
  • I understand that th-ch/youtube-music has NO affiliation with Google or YouTube

YouTube Music (Application) Version

3.3.6

Checklists

What operating system are you using?

Ubuntu

Operating System Version

Ubuntu 24.04

What CPU architecture are you using?

x64

Last Known Working YouTube Music (Application) version

No response

Reproduction steps

$ youtube-music

Expected Behavior

Open

Actual Behavior

Crash at start

Enabled plugins

None

Additional Information

LaunchProcess: failed to execvp:
/opt/YouTube
[5924:0425/165253.026537:FATAL:zygote_host_impl_linux.cc(202)] Check failed: . : Argumento inválido (22)
«trap» para punto de parada/seguimiento (`core' generado)

@chris122380
Copy link

chris122380 commented Apr 26, 2024

looks like a path or shortcut issue but doesn't make much sense (Maybe this info will be more helpful to someone who knows Linux better then me). If I go to "/opt/YouTube Music" in the files app and double click on the executable youtube-music it will launch the app. This is strange because the "/usr/share/applications/youtube-music.desktop" points directly to that same file. I also tried running "/usr/bin/youtube-music" or changing the desktop file to that location and still get the same error. Unsure why I can go directly to the app in files and run it but not as a shortcut, so very strange. I can run it from files app directly but not from the terminal. So very strange.

@ArjixWasTaken
Copy link
Contributor

ArjixWasTaken commented Apr 26, 2024

looks like a path or shortcut issue but doesn't make much sense (Maybe this info will be more helpful to someone who knows Linux better then me). If I go to "/opt/YouTube Music" in the files app and double click on the executable youtube-music it will launch the app. This is strange because the "/usr/share/applications/youtube-music.desktop" points directly to that same file. I also tried running "/usr/bin/youtube-music" or changing the desktop file to that location and still get the same error. Unsure why I can go directly to the app in files and run it but not as a shortcut, so very strange. I can run it from files app directly but not from the terminal. So very strange.

Maybe the desktop file is configured for Wayland and you are in x11?

Can you share ur desktop file?

@enriqueism
Copy link
Author

enriqueism commented Apr 26, 2024

The initial setup was on wayland, now i've change to x11. Same error.

[Desktop Entry]
Name=YouTube Music
Exec="/opt/YouTube Music/youtube-music" %U
Terminal=false
Type=Application
Icon=youtube-music
StartupWMClass=YouTube Music
Comment=YouTube Music Desktop App - including custom plugins
Categories=AudioVideo

@chris122380
Copy link

chris122380 commented Apr 27, 2024

I also receive the error if I try to run it directly from terminal "/opt/YouTube Music/youtube-music" on Wayland and x11. The only way I can get it to run is to use files to go directly to /opt/YouTube Music/youtube-music and double click on it.

@chris122380

This comment was marked as spam.

@Totto16
Copy link
Contributor

Totto16 commented May 1, 2024

The reason is, that in Ubuntu 24.04 we have restricted user namespaces (which affects electron being able to spawn a sandbox)

See electron/electron#41066

See https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces

and https://discourse.ubuntu.com/t/noble-numbat-release-notes/39890#unprivileged-user-namespace-restrictions-15

See here for some fixes regarding bwrap, (which we could use similar fixes, I am currently testing that)

@Totto16
Copy link
Contributor

Totto16 commented May 1, 2024

Solutions

There are two possible solutions fro this problem in Ubuntu 24.04:

Solution 1 :

Add a apparmor profile for youtube-music, so that it can use user namespaces (userns)

To do this this, create this file /etc/apparmor.d/youtube-music and add this content to it

# This profile adds the "userns" flags to the otherwise "unrestricted" flags, this is needed, since electron uses user namespaces (userns) to run a sandbox, and this app uses electron

abi <abi/4.0>,
include <tunables/global>

profile youtube-music "/opt/YouTube Music/youtube-music" flags=(unconfined) {
  userns,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/youtube-music>
}

and than run

sudo systemctl reload apparmor

Taken from here and modified accordingly.

Tested locally, it works.

Solution 2:

disable this restriction ( might also help for other apps, that crash otherwise)

sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

And then you have to reboot.

this disables the restriction against unprivileged user namespaces.

@Totto16
Copy link
Contributor

Totto16 commented May 1, 2024

This app should ship the /etc/apparmor.d/youtube-music with the correct content in it in the debs, rpms etc, as some other popular electron applications do (like e.g. vscode). I am investigating where this should be done (in electron-vite, electron-builder or in this repo)

Edit:
My investigations resulted in the following:

It is not possible to add a file to /etc/apparmor.d/youtube-music with electron-builder. I looked into some packages, that have a profile that includes userns flags in the profile, and they are shipped via the apparmor deb of ubuntu 24.04 (filelist).So none of the debs (e.g. vscode) ships it itself. Since we are certainly not able, to add "our" youtube-music file into that deb package, we have to do it ourselves. So either electron-builder needs to support that, or we add this file via some "magic" in the postinstall and remove it via rm in the postrm shell scripts 🤷🏼‍♂️

The first option is a better option, but for that we need to do submit a PR doing that to electron-builder (for which I currently don't have the time to 😓 ) . So if someone sees this and has the time to do so, feel free to do it ❤️

@Su-Yong Su-Yong added the bug Something isn't working label May 9, 2024
@Su-Yong Su-Yong changed the title [Bug]: Crash at start [Bug]: Crash on start using terminal in Ubuntu 24.04 May 9, 2024
@Su-Yong Su-Yong added the electron-issue It's an Electron or Electron related dependencies issue (not YTM-Desktop issue) label Jun 7, 2024
@JellyBrick JellyBrick changed the title [Bug]: Crash on start using terminal in Ubuntu 24.04 [Bug]: Crash on start (Ubuntu 24.04) Jun 8, 2024
@JellyBrick JellyBrick pinned this issue Jun 8, 2024
dre1080 added a commit to dre1080/dotfiles that referenced this issue Jul 7, 2024
@JellyBrick JellyBrick added the help wanted Extra attention is needed label Jul 14, 2024
@tloc241
Copy link

tloc241 commented Jul 29, 2024

guy, just update your kernel to version 6.9.12 and everything fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working electron-issue It's an Electron or Electron related dependencies issue (not YTM-Desktop issue) help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants