pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.21k stars 137 forks source link

Various Errors and/or Non-Launch Depending on Launch Method #174

Open FibroJedi opened 1 year ago

FibroJedi commented 1 year ago

Thanks in advance for your bug report!

What happened?

Before I start, I'll clarify that I'm not a software coder (just a web coder) so I wouldn't know how to hack the code to fix anything. Secondly, I found getting a release confusing so I don't really know if I have the latest or not. Info below:

Pulsar : 1.63.2022111606 Electron: 12.2.3 Chrome : 89.0.4389.128 Node : 14.16.0

Issue is: Pulsar doesn't run off the command line and won't run on command line without sudo. In both cases there are errors, which I'll lay out below.

I also don't have any extensions/modules installed at the point of writing this.

Final Note: There is always a possibility that I messed something up in the installation. So I'm looking for a solution to the problem, which may - or may not - be a bug.


In the interim I will try to look into the libva errors below because I think they occur in other places than pulsar. I've given four versions/cases below of methods of launching Pulsar and only one yields the libva error.

Which OS does this happen on?

🐧 Debian based (Linux Mint, Ubuntu, etc.)

OS details

Linux Mint 1 (Cinnamon 5.4.12)

Which CPU architecture are you running this on?

64-bit(x86_64)

What steps are needed to reproduce this?

Version 1: Running without sudo pulsar --safe cp: cannot stat 'resources/linux/desktopenviroment/cinnamon/pulsar.nemo_action': No such file or directory /usr/bin/pulsar: line 194: 8756 Trace/breakpoint trap (core dumped) nohup "$PULSAR_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1 libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null) libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null) libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null) [8756:1123/200526.136236:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.

Result: Pulsar does not load.

Version 2: Running with sudo sudo pulsar --safe expr: syntax error: missing argument after ‘8’

Result: Pulsar does not load, but none of the above errors occurs either. Running with sudo but without --safe also does not result in Pulsar loading.

Version 3: Running with sudo and --no-sandbox sudo pulsar --no-sandbox expr: syntax error: missing argument after ‘8’

Result: Pulsar loads, despite the singular error -but none of the the libva errors in version 1 occurs either.

Version 4: Running without sudo but with --no-sandbox

pulsar --no-sandbox cp: cannot stat 'resources/linux/desktopenviroment/cinnamon/pulsar.nemo_action': No such file or directory

Result: Pulsar loads despite the error.

Additional Information:

Kernel: 5.15.0-53-generic NVIDIA Driver: 470.141.03 (not the latest because the latest ones crashed my system) Graphics Card: NVIDIA GeForce RTX 3050 Memory: 31.2 GiB

Spiker985 commented 1 year ago

@FibroJedi Would you mind installing the appropriate binary from here

That'll make sure that you are up to date with the latest master branch. We can see if your missing argument error goes away

As for the cannot stat error - there's a line in pulsar.sh which is supposed to try to copy the nemo_action file from a local folder - however, this doesn't work for an installation as it's referencing the wrong directory

Spiker985 commented 1 year ago

Can you also confirmed how you installed the binary? There's a possibility that you're installing it in a way that assigns permissions to root instead of your user, which would result in you having to always use sudo

Which isn't something you want with an editor

FibroJedi commented 1 year ago

@Spiker985 I'm installing the binary now, but to confirm I downloaded one from what I thought was your master branch. A similar way to the one you have just shown me. I'll run the tests in a sec.

FibroJedi commented 1 year ago

Command Line Tests:

Test 1: pulsar (without sudo)

Test 2: sudo pulsar Result: expr: syntax error: missing argument after ‘8’

Test 3: I wasn't sure if this was a valid test, but I tried with --disable-gpu

pulsar --disable-gpu cp: cannot stat 'resources/linux/desktopenviroment/cinnamon/pulsar.nemo_action': No such file or directory user@here:~$ /usr/bin/pulsar: line 194: 9744 Trace/breakpoint trap (core dumped) nohup "$PULSAR_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1 libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null) libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null) libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null) (node:9803) Electron: Loading non-context-aware native module in renderer: '/tmp/.org.chromium.Chromium.GPXJMb'. This is deprecated, see https://github.com/electron/electron/issues/18397. (Use 'exe --trace-warnings ...' to show where the warning was created) (node:9803) Electron: Loading non-context-aware native module in renderer: '/tmp/.org.chromium.Chromium.lG40ms'. This is deprecated, see https://github.com/electron/electron/issues/18397. (node:9803) Electron: Loading non-context-aware native module in renderer: '/tmp/.org.chromium.Chromium.8UCmM7'. This is deprecated, see https://github.com/electron/electron/issues/18397. (node:9803) Electron: Loading non-context-aware native module in renderer: '/tmp/.org.chromium.Chromium.oUc1k4'. This is deprecated, see https://github.com/electron/electron/issues/18397. (node:9803) Electron: Loading non-context-aware native module in renderer: '/tmp/.org.chromium.Chromium.l4jVOZ'. This is deprecated, see https://github.com/electron/electron/issues/18397. [9744:1124/113423.037259:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.

