zellij
zellij copied to clipboard
Could not find the SHELL variable: NotPresent
Basic information
zellij --version: 0.31.4
stty size: 52 192
uname -av or ver(Windows): run in docker (host is Linux Master 5.15.60-1-MANJARO)
Further information

Error occurred in server:
× Thread 'pty' panicked.
├─▶ Originating Thread(s)
│ 1. ipc_server: NewClient
│ 2. pty_thread: NewTab
│
├─▶ At zellij-server/src/pty.rs:206:54
╰─▶ Could not find the SHELL variable: NotPresent
help: If you are seeing this message, it means that something went wrong.
Please report this error to the github issue.
(https://github.com/zellij-org/zellij/issues)
Also, if you want to see the backtrace, you can set the `RUST_BACKTRACE` environment variable to `1`.
Inside the docker container, if you do echo $SHELL, what do you get?
Inside the docker container, if you do
echo $SHELL, what do you get?
it's /bin/bash.
when i run zellij in tmux session inside docker container, it works.
Hmm, very odd. Could you help me understand how you are running this? What computer you are on, how are you connecting to the docker host, etc. I want to figure out where this env variable gets dropped.
- I used docker img base ubuntu 20.04
- I started a container with docker start -i
- execute zellij
I encountered the same issue on Fedora 36 docker image run on podman. I was logged in the container as root and SHELL environ variable was set to /bin/bash.
@altair-albert , @karczex - could this be an issue of timing or environment? Instead of running Zellij with zellij, could you maybe do something like echo $SHELL > /tmp/logfile && zellij, and then see what you get in /tmp/logfile?
Btw, a workaround for this would be to specify a default_shell in the zellij configuration: https://zellij.dev/documentation/options.html
But I still want to get to the bottom of this
@altair-albert , @karczex - could this be an issue of timing or environment? Instead of running Zellij with
zellij, could you maybe do something likeecho $SHELL > /tmp/logfile && zellij, and then see what you get in/tmp/logfile?
I get /bin/bash as expected, but for some reason it's not propagated to the application.
It seems the problem lays somewhere outside of zellij. I tried simple C program, which reads SHELL env variable and it also cannot get it. The fun part is that, it reads PATH variable without any problems.
#include <stdlib.h>
#include <stdio.h>
#define BUFSIZE 880
int main(){
char shell[BUFSIZE];
char *envvar = "SHELL";
if(!getenv(envvar)){
fprintf(stderr, "The environment variable %s was not found.\n", envvar);
exit(1);
}
if(snprintf(shell, BUFSIZE, "%s", getenv(envvar)) >= BUFSIZE){
fprintf(stderr, "BUFSIZE of %d was too small. Aborting\n", BUFSIZE);
exit(1);
}
printf("SHELL: %s\n", shell);
return 0;
}
Quick update: Zellij will now fall back to using /bin/sh when $SHELL cannot be read, and panics if whatever shell it ends up using doesn't exist.
This doesn't fix nor explain why in some circumstances env vars cannot be read in the first place, but now at least you'll be made aware that something went wrong!