neofetch icon indicating copy to clipboard operation
neofetch copied to clipboard

WSL2 Linux enumerating "packages" takes a long time

Open akuropka opened this issue 3 years ago • 3 comments

At first, thanks for your efforts and this great tool!

Description

[X] Does this issue still occur in the master branch? (commit ccd5d9f52609bbdcd5d8fa78c4fdb0f12954125f)

Enumerating installed packages on a WSL2g machine is comparatively awfully slow as it takes 2-3 seconds. I tested it with Arch (https://github.com/yuk7/ArchWSL) as well as Ubuntu (https://www.microsoft.com/store/apps/9P9Q5ZH1HRR0) with the same result so any difference neither in OS flavour nor in package manager seems to make a difference. On the other hand the very same edition of neofetch works as expected on a Raspberry Pi's Arch Linux Arm. The verbose logs do not seem to show any difference, since there's no timestamp I was not able to reveal where the lag exactly happens.

Neofetch version

7.1.0

Screenshots

20220103_125640_Arch 20220103_125907_ubuntupreview 20220103_130214_putty

Config file

config.txt (Above is for ArchWSL, UbuntuWSL and ArchRPI are unmodified thus standard config.)

Verbose log

archwsl.log ubuntuwsl.log archrpi.log

akuropka avatar Jan 03 '22 12:01 akuropka

Bump

WalterWoshid avatar Jul 15 '22 07:07 WalterWoshid

bump

Jacob26502 avatar Jan 23 '24 21:01 Jacob26502

The problem is probably caused by the PATH variable. Since WSL append Windows PATH variable to its PATH variable and WSL by default is able to launch Windows programs, determining whether a command exists or not becomes way slower. Therefore the has() function which neofetch utilizes to find which package manager exists becomes slow, resulting in the problem.

If you don't need to launch Windows programs in WSL, you can fix this by adding the following lines to /etc/wsl.conf and restart the WSL with wsl --shutdown (tested with WSL2, don't know if it works with WSL1)

[interop]
enabled=false
appendWindowsPath=false

I ran into this problem earlier and found this issue. Don't know if you guys still need this (hope can help someone :D).

wafarm avatar Feb 01 '24 08:02 wafarm