Skip to content

Linux - Hardware

Hardware🔗

Disks, Blockdevices, Storage🔗

1
2
3
4
5
6
dmesg # monitor change of state udev
udevadm monitor # udev
lsusb # list usb devices
inxi -D
lshw -class disk
smartctl -i /dev/sdX # detailed vendor and model info

RAM🔗

1
2
3
cat /proc/meminfo
sudo dmidecode --type 17
inxi -m

Audio🔗

GPU🔗

1
2
lspci -v | less # and search vor `VGA`
sudo lshw -numeric -C display
  • NVIDIA: nvidia-smi
    • find correct driver (version)
    • load kernel module without reboot

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      # check if there is someone logged in
      ps ax | grep -i X
      # stop lightdm
      systemctl stop lightdm
      # stop everything that might be using nvidia
      for f in /sys/class/vtconsole/vtcon*/bind; do echo 0 > $f; done
      # remove old nvidia module
      rmmod nvidia_uvm nvidia_drm nvidia_modeset nvidia
      # load new nvidia module
      modprobe nvidia
      # check if nvidia is working
      nvidia-smi
      # start lightdm
      systemctl start lightdm
      

Other🔗

1
lspci # list PCI devices

Udev🔗

ArchLinux Wiki | Debian Wiki

  1. find device (information) for example with
1
2
# udevadm monitor --environment --udev
# dmesg
  1. Get device attributes
1
# udevadm info --atribute-walk --name="/dev/input/by-path/..."
  1. add rule to /etc/udev/rules.d/??.rules and point to script, for example in /usr/local/bin,
  2. create script to run commands
  3. Reload udev rules
1
# udevadm control --reload-rules

Examples

MAC Address🔗

Spoofing🔗

https://www.xmodulo.com/spoof-mac-address-network-interface-linux.html
https://arvdl.github.io/posts/mac-address-linux/

  • temporary ^8a2c0a
1
2
3
sudo ip link set dev eth0 down
sudo ip link set dev eth0 address 00:00:00:00:00:01
sudo ip link set dev eth0 up
  • permanent

    • with NetworkManager: edit /etc/NetworkManager/dispatcher.d/00-changemac
    1
    2
    3
    4
    #!/bin/sh
    if [ "$IFACE" = eth0 ]; then
      ip link set dev "$IFACE" address 00:00:00:00:00:01
    fi
    

    and change permissions sudo chmod 755 /etc/NetworkManager/if-up.d/00-changemac

    • with Systemd: edit /etc/systemd/network/eth0.link
    1
    2
    3
    4
    5
    6
    [Match]
    MACAddress=xx:xx:xx:xx:xx:xx
    
    [Link]
    MACAddressPolicy=random
    NamePolicy=kernel database onboard slot path
    

Devices🔗

USB🔗

1
lsusb
  • set what USB devices are allowed to wake from sleep/hibernate, see here. Edit /sys/bus/usb/devices/usb*/power/wakeup with content disabled or enabled

Keyboard🔗

  • Change layout
    • command line: sudo loadkeys en_US
    • X: setxkbmap en_US
  • if not waking up after device was suspended try https://askubuntu.com/a/949679 ^bf1df0

    • find device ID in lsusb
    • edit /etc/default/grub and add to GRUB_CMDLINE_LINUX_DEFAULT:
    1
    2
    3
    usbhid.quirks=0x*ID_before_colon*:0x*ID_after_colon*:0x00000008
    # or try
    atkbd.reset # might need sudo modprobe psmouse if touchpad stops working
    
    • update grub on boot device: update-config (doesn’t exist as a command in openSUSE, use sudo grub2-mkconfig -o /boot/grub2/grub.cfg instead)
    • OpenRGB: Open source RGB lighting control that doesn’t depend on manufacturer software