I only have a NVIDIA graphics card, no backup Intel one, so I don't know if that might be causing issues.

I'm looking into the libva errors now.

FibroJedi commented 1 year ago

I'm wondering if it's related to this thread https://askubuntu.com/questions/627733/hardware-acceleration-error where it says VAAPI just won't work on a discrete GPU.

As I don't have another GPU. I'll try the workaround in that thread.

FibroJedi commented 1 year ago

Last update: I think this thread https://bbs.archlinux.org/viewtopic.php?id=258759 indicates that VA-API isn't really compatible with NVIDIA. As I don't have a fallback GPU, it looks like I cannot run Pulsar without errors.

I will use Pulsar as I used Atom and I want to support Pulsar. I'll have to just use the --no-sandbox flag.

The VA-API might be something in the old code of Atom? I don't know, but I've tried for 2-3hrs to fix this to no avail. If you want any extra system info or command line output, please do ask though. Thanks.

[EDIT] I was able to get rid of the libva errors as the reference wasn't set in the environment variable. However, Pulsar still won't load without --no-sandbox. Error remains:

Without --no-sandbox

  1. If run without sudo /usr/bin/pulsar: line 194: 11077 Trace/breakpoint trap (core dumped) nohup "$PULSAR_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1 [11077:1124/135850.715085:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.

  2. If run with sudo expr: syntax error: missing argument after ‘8’

With --no-sandbox

  1. If run without sudo cp: cannot stat 'resources/linux/desktopenviroment/cinnamon/pulsar.nemo_action': No such file or directory

  2. If run with sudo expr: syntax error: missing argument after ‘8’

Spiker985 commented 1 year ago

We should be able to query the graphics providers, and automatically add "--no-sandbox" into the runtime args

Which will resolve this problem not only for you, but me as well, and eventually hundreds of other users

Spiker985 commented 1 year ago

@Spiker985 I'm installing the binary now, but to confirm I downloaded one from what I thought was your master branch. A similar way to the one you have just shown me. I'll run the tests in a sec.

Also, just to confirm for you: you did, in fact, use one of our master builds, it was just a few days out of date and we had some adjustments between them - so I wanted to make sure you were up to date with the latest, in case some problems were resolved

Spiker985 commented 1 year ago

