warp icon indicating copy to clipboard operation
warp copied to clipboard

Windows open wsl zsh failed

Open andyjjrt opened this issue 1 year ago • 14 comments

Pre-submit Checks

Describe the bug

I've followed debugging section to disable my zsh config, but I still can't open my shell in wsl.

To reproduce

  1. Open WSL via windows terminal
  2. Put ZDOTDIR=/ in ~/.zshenv file
  3. Close windows terminal
  4. Open warp
  5. Select wsl shell
  6. (Stuck) Can't open up

Expected behavior

Should initialized shell and can do other commands

Screenshots

Image

Operating system

Windows

Operating system and version

Windows 11 Home 23H2

Shell Version

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

Current Warp version

v0.2025.02.24.20.50.stable_04

Regression

No, this bug or issue has existed throughout my experience using Warp

Recent working Warp date

idk, I download it today

Additional context

No response

Does this block you from using Warp daily?

Yes, this issue prevents me from using Warp daily.

Is this an issue only in Warp?

Yes, I confirmed that this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

None

andyjjrt avatar Feb 27 '25 09:02 andyjjrt

Thanks for reporting the issue! Do you mind sending over your various dotfiles that you use for zsh, like .zshenv, .zprofile, .zlogin, and .zshrc?

abhishek-pandya avatar Feb 27 '25 15:02 abhishek-pandya

I've also tested same .zshrc on linux computer(Ubuntu 22.04 desktop), it works well without any configuration.

Here's my .zshrc, I don't use other config files

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

ZSH_THEME="powerlevel10k/powerlevel10k"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
zstyle ':omz:update' mode auto       # update automatically without asking
# zstyle ':omz:update' mode reminder  # just remind me to update when it's time

# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

ZSH_TMUX_AUTOSTART=true

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
        git
        zsh-autosuggestions
        forgit
)

export ZSH_COMPDUMP=$ZSH/.cache/.zcompdump-$HOST
source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

export TERM="xterm-256color"

# custom command alias

# pnpm
export PNPM_HOME="/home/andyjjrt/.local/share/pnpm"
case ":$PATH:" in
  *":$PNPM_HOME:"*) ;;
  *) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end

# asdf

. "$HOME/.asdf/asdf.sh"

# fzf
export FZF_DEFAULT_COMMAND="bfs -L -type f -exclude -name .git -exclude -name .cache -exclude -name node_modules 2> /dev/null"
export FZF_DEFAULT_OPTS='--tmux 75%,60%'
export FZF_CTRL_T_OPTS="--preview '(bat --color=always --style=numbers {} || tree -C {}) 2> /dev/null'"
export FZF_CTRL_R_OPTS='--no-sort --exact --reverse'
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

export PATH="$HOME/.local/bin:$PATH"

export JAVA_HOME=$HOME/.local/zulu17
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JRE_HOME/lib

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/andyjjrt/.local/miniforge3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/andyjjrt/.local/miniforge3/etc/profile.d/conda.sh" ]; then
        . "/home/andyjjrt/.local/miniforge3/etc/profile.d/conda.sh"
    else
        export PATH="/home/andyjjrt/.local/miniforge3/bin:$PATH"
    fi
fi
unset __conda_setup

if [ -f "/home/andyjjrt/.local/miniforge3/etc/profile.d/mamba.sh" ]; then
    . "/home/andyjjrt/.local/miniforge3/etc/profile.d/mamba.sh"
fi
# <<< conda initialize <<<

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

andyjjrt avatar Feb 27 '25 15:02 andyjjrt

I think it's likely to be something incompatible in your .zshrc file. For context, Warp injects a shell integration that we rely on to and there's a few other shell integrations/plugins that interfere with this. I know you already looked at our known issues, but there's probably something else in here causing the shell to fail to start in Warp. One thing I noticed was that you're sourcing fzf in your file. Can you comment out the following and see if it works?

export FZF_DEFAULT_COMMAND="bfs -L -type f -exclude -name .git -exclude -name .cache -exclude -name node_modules 2> /dev/null"
export FZF_DEFAULT_OPTS='--tmux 75%,60%'
export FZF_CTRL_T_OPTS="--preview '(bat --color=always --style=numbers {} || tree -C {}) 2> /dev/null'"
export FZF_CTRL_R_OPTS='--no-sort --exact --reverse'
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

If that doesn't work, it's likely to be something else in your RC file that doesn't play nicely with Warp.

