for-win icon indicating copy to clipboard operation
for-win copied to clipboard

compinit:501: no such file or directory: /usr/share/zsh/vendor-completions/_docker

Open MaurGi opened this issue 6 years ago • 27 comments

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [ ] I have uploaded Diagnostics
  • Diagnostics ID:

Expected behavior

No issues with zsh completions and compinit when starting a new shell

Actual behavior

I installed Docker for Windows 2.3.0.4 on Windows 10 Version 2004 (build 19041.450) and enabled WSL integration. Then I turned off Docker for Windows because of resource consumptions. Now I get this error every time I start my zsh shell:

compinit:501: no such file or directory: /usr/share/zsh/vendor-completions/_docker

I noticed that the file /usr/share/zsh/vendor-completions/_docker is a link to a wsl mount:

$ ls -l /usr/share/zsh/vendor-completions/_docker
lrwxrwxrwx 1 root root 74 Sep  3 11:17 /usr/share/zsh/vendor-completions/_docker -> /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker

so I assume this file is present only when Docker for Windows is running, but I need to turn it off or my machine won't make it.

my ~/.zshrc file is:

plugins=(git docker zsh-completions)

source $ZSH/oh-my-zsh.sh

# zsh-completions
autoload -U compinit && compinit

Information

  • Windows Version:
  • Docker Desktop Version:
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM:

Steps to reproduce the behavior

  1. Configure oh-my-zsh plugins, add docker
  2. Install Docker For Windows
  3. Turn off Docker for Windows
  4. Open a shell

MaurGi avatar Sep 03 '20 20:09 MaurGi

Any solution to this?

hostmit avatar Sep 07 '20 12:09 hostmit

@simonferquel Have you seen this before?

stephen-turner avatar Sep 08 '20 17:09 stephen-turner

I confirm this happens only with docker on windows turned off.

hostmit avatar Sep 08 '20 17:09 hostmit

Yes, this is because completion scripts are symlinks to files in the cli-tools iso file. This iso file is mounted by Docker Desktop on startup. We could probably explore ways to remove the symlinks on a clean shutdown.

simonferquel avatar Sep 08 '20 17:09 simonferquel

On removing Docker Desktop the symlinks still appear (On Windows 10, WSL2)

khashashin avatar Sep 12 '20 12:09 khashashin

FYI This issue is in progress in our current sprint.

stephen-turner avatar Sep 15 '20 14:09 stephen-turner

Reopening this ticket. It's fixed internally, but not yet released.

stephen-turner avatar Sep 22 '20 08:09 stephen-turner

Hi Stephen, when will be the release? Thanks.

tik9 avatar Oct 14 '20 07:10 tik9

Provisionally scheduled for 2 Nov.

stephen-turner avatar Oct 14 '20 12:10 stephen-turner

This also happens if you had WSL2 integration enabled (by checking Resources → WSL Integration → Enable integration with my default WSL distro) and then change your "default distro" back to WSL1 with wsl --set-version linux-distro 1.

brunosaboia avatar Oct 16 '20 12:10 brunosaboia

any updates on this?

LavHinsu avatar Oct 22 '20 07:10 LavHinsu

@LavHinsu Yes, look two comments above yours.

stephen-turner avatar Oct 22 '20 08:10 stephen-turner

@brunosaboia in order to be safe, I checked it with wsl -l -v and got 2.

tik9 avatar Oct 24 '20 12:10 tik9

I was facing same issue, heres what I did

First I removed the symlink

sudo rm -rf /usr/share/zsh/vendor-completions/_docker

then I copied over the wsl completions

sudo cp /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker /usr/share/zsh/vendor-completions/

and made it non-writable

sudo chattr +i /usr/share/zsh/vendor-completions/_docker

now next time we launch wsl when docker is not running we wont get that error

pavanjadhaw avatar Oct 29 '20 05:10 pavanjadhaw

the same problem, when I add docker in zsh plugins it's sloved:

plugins=(
docker
zsh-syntax-highlighting
zsh-autosuggestions
)
  • Windows Version: 2004 (OS build 19041.572)
  • Docker Desktop Version: 2.4.0.0(48506) [Channel stable]
  • WSL2: Ubuntu-20.04

tianheg avatar Oct 30 '20 10:10 tianheg

This was fixed in 2.5.0.0.

stephen-turner avatar Nov 06 '20 09:11 stephen-turner

This was fixed in 2.5.0.0.

I'm on version 3.0.0 (50684) and getting this error when starting a WSL 2 instance with Docker for Windows not running. Is there something else that needs to be done manually?

ianmartorell avatar Dec 17 '20 08:12 ianmartorell

This was fixed in 2.5.0.0.

Same as @ianmartorell I'm on last version, 3.0.0 (50684) and the error still occurs when starting WSL2 instance without a running Docker for Windows instance. Can you provide some manual procedure which can prevent this?

3ric-T avatar Dec 21 '20 07:12 3ric-T

This was fixed in 2.5.0.0.

Same as @ianmartorell I'm on last version, 3.0.0 (50684) and the error still occurs when starting WSL2 instance without a running Docker for Windows instance. Can you provide some manual proceudre which can prevent this?

Starting the Docker Desktop fixed it for me. I suppose adding logic to .zshrc script to test the docker presence prior to loading the theme proposed above: by @pavanjadhaw would be a good fix. Or, maybe replacing the error message with a notification "Docker Desktop not running"

bodzio4749 avatar Jan 09 '21 22:01 bodzio4749

@bodzio4749 @pavanjadhaw The workaround works for me, thanks a lot I'll have to remember to do this at every Docker Desktop upgrade

3ric-T avatar Jan 15 '21 09:01 3ric-T