I also have a PR in the works to fix the error with the pulsar.sh file (which is where that error "argument after 8" comes from

FibroJedi commented 1 year ago

@Spiker985 I'm installing the binary now, but to confirm I downloaded one from what I thought was your master branch. A similar way to the one you have just shown me. I'll run the tests in a sec.

Also, just to confirm for you: you did, in fact, use one of our master builds, it was just a few days out of date and we had some adjustments between them - so I wanted to make sure you were up to date with the latest, in case some problems were resolved

Confirm Yes, today's test was done from the exact link you gave me.

Question Going forward, what's the best way to update Pulsar? Just going to the master branch and getting the binary from the latest commit/build?

FibroJedi commented 1 year ago

Is this error an issue or can I ignore it?

cp: cannot stat 'resources/linux/desktopenviroment/cinnamon/pulsar.nemo_action': No such file or directory

Spiker985 commented 1 year ago

Is this error an issue or can I ignore it?

cp: cannot stat 'resources/linux/desktopenviroment/cinnamon/pulsar.nemo_action': No such file or directory

Should be fixed in #175

Spiker985 commented 1 year ago

@Spiker985 I'm installing the binary now, but to confirm I downloaded one from what I thought was your master branch. A similar way to the one you have just shown me. I'll run the tests in a sec.

Also, just to confirm for you: you did, in fact, use one of our master builds, it was just a few days out of date and we had some adjustments between them - so I wanted to make sure you were up to date with the latest, in case some problems were resolved

Confirm Yes, today's test was done from the exact link you gave me.

Question Going forward, what's the best way to update Pulsar? Just going to the master branch and getting the binary from the latest commit/build?

We're updating https://pulsar-edit.dev to include a downloads page, which will have a link to the most recent Cirrus build as well

Once we have a full release, you'll be able to download it on the downloads page

FibroJedi commented 1 year ago

@Spiker985 I'm installing the binary now, but to confirm I downloaded one from what I thought was your master branch. A similar way to the one you have just shown me. I'll run the tests in a sec.

Also, just to confirm for you: you did, in fact, use one of our master builds, it was just a few days out of date and we had some adjustments between them - so I wanted to make sure you were up to date with the latest, in case some problems were resolved

Yes, I did.

I'm on version 1.63.2022112300 which came from the link you gave me yesterday.

DeeDeeG commented 1 year ago

Linking a related issue from Atom, as this affects Atom too.

This is a known issue on any recent Linux distro and Electron versions less than 13.x latest.

https://github.com/atom/atom/issues/23036#issuecomment-939500928

Solution is really to get on Electron 13.x or newer, but these flags are a viable workaround for now.

See also: https://github.com/pulsar-edit/pulsar/issues/199

Eschguy commented 1 year ago

Just adding for more data

Fedora 37 with Nvidia Proprietary drivers on Wayland using the AppImage

libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[60530:1220/161017.524088:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
Trace/breakpoint trap (core dumped)
reahari commented 1 year ago

This is marked as completed but I am on UBuntu 22.04 with nvidia graphics and it still doesn't work unless I launch in the terminal with either --no-sandbox or --disable-gpu-sandbox options

Daeraxa commented 1 year ago

What type of binary? I would be expecting the .deb to work just fine. The appimage might not.

reahari commented 1 year ago

the 1.102.2023022622 .deb downloaded from https://pulsar-edit.dev/download.html#rolling-release

Spiker985 commented 1 year ago

the 1.102.2023022622 .deb downloaded from https://pulsar-edit.dev/download.html#rolling-release

In a terminal, can you type which pulsar and make sure it is linking to a pulsar.sh file?

The sandbox option was added to the startup bash script for linux and mac. So if you must provide it, something isn't pointing to that pulsar.sh file

reahari commented 1 year ago

which pulsar returns /usr/bin/pulsar

Spiker985 commented 1 year ago

How about ls -l $(which pulsar)? Should show a symlink to a pulsar.sh file

DeeDeeG commented 1 year ago

I'm not sure if this is still a problem or not, but at some point I had to edit the .desktop file installed to my system to add the --no-sandbox flag.

(Was installed at ~/.local/share/applications/pulsar.desktop).

- Exec=/opt/Pulsar/pulsar %U
+ Exec=/opt/Pulsar/pulsar --no-sandbox %U

I think the OS/desktop launcher might be launching the binary directly, in which case we need to be sure that uses the --no-sandbox flag as well.

This was a while ago, so maybe it's been fixed by now, just mentioning this here so I don't forget to share this info somewhere.

confused-Techie commented 1 year ago

@DeeDeeG I don't actually recall and PR's that changed the desktop file to add this, so if it really is targeting the binary, this may still be an issue

reahari commented 1 year ago

How about ls -l $(which pulsar)? Should show a symlink to a pulsar.sh file

It does not. Running it shows -rwxr-xr-x 1 root root 5330 Feb 27 14:48 /usr/bin/pulsar

Spiker985 commented 1 year ago

On a somewhat unrelated note, the Debian control.in file still marks Github as the maintainer. We need to change that.

It does not. Running it shows -rwxr-xr-x 1 root root 5330 Feb 27 14:48 /usr/bin/pulsar

Did you upgrade an earlier install, or was this a first-time install?

I wonder if the Debian installer/uninstaller/upgrade functions differently. I know for Arch Linux, it gets installed into /opt/Pulsar and then symlinks to /usr/bin/pulsar - but obviously, the AUR entry functions independently (even if using the deb as the source)

But I would expect it to entirely clean up after itself on an upgrade

DeeDeeG commented 1 year ago

Reporting in from Ubuntu: For me, on Ubuntu with Pulsar 1.102.0 Regular installed from the .deb, /usr/bin/pulsar is the launcher shell script. It has no file extension, but it is the shell launcher script, and it's not a symlink either.

Which I believe is to be expected, we do copy it in our postinstall script.

https://github.com/pulsar-edit/pulsar/blob/7d933c561f6f43def1dbb0408df9575e265f6e7d/script/post-install.sh#L3-L10

That said, if I go in and open /usr/bin/pulsar with a text editor, I can see that anywhere it is launching Pulsar on Linux, it is using --no-sandbox, which again is to be expected as of https://github.com/pulsar-edit/pulsar/pull/262 back in the end of December.

DeeDeeG commented 1 year ago

I bet it's the .desktop file launching the binary directly with no --no-sandbox flag, per my comment above. We can configure this in the electron-builder config, we should do that at some point. I just hope it doesn't make us manually copy-paste an entire .desktop file's worth of fields in just to manually override this one field. Hmmm.

Spiker985 commented 1 year ago

We already have a file in place that electron-builder should use to generate the .desktop file, https://github.com/pulsar-edit/pulsar/blob/master/resources/linux/pulsar.desktop.in.

We just need to add --no-sandbox after env ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false on the exec line

Edit: Which I can take care of on my resource update branch Edit 2: Should we be symlinking that file instead of copying it? That's the expected behaviour on all other distros Edit 3: https://github.com/pulsar-edit/pulsar/commit/5ef6ff92beefa5b20c21c5bfe1d08e3dd072a70d

curiousercreative commented 1 year ago

I think you've got it all figured out, but just reporting that the .deb previously worked well when launched via desktop file but currently does not as a result of calling opt/Pulsar/pulsar rather than /usr/bin/pulsar as you'd get from which pulsar (terminal command works well).

Spiker985 commented 1 year ago

If it's always sent to /usr/bin over /opt/Pulsar, we can mark that statically in the desktop template entry. I'll have to check to see if there's a syntax for it. <%= installDir %> seems to be the /opt/Pulsar location

Edit: Well, that is, if we're even using these files, which, I'm unsure if we are

DeeDeeG commented 1 year ago

@Spiker985 I think the shipped .desktop file is being generated on-the-fly by electron-builder at the moment, though we can override that in the electron-builder config.

(https://www.electron.build/configuration/linux --> desktop config.)

That Exec line in https://github.com/pulsar-edit/pulsar/blob/master/resources/linux/pulsar.desktop.in looks a lot more complex than I was seeing on my machine. Also: We stopped using the JS build scripts that Atom used to use to finish transforming those .in template files into the final metadata for the Linux packages...

confused-Techie commented 8 months ago

We should be able to query the graphics providers, and automatically add "--no-sandbox" into the runtime args

Which will resolve this problem not only for you, but me as well, and eventually hundreds of other users

As we are still seeing the odd issue relating to this behavior, I was curious if you ever investigated what "query[ing] the graphics providers" might look like, as you're a bit more familiar with these systems.

Was just looking into adding the runtime arg, and remembered this comment, which obviously doing it only if needed would be the best solution.

Especially since adding in runtime args for Electron within the actual JS code seems perfectly doable:

https://github.com/pulsar-edit/pulsar/blob/69e4224ae11a06295d79ec723026dd1fc585aa57/src/main-process/start.js#L41

So if we can add a check here for the graphics provider, it might be the best place to resolve the still occurring issues:

tjapro commented 3 months ago

Hello, another report for the same problem.
Please, bear with me if I haven't done everything I should.

pulsar do not open/start, even after removing it and reinstalling it through sudo dnf install ./pulsar-rpm-file.rpm -y

> which pulsar
/usr/bin/pulsar

> pulsar
(no output / no app started)

> cd /opt/Pulsar/
> LC_MESSAGES=en.US.UTF-8 ./pulsar
/tmp/.org.chromium.Chromium.6HkRHt: failed to map segment from shared object
Error: /tmp/.org.chromium.Chromium.6HkRHt: failed to map segment from shared object
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1846)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1138:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:2073)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/opt/Pulsar/resources/app.asar/node_modules/nsfw/js/src/index.js:4:14)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
libva error: /usr/lib64/dri-nonfree/iHD_drv_video.so init failed
failed to open /usr/lib64/dri/hybrid_drv_video.so
Not using hybrid_drv_video.so

> LC_MESSAGES=en.US.UTF-8 ./pulsar --no-sadbox
(same output as above)

> cat /usr/share/applications/pulsar.desktop
[Desktop Entry]
Name=Pulsar
Exec=/opt/Pulsar/pulsar %U
Terminal=false
Type=Application
Icon=pulsar
StartupWMClass=Pulsar
Comment=A Community-led Hyper-Hackable Text Editor
Categories=Development;