abhishek-pandya avatar Feb 27 '25 18:02 abhishek-pandya

@andyjjrt Can you try logging into that WSL instance from a different terminal and running this command and posting the output?

echo $OSTYPE

acarl005 avatar Feb 27 '25 20:02 acarl005

@abhishekp106 I know there may be conflict with fzf since document has mentioned. I've tried adding if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then... to wrap up whole .zshrc, it doen't work either.

I just tried to deactivate my .zshrc by modifiy its name to .zshrc.bak and created a new one without any configuration. Image Sadly it has the same problem.

@acarl005 $OSTYPE was in the screenshot above too.

Hope these information helps. Really appreciate what you've done.

andyjjrt avatar Feb 28 '25 02:02 andyjjrt

Can you try pasting this whole snippet in there and post the output?

 unsetopt ZLE
 WARP_SESSION_ID="$(command -p date +%s)$RANDOM"
 _hostname=$(command -pv hostname >/dev/null 2>&1 && command -p hostname 2>/dev/null || command -p uname -n)
 _user=$(command -pv whoami >/dev/null 2>&1 && command -p whoami 2>/dev/null || echo $USER)
 _msg=$(printf "{\"hook\": \"InitShell\", \"value\": {\"session_id\": $WARP_SESSION_ID, \"shell\": \"zsh\", \"user\": \"$_user\", \"hostname\": \"$_hostname\"}}" | command -p od -An -v -tx1 | command -p tr -d " \n")
if command -p grep --silent --no-messages microsoft /proc/version 2>/dev/null || [[ "$OSTYPE" == "msys" ]]; then WARP_USING_WINDOWS_CON_PTY=true; else WARP_USING_WINDOWS_CON_PTY=false; fi
if [ "$WARP_USING_WINDOWS_CON_PTY" = true ]; then printf 'e]9278;d;%s' $_msg; else printf 'e\x50\x24\x64%s\x9c' $_msg; fi
 unset _hostname _user _msg

acarl005 avatar Feb 28 '25 03:02 acarl005

@acarl005 Here's the output in Windows Terminal

Image

andyjjrt avatar Feb 28 '25 11:02 andyjjrt

Ah! We're closing in on the problem... Can you run 2 more for me?

cat /proc/version
command -p grep microsoft /proc/version

acarl005 avatar Feb 28 '25 12:02 acarl005

@acarl005 Thanks! Here's screensot

Image

andyjjrt avatar Feb 28 '25 12:02 andyjjrt

There's the problem. We assumed the /proc/version would contain the string "Microsoft" but that's not true here. May I ask how you created this WSL container?

acarl005 avatar Feb 28 '25 12:02 acarl005

@acarl005 Really thanks, I was trying to use intel's iGPU to accelerate my program, so I clone microsoft/WSL2-Linux-Kernel to build a newer kernel for iGPU driver. This is why my /proc/version don't contain "Microsoft". After I change kernel back to default one, warp initialized pefectly!!!

Image

So maybe its not a good idea to detect "Microsoft" in /proc/version, since people may build their own kernel.

Once again, thanks for your help.🎉

andyjjrt avatar Feb 28 '25 12:02 andyjjrt

:wave: I think I am experiencing the same issue. I use a custom kernel (https://github.com/Locietta/xanmod-kernel-WSL2) installed via Scoop. In my case, the content of proc/version is Linux version 6.12.11-locietta-WSL2-xanmod1 (root@dab96eaf4778) (Fuchsia clang version 20.0.0git (https://llvm.googlesource.com/llvm-project b9efbed468ec18044070eea936c694fb8f6e244b), Fuchsia LLD 20.0.0 (https://llvm.googlesource.com/a/llvm-project b9efbed468ec18044070eea936c694fb8f6e244b)) #1 SMP PREEMPT_DYNAMIC Mon Jan 27 11:06:28 UTC 2025.

mtunski avatar Mar 03 '25 11:03 mtunski

There's a fix in review. Hoping to get this released this week. If not probably next week's release.

acarl005 avatar Mar 03 '25 16:03 acarl005

The fix for this is out in the latest release, so custom kernels should no longer interfere with Warp initializing. @andyjjrt You should be able to switch back to that newer kernel you were using, if you'd like. I'll close this issue for now, but please report if you continue to have issues!

abhishek-pandya avatar Mar 10 '25 16:03 abhishek-pandya