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

Error occurred: PermissionDenied #2426

Open
minecrawler opened this issue May 4, 2023 · 12 comments
Open

Error occurred: PermissionDenied #2426

minecrawler opened this issue May 4, 2023 · 12 comments

Comments

@minecrawler
Copy link

minecrawler commented May 4, 2023

Basic information

zellij --version: zellij 0.36.0
stty size: 1024x768
uname -av or ver(Windows): Linux asuka 6.2.14-gentoo-dist # 1 SMP PREEMPT_DYNAMIC Mon May 1 15:03:02 -00 2023 x86_64 AMD Ryzen 5 PRO 5650GE with Radeon Graphics AuthenticAMD GNU/Linux

List of programs you interact with as, PROGRAM --version: -

Further information
Reproduction steps, noticeable behavior, related issues, etc

  1. Logion as user
  2. > zellij
  3. Error occurred: PermissionDenied

I installed zellij via cargo install --root /opt zellij. It works using root and doas zellij, but as soon as I try to use it without root permissions, it just fails. The error message can be improved by telling me which permissions are missing (e.g. which file? it tries to access). As it stands, I'd have to start debugging this application to get it working, which is unfortunate.

The debug option doesn't help and the log is empty. Here's a screenshot for your convenience:

image

The user's shell is nushell with starship prompt. I'm SSH'd onto a Proxmox VM - which I want to turn into my main PC as soon as it's configured and escape the claws of the Windozer :)

@jaeheonji
Copy link
Member

Looking at the screenshot on the right you posted, it seems that zellij is currently running under the user maru.

If you installed zellij as root, you need root privileges to run zellij.

Does this user have root privileges?

@qballer
Copy link
Member

qballer commented May 17, 2023

I would take zellij compiled version and stick it somewhere in the path --root seems to be the issue.

@minecrawler
Copy link
Author

I would take zellij compiled version and stick it somewhere in the path --root seems to be the issue.

/opt is in the path. How is --root the issue?

@minecrawler
Copy link
Author

Looking at the screenshot on the right you posted, it seems that zellij is currently running under the user maru.

If you installed zellij as root, you need root privileges to run zellij.

Does this user have root privileges?

Yes. The user does not have root rights, that would defeat the purpose of having a separate user from "root" ;)

Zellij was installed as root (like all other packages), but into a public directory (see --root /opt argument)

@minecrawler
Copy link
Author

minecrawler commented May 20, 2023

Now here's the thing:

image

image

image

image

so my guess is that Zellij tries to access some other location which my user does not have access to..

@tafia
Copy link

tafia commented May 26, 2023

I'm having the same issue I've even copied zellij to ~/.local/bin but it didn't work.

  • zellig --help work
  • zellij -c <path to cinfig.kdl> does NOT work (PermissionDenied)

I suppose indeed it tries to access some file or some system resource?

EDIT: worked again after a system restart. Could it be that there was some process not closed and locking on some resource?

@tobiashort
Copy link

Had a similiar issue running zellij in WSL. Running with strace revealed that I had incorrect permissions for the folder /run/user/1001:

$ strace zellij
execve("/usr/local/bin/zellij", ["zellij"], 0x7ffdc5276fa0 /* 31 vars */) = 0
mmap(NULL, 1856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fce45624000
arch_prctl(ARCH_SET_FS, 0x7fce45624660) = 0
set_tid_address(0x7fce457a94b8)         = 1056
[...]
getrandom(NULL, 0, GRND_NONBLOCK)       = 0
getrandom("\xd6\xbd\x1f\x29\x54\xa5\x69\x9d\xa7\x82\x05\xe9\x2d\x3b\x60\x65\x69\x77\x51\xff\x03\x48\x5f\xea\xc0\xa9\xc1\xcc\x7b\x69\x58\x4e", 32, 0) = 32
open("/run/user/1001/zellij/0.36.0", O_RDONLY|O_CLOEXEC|O_DIRECTORY) = -1 EACCES (Permission denied)
write(2, "Error occurred: ", 16Error occurred: )        = 16
write(2, "PermissionDenied", 16PermissionDenied)        = 16
write(2, "\n", 1
)                       = 1
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7fce45621000, 12288)           = 0
exit_group(1)                           = ?
+++ exited with 1 +++

Fixing the permission that it looks like so fixed the issue:

/run/user$ ls -lsah
total 0
0 drwxr-xr-x  3 root             root              60 May 29 16:51 .
0 drwxr-xr-x 21 root             root             620 May 29 16:51 ..
0 drwx------  4 thg              thg              120 May 29 16:51 1001

@minecrawler
Copy link
Author

I didn't know about strace, but that's a really good tool, thank you! I found the same entry:

openat(AT_FDCWD, "/run/user/0/zellij/0.36.0", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 EACCES (Permission denied)

However I'm not comfortable with Zellij trying to access my root's folder

image

I still have an open session with stuff to do, but I'll try to re-install Zellij with with regular user and hope the problem will be solved by that (for now). ALl in all, this sounds like a bug in ZelliJ, probably trying to access the folder of the user who installed the program. On Linux, that's not a good practice, since Linux is a multi-user system with at least root and a regular user being daily drivers.

@zicklag
Copy link

zicklag commented Oct 9, 2023

Yeah, I'm running into a similar oddity. But under certain environment variables combination ( i.e. doing an su with or without the - before the username to switch to, it seems to use a totally different directory for the sockets.

In one case it even uses the /tmp dir: /tmp/zellij-1003/0.38.2.

I haven't found a way to configure which dir it uses, though.

@zicklag
Copy link

zicklag commented Oct 9, 2023

Ah, I figured out:

export ZELLIJ_SOCKET_DIR=/run/user/[userid]/zellij

I'm not sure how it determines the default value, but just set that dir to one appropriate for your user in your .profile or whatever, and you should be good.

PS: Strace is awesome, thanks for pointing that out!

@ShortArrow
Copy link

ShortArrow commented Mar 9, 2024

This is just a status report, but I hope it helps someone!

I had get error message after write this to ~/.bashrc.

export ZELLIJ_SOCKET_DIR="/run/user/$USER/zellij"

More precisely,

  1. Start zellij
  2. Behavior similar to clear occurs
  3. It looks like just a normal shell
  4. Try sudo zellij
  5. I can do sudo zellij normally.
  6. exit
  7. Previous zellij error appears
  8. Try sudo zellij
  9. I can do sudo zellij normally.
  10. exit
  11. Nothing happens. usually.

image

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', /home/who/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/zellij-client-0.39.2/src/lib.rs:200:44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Bye from Zellij!

wituout ZELLIJ_SOCKET_DIR

image

Env

zellij version 0.39.2
Arch Linux on Windows 11 Pro
Linux 5.15.123.1-microsoft-standard-WSL2 # 1 SMP Mon Aug 7 19:01:48 UTC 2023 x86_64 GNU/Linux

@CFiggers
Copy link

Ah, I figured out:

export ZELLIJ_SOCKET_DIR=/run/user/[userid]/zellij

This helped me, except that I also needed to manually create that directory and then run sudo chown 1000:1000 /run/user/$USER as well. I'm running Ubuntu in WSL.

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

No branches or pull requests

8 participants