Which distribution?
I use LMDE 6 (Linux Mint Debian Edition)
GPU Passthrough Process
Get IOMMU groups and device IDs:
#!/bin/bash
shopt -s nullglob
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
echo "IOMMU Group ${g##*/}:"
for d in $g/devices/*; do
echo -e "\t$(lspci -nns ${d##*/})"
done;
done;
Replace DEVICE_ID1 and DEVICE_ID2 with your actual device id that you want to passthrough.
GPUs usually have two IDs associated with them. 1 for GPU itself and 1 for audio controller built-in.
Part 1 | |
---|---|
Open Grub config | sudo nano /etc/default/grub |
Find the line | GRUB_CMDLINE_LINUX= |
Add | intel_iommu=on iommu=pt vfio-pci.ids=DEVICE_ID1,DEVICE_ID2 |
Apply Grub config changes | sudo update-grub | Part 2 |
Open vfio.conf | sudo nano /etc/modprobe.d/vfio.conf |
Add lines | options vfio-pci ids=DEVICE_ID1,DEVICE_ID2 softdep nvidia pre: vfio-pci |
This line will prevent nvidia to takeover | softdep nvidia pre: vfio-pci |
Update initramfs | sudo update-initramfs -k all -u |
Reboot.
Now GPU shouldn't be available for the host machine.
Check the drivers in use: lspci -k
Kernel driver in use should be vfio-pci for the selected GPU.
Virt Manager Notes
Error | Solution |
---|---|
Access permission error | Open with sudo virt-manager |
Default network inactive | Right click QEMU/KVM, click details, switch to Virtual Networks tab, start necessary pools |
Set CPU topology manually. Last time I didn't use that option while creating a Windows VM and allocation of 8 cores ended up showing 2 different CPUs with 1 cores each, 2 cores total. Performance was bad, Unreal wasn't opening.
Backup VMs' XMLs. They won't boot with different name/uuid. Title change is fine.
CPU Pinning
Specifying which cores VM is allowed to use. Good for giving VM only the P cores.
Enable XML editing at preferences of virt-manager.
Find the line: <vcpu placement='static'>16</vcpu>
Add: cpuset='desiredCores' after placement='static'
For example: <vcpu placement='static' cpuset='0-15'>16</vcpu>
cpuset='0-15' gives all cores starting from 0 to 15
cpuset='0,2,4,6,8' gives specified cores
Sharing Folder
Name you enter to target path will be the mounted folder name.
For example if you named it hostFolder
Auto Mount | Manual |
---|---|
Edit fstab: sudo nano /etc/fstab | Create a folder on desktop. For example: mountFolder |
Add line: hostFolder /home/USERNAME/Desktop/mountFolder virtiofs defaults 0 0 | sudo mount -t virtiofs hostFolder ./Desktop/mountFolder |
Reload fstab: systemctl daemon-reload | |
For error checking try to mount everything in the fstab: sudo mount -a | |
It will be auto mounted on boot now. |
Install virtio drivers |
Install winfsp |
Start service virtiofs service. Set startup type to automatic |
Reboot |
hostFolder should be auto mounted as a drive in explorer now. |
Qemu Notes
Resize disk image
Only images in raw format can be resized in both directions, whereas qcow2 images can be grown but cannot be shrunk.
Browse to the location of the image file.
Launch terminal/console
sudo qemu-img resize -f fmt fileName [+|-]size[K|M|G|T|P|E]
-f specifies the disk image format. It is guessed automatically if you don't specify.
Replace "fileName" with the image name you want to resize.
Replace "size" with the amount you want to add or shrink.
"+" to increase size. After growing a disk image, you must use file system and partitioning tools inside the VM to actually begin using the new space on the device.
"-" to shrink size. Before shrinking a disk image, you must use file system and partitioning tools inside the VM itself to reduce allocated file systems and partition sizes accordingly. Failure to do so will result in data loss.
Use K for kilobytes(1024), M for megabytes(1024k), G for gigabytes(1024M), T for terabytes(1024G), P for Petabytes(1024T), E for exabytes(1024P).
For example: sudo qemu-img resize -f raw test.img +50G
Increases the size of test.img by 50 gigabytes.
Cinnamon Notes
Theme Editing
Open system settings, go to themes.
Click advanced settings.
Get the name of the current desktop/application theme.
They use the same theme by default.
Default theme files are located in /usr/share/themes
Duplicate your current theme folder and rename it.
This name will show up in desktop/application themes now.
Open the cinnamon and gtk-3 folder inside the folder you just renamed.
Edit cinnamon.css, gtk.css, gtk-dark.css
Select the new theme.
Restart Cinnamon to see your changes in effect. Press Alt+F2 and enter restart
Show hidden files Ctrl+H
You can move your new theme into /home/USERNAME/.themes but some apps won't apply themes in that folder.
Desktop Panel
Open cinnamon.css of your theme.
Find the line: .panel-top, .panel-bottom, .panel-left, .panel-right
background-color property affects the color and opacity of the desktop panel.
Restart Cinnamon to see your changes in effect.
Precise Mouse Settings
Speed slider under "Pointer size and speed" in "Mouse and Touchpad" settings changes the "libinput Accel Speed".
"libinput Accel Speed" is a global setting. It applies to every connected mouse.
You can find this setting under: xinput list-props id
Find your device id: xinput list
I just adjust the slider and check the value with xinput list-props until I get the value I want.
Ramdisk Creation
ramfs is older, use tmpfs. I didn't research thoroughly but tmpfs is very easy to use.
tmpfs doesn't fill allocated space right away. It is dynamic. It means if it's empty it won't use any space at all. The size you specify is the upper limit.
Create a folder for mounting.
For example: A folder called ramdisk on Desktop
Auto mount on boot
Edit fstab: sudo nano /etc/fstab
Add the line: tmpfs /home/USERNAME/Desktop/ramdisk tmpfs defaults,size=4096m 0 0
Reboot
Manual
To mount: sudo mount -t tmpfs -o size=4096m tmpfs Desktop/ramdisk
Check with df -h Desktop/ramdisk
To unmount: sudo umount Desktop/ramdisk
Search File
You can use file managers' search function too but terminal is much faster when searching through lots of files and directories.
Search by name | find /path -name "filename" |
Search by extension | find /path -name "*.extension" |
You can use "-maxdepth desiredNumber" to limit subdirectories.
For example find /home/USERNAME/Desktop -maxdepth 1 -name "example.txt" searches for example.txt in desktop but it doesn't go through all the directories present in desktop.
Linux Essentials
Guake | Drop down terminal | |
Flatseal | Flatpak permission manager | Flathub |
Warehouse | Flatpak manager | Flathub |
Parabolic | Media downloader | Flathub |
Puddletag | Audio tag editor | |
MediaInfo | Metadata reader | |
Mission Center | System monitor / Task manager | Flathub |
Krita | Painting / Image manipulation | Flathub |
Gimp | Image manipulation | Flathub |
Inkscape | Vector graphics | |
Blender | 3D creation | |
OBS | Recording / Streaming | Flathub |
Newsflash | RSS reader | Flathub |
Hardinfo | System information | |
Virt-Manager | Virtual machine manager. GUI for QEMU / KVM | |
Ventoy | Bootable USB | |
Bleachbit | Cleanup | |
Tenacity | Audio editing (Audacity without telemetry) | Flathub |
Handbrake | Video Transcoder | Flathub |
PeaZip | File archiver | Flathub |
Blanket | Environment sounds | Flathub |
Gradience | Adwaita customizer | Flathub |
Gparted | Partition editor | |
Gpick | Color picker |
Linux Gaming
Steam and Heroic Launcher (for GOG and Epic store and library) are the easiest options.
Check Proton DB for compatibility information
Check Linux VR Adventures (LVRA) Wiki for Virtual Reality (VR) information