WSL: gitstatus failed to initialize. Can't open file /tmp/*

Version

Microsoft Windows [Version 10.0.19044.1706]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.16.3

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

  1. Install Ubuntu with WSL2
  2. Install oh-my-zsh and powerlevel10k in Ubuntu
  3. Terminate WSL with wsl -t Ubuntu
  4. Run Ubuntu

image

Expected Behavior

No errors on load

Actual Behavior

Getting an error:

[ERROR]: gitstatus failed to initialize.


  Zsh log (/tmp/gitstatus.POWERLEVEL9K.1000.4.1653403319.1.xtrace.log):

    +(anon):7> setopt monitor
    +(anon):9> ((  ! _GITSTATUS_STATE_POWERLEVEL9K  ))
    +(anon):51> ((  ! async  ))
    +(anon):52> ((  _GITSTATUS_CLIENT_PID_POWERLEVEL9K == sysparams[pid]  ))
    +(anon):54> local pgid
    +(anon):55> ((  0 < 20  ))
    +(anon):56> [[ -t 20 ]]
    +(anon):57> sysread -s 20 -t 5.0000000000 -i 20 'pgid[$#pgid+1]'
    +(anon):55> ((  20 < 20  ))
    +(anon):59> [[ '                  90' == \ #<1-> ]]
    +(anon):60> typeset -gi 'GITSTATUS_DAEMON_PID_POWERLEVEL9K=pgid'
    +(anon):62> sysopen -w -o cloexec -u req_fd -- /tmp/gitstatus.POWERLEVEL9K.1000.4.1653403319.1.fifo
    (anon):sysopen:62: can't open file /tmp/gitstatus.POWERLEVEL9K.1000.4.1653403319.1.fifo: no such file or directory
    +(anon):62> return

  System information:

    zsh:      5.8
    uname -a: Linux LAPTOP-IRKGT53C 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Diagnostic Logs

WslLogs-2022-05-24_20-41-47.zip

As the gitstatus creator states:

WSL2 on Win11 starts shell while the OS is booting up. This leads to weird things such as /tmp missing. https://github.com/romkatv/gitstatus/issues/234#issuecomment-1097968209

This happens only on load of Ubuntu, if I open it again there’s no error: image So you need to terminate the Ubuntu WSL and open it again to get this error

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15

Most upvoted comments

It’s expected that the theme is gone. We just want to trigger the error.

Please try this ~/.zshrc:

source ~/gitstatus/gitstatus.plugin.zsh
gitstatus_start -a MY
sleep 1.0
gitstatus_start MY

If this doesn’t produce the error, try replacing 0.5 with 0.0, 0.1, 0.5, 1.0 and 2.0.

My current theory is that all files under /tmp get deleted soon after WSL boots up. This explains the error and also why the xtrace file is missing the first half. To clarify, gitstatus_start -a MY creates /tmp/gitstatus.*.fifo and gitstatus_start MY tries to open it. We have a sleep in between to wait for whatever process is responsible for deleting our files.