Grayjay.Desktop icon indicating copy to clipboard operation
Grayjay.Desktop copied to clipboard

(Linux) Bad work directory by default

Open EvilGremlin opened this issue 1 year ago • 11 comments

when run by simple /home/eg/Soft_AppImage/Grayjay/Grayjay it crashes with CEF:File not found at native path '/home/user/cef/dotcefnative'. so i had to use bash -c 'cd /home/eg/Soft_AppImage/Grayjay/ && ./Grayjay' for menu item

EvilGremlin avatar Dec 21 '24 00:12 EvilGremlin

This happens to me, too. Cannot launch GrayJay from either a .desktop file. Running Ubuntu Linux 22.04.5 LTS. See snippets below.

When launching via .desktop file, nothing happens (the errors and core dump happen in the background, invisibly).

If I cd to the directory with the GrayJay executable, and then launch it from the terminal (using ./Grayjay), then it launches, but there are a lot of errors thrown in the terminal window the whole time it's running and after it's terminated.

.desktop file

[Desktop Entry]
Type=Application
Name=GrayJay
Comment=Streaming video player and downloader
Exec=/home/[user]/.grayjay/Grayjay
Icon=/home/[user]/.grayjay/grayjay.png
Path=/home/[user]/.grayjay/
Terminal=False
Categories=Multimedia;

Terminal

[user]@[host]:~$ ./.grayjay/Grayjay
Directories:Base Directory: /home/[user]/.grayjay/
Directories:User Directory: /home/[user]/Grayjay
Directories:Temporary Directory: /home/[user]/.grayjay/temp_files
Directories:Log file path: /home/[user]/.grayjay//log.txt
T:PortFile path: /home/[user]/.grayjay/port
T:StartingUpFile path: /home/[user]/.grayjay/starting
T:Found StartingUpFile, waiting for PortFile and process
T:No PortFile after waiting, killing any lingering (stuck) process
T:Created StartingUpFile, removed PortFile
Program:Main: StateApp.Startup
StateApp:Startup: Initializing PluginEncryptionProvider
StateApp:Startup: Initializing DatabaseConnection
StateApp:Startup: Ensuring Table DBSubscriptionCache
StateApp:Startup: Ensuring Table DBHistory
StateApp:Startup: Initializing Download Cycle
StateDownloads:Started downloading cycle
StateDownloads:Ended downloading cycle
Program:Main: StateApp.Startup finished (97ms)
Program:Extra args: 
Program:Main: Starting DotCefProcess
CEF:CEF directory '/home/[user]/cef'.
CEF:Working directory '/home/[user]/cef'.
CEF:CEF exe path '/home/[user]/cef/dotcefnative'.
CEF:File not found at native path '/home/[user]/cef/dotcefnative'.
Keyring:Falling back to file keyring
Unhandled exception. System.Exception: Native executable not found.
   at DotCef.DotCefProcess.Start(String args)
   at Grayjay.Desktop.Program.Main(String[] args)
   at Grayjay.Desktop.Program.<Main>(String[] args)
Aborted (core dumped)

jonathancutting avatar Dec 22 '24 21:12 jonathancutting

I'm experiencing similar issues, it doesn't launch no matter what. I'm running it on Kubuntu 24.04.1 LTS x86_64

I extracted the application to /home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2.

Here's the log from the terminal:

Directories:Base Directory: /home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/
Directories:User Directory: /home/[user]/Grayjay
Directories:Temporary Directory: /home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/temp_files
Directories:Log file path: /home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2//log.txt
T:PortFile path: /home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/port
T:StartingUpFile path: /home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/starting
T:Found StartingUpFile, waiting for PortFile and process
T:No PortFile after waiting, killing any lingering (stuck) process
T:Created StartingUpFile, removed PortFile
Program:Main: StateApp.Startup
StateApp:Startup: Initializing PluginEncryptionProvider
StateApp:Startup: Initializing DatabaseConnection
StateApp:Startup: Ensuring Table DBSubscriptionCache
StateApp:Startup: Ensuring Table DBHistory
StateApp:Startup: Initializing Download Cycle
StateDownloads:Started downloading cycle
StateDownloads:Ended downloading cycle
Program:Main: StateApp.Startup finished (86ms)
Program:Extra args: 
Program:Main: Starting DotCefProcess
CEF:CEF directory '/home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/cef'.
CEF:Working directory '/home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/cef'.
CEF:CEF exe path '/home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/cef/dotcefnative'.
--change-stack-guard-on-fork=disable --disable-chrome-runtime --parent-to-child 111 --child-to-parent 114 --disable-web-security --use-views 
Program:Main: Starting DotCefProcess finished (4ms)
Program:Main: Starting window.
Receive loop started.
GrayjayServer:RunServerAsync: Called with (proxyUrl = ).
CEF:[1225/161758.438710:INFO:pipe.cc(141)] Pipe set handles readFd 111, writeFd 114
CEF:[1225/161758.438815:INFO:main_linux.cc(149)] Cache path: /tmp/dotcef_1735139878438
CEF:[1225/161758.439127:ERROR:chrome_main_delegate.cc(1200)] Web security may only be disabled if '--user-data-dir' is also specified with a non-default value.
CEF:[20812:20812:1225/161758.443016:FATAL:setuid_sandbox_host.cc(163)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/cef/chrome-sandbox is owned by root and has mode 4755.
An exception occurred in the IPC: Unable to read beyond the end of the stream.    at System.IO.Stream.ReadAtLeastAsyncCore(Memory`1 buffer, Int32 minimumBytes, Boolean throwOnEndOfStream, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at DotCef.DotCefProcess.<Start>b__34_3()
Receive loop stopped.
GrayjayServer:RunServerAsync: Static files path '/home/[user]/Downloads/Grayjay.Desktop-linux-x64-v2/wwwroot'.
GrayjayServer:RunServerAsync: MapWhen Websocket.
GrayjayServer:RunServerAsync: Start StateCasting.
StateCasting:Casting listener starting
Starting
Starting
Unhandled exception. System.AggregateException: One or more errors occurred. (A task was canceled.)
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Grayjay.Desktop.Program.Main(String[] args)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Grayjay.Desktop.Program.Main(String[] args)
   at Grayjay.Desktop.Program.<Main>(String[] args)
--- End of stack trace from previous location ---

   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Grayjay.Desktop.Program.Main(String[] args)
   at Grayjay.Desktop.Program.<Main>(String[] args)
Aborted (core dumped)

lordscales91 avatar Dec 25 '24 15:12 lordscales91

Done. It now checks to see if the old style dir exists first and then uses that. Otherwise, it will use a new style dir which prioritizes:

  1. XDG_DATA_HOME
  2. ~/.local.share
  3. ~/.config

Depending on what exists.

This will be released in the next update.

Zvonimir-FUTO avatar Jan 13 '25 20:01 Zvonimir-FUTO

Implemented in latest version.

Zvonimir-FUTO avatar Jan 22 '25 11:01 Zvonimir-FUTO

@Zvonimir-FUTO Not fixed, now app launches, but with blank window. Issue is not about config location, but about properly detecting and enforcing working directory.

EvilGremlin avatar Jan 23 '25 08:01 EvilGremlin

I believe I am seeing this while working on #14

It seems like this line https://github.com/futo-org/Grayjay.Desktop/blob/ec59e7eda22e87c45b39e578726f073474a4731a/Grayjay.Desktop.CEF/Program.cs#L318 passes the flag --disable-web-security for what I presume is an internal web server that displays the UI.

Log snippet:

CEF:Working directory '/app/grayjay/cef'.
CEF:CEF exe path '/app/grayjay/cef/dotcefnative'.
--change-stack-guard-on-fork=disable --parent-to-child 114 --child-to-parent 117 --disable-web-security --use-alloy-style --use-native --no-sandbox 
Program:Main: Starting DotCefProcess finished (15ms)
Program:Main: Starting window.
Receive loop started.
GrayjayServer:RunServerAsync: Called with (proxyUrl = ).
CEF:[0302/171227.940272:INFO:pipe.cc(149)] Pipe set handles readFd 114, writeFd 117
CEF:[0302/171227.940412:INFO:main_linux.cc(100)] Set handles.
CEF:[0302/171227.940489:INFO:main_linux.cc(180)] Cache path: /tmp/dotcef_1740953547940
CEF:[0302/171227.941386:ERROR:chrome_main_delegate.cc(1193)] Web security may only be disabled if '--user-data-dir' is also specified with a non-default value.

it seems like there should be a --user-data-dir passed in here (it doesnt look like this happens in the extra args). I think the value should be set to {Directories.Base}/cef

MoralCode avatar Mar 02 '25 22:03 MoralCode

Today is 5/27/2025 And i am using NixOS as my platform (Linux)

what makes me sure about it being a grayjay bug is the same .nix deceleration of this package worked for me just fine on Version 6 but when updated to 25.05 and installed version 7 i started seeing this issue

here are my errors:

$ grayjay
[2025-05-27 16:43:53.360] [INFO] [Program] AppContext.BaseDirectory: /nix/store/d5h1v91i4n5dmwvbjm09dzyxima2xc61-grayjay-app-7/opt/grayjay/
[2025-05-27 16:43:53.412] [INFO] [Program] Base Directory: /home/masrkai/Grayjay
[2025-05-27 16:43:53.418] [INFO] [Program] Temporary Directory: /home/masrkai/Grayjay/temp_files
[2025-05-27 16:43:53.427] [INFO] [ManagedThreadPool] New threadpool created (16)
[2025-05-27 16:43:53.432] [INFO] [ManagedThreadPool] New threadpool created (4)
[2025-05-27 16:43:53.435] [INFO] [Program] Log Level: Warning
[2025-05-27 16:43:53.435] [INFO] [Program] Log file path: /home/masrkai/Grayjay/log.txt
Log flusher exited with exception: System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Grayjay.Desktop.POC.Log.<.ctor>b__7_0()
[2025-05-27 16:43:53.520] [ERROR] [T] An exception occurred in the IPC
Exception: Unable to read beyond the end of the stream.
Stack Trace:    at System.IO.Stream.ReadAtLeastAsyncCore(Memory`1 buffer, Int32 minimumBytes, Boolean throwOnEndOfStream, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at DotCef.DotCefProcess.<Start>b__28_3()

Masrkai avatar May 27 '25 13:05 Masrkai

Today is 5/27/2025 And i am using NixOS as my platform (Linux)

what makes me sure about it being a grayjay bug is the same .nix deceleration of this package worked for me just fine on Version 6 but when updated to 25.05 and installed version 7 i started seeing this issue

here are my errors:

$ grayjay
[2025-05-27 16:43:53.360] [INFO] [Program] AppContext.BaseDirectory: /nix/store/d5h1v91i4n5dmwvbjm09dzyxima2xc61-grayjay-app-7/opt/grayjay/
[2025-05-27 16:43:53.412] [INFO] [Program] Base Directory: /home/masrkai/Grayjay
[2025-05-27 16:43:53.418] [INFO] [Program] Temporary Directory: /home/masrkai/Grayjay/temp_files
[2025-05-27 16:43:53.427] [INFO] [ManagedThreadPool] New threadpool created (16)
[2025-05-27 16:43:53.432] [INFO] [ManagedThreadPool] New threadpool created (4)
[2025-05-27 16:43:53.435] [INFO] [Program] Log Level: Warning
[2025-05-27 16:43:53.435] [INFO] [Program] Log file path: /home/masrkai/Grayjay/log.txt
Log flusher exited with exception: System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Grayjay.Desktop.POC.Log.<.ctor>b__7_0()
[2025-05-27 16:43:53.520] [ERROR] [T] An exception occurred in the IPC
Exception: Unable to read beyond the end of the stream.
Stack Trace:    at System.IO.Stream.ReadAtLeastAsyncCore(Memory`1 buffer, Int32 minimumBytes, Boolean throwOnEndOfStream, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at DotCef.DotCefProcess.<Start>b__28_3()

This seems unrelated to the issue at hand. Please open a separate issue for this.

Zvonimir-FUTO avatar May 27 '25 14:05 Zvonimir-FUTO

I investigated further rolling back to version 6 wasn't the answer it looks like something changed in the Nixpkgs and this is unrelated to this issue thanks to @Zvonimir-FUTO for looking into it

Masrkai avatar May 27 '25 14:05 Masrkai

@EvilGremlin is this still an issue? if so which versions are affected? I have been working on the flatpak builds so I have a fairly good understanding of how the grayjay app behaves with respect to homedirs, what files are created on startup, etc.

MoralCode avatar May 27 '25 17:05 MoralCode

Sorry, this thread was buried deep in my email. This issue seems to be fixed now, as of v8. I installed it onto my other Linux laptop and it launched and synced with GrayJay on my phone without issue.

jonathancutting avatar Jun 16 '25 14:06 jonathancutting