Finding GPU without lspci
Debian 10 under WSL2, script throws an error when trying to find a GPU:
gpu ~ ./fetch.sh: line 67: lspci: command not found
Looks like pciutils might not be installed by default on Debian, at least when running without a desktop.
Really trying to resolve this as soon as possible.. I look around and went through some alternative's code and noticed they used lspci as well. Finding a work around to stat gpu without another external dependency could be difficult. I'm working on statement to make output 2 gpu's if exist on new line like gpu1 ~ ... gpu2 ~ ...
I also saw the same error in Debian 10 LXC containers running on Proxmox. It's possible both WSL and LXC are running slimmed-down OS images that lack some utils related to physical hardware. I don't have a full Debian system (physical or VM) at hand right now.
@IndrekHaav I made a way to extract vendor and device id from /proc/bus/pci/devices, which we can use to get GPU info. I need to see output other than my own to see if some common fields exist. If you can share the output of cat /proc/bus/pci/devices; I can likely make this work
If anyone can share their output of /proc/bus/pci/devices; I believe we will have the only alternative to lspci, with no dependency. Currently there is no other method to get GPU information on Linux. I think I found a way around that. The script I made in testing returns the value scraped from a PCI ID database. I need to find consistencies in /proc/bus/pci/devices to be able to utilize the correct vendor and device ID
Debian 10 on WSL2:
~$ cat /proc/bus/pci/devices
0000 1414008e 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 dxgkrnl
This isn't the right line from /proc/bus/pci/devices. It does contain your vendor ID but there is a specific line that contains the vendor and device ID in the 2nd field combines like 1414 is your vendor. The ending 4 should be your device ID. I found a consistency in mine and another's output. On the line that contains the vendor and device ID, I found that there was a number ending in 0000c on that line somewhere. I use that to print the line then grab field 2 from it.
This is the relevant line on my system:
0600 10026995 41 d000000c 0 e000000c 0 e001 fcf00000 c0002 10000000 0 200000 0 100 40000 20000 amdgpu
From field 2, 1002 is the vendor ID and 6995 is the device ID, which I used to scrape the name of the GPU from this PCI ID database. Returning: Advanced Micro Devices, Inc. [AMD/ATI] Lexa XT [Radeon PRO WX 2100]
I just pushed a commit to testing with the changes I found. It's labeled gpu-nix, hopefully it will work for everyone
That's all the output I got.
That's odd.. What type of GPU do you have? I edited my comment above to give more perspective on how it works