Artstation Github Mastodon Youtube

Necdet Yavaş

Linux Notes

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;

Open Grub config: sudo nano /etc/default/grub

Find the line: GRUB_CMDLINE_LINUX=""

Add: intel_iommu=on iommu=pt vfio-pci.ids=deviceid1,deviceid2

Apply Grub config changes: sudo update-grub

Reboot

Open vfio.conf: sudo nano /etc/modprobe.d/vfio.conf

Add lines:
options vfio-pci ids=deviceid1,deviceid2
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

ErrorSolution
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

Linux:
Create a folder on desktop.For example: mountFolder
sudo mount -t virtiofs hostFolder ./Desktop/mountFolder

Windows:
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.

LMDE 6 Cinnamon Notes

Cinnamon Theme Editing

Open system settings, go to themes.

Click advanced settings.

Get the name of the current desktop theme.

Default theme files are located in /usr/share/themes

Show hidden files Ctrl+H

Copy your current theme folder and paste into /home/USERNAME/.themes

Rename the folder you just pasted.

This name will show up in desktop themes now.

Select the new theme.

Open the cinnamon folder inside the folder you just renamed.

Edit cinnamon.css

Restart Cinnamon to see your changes in effect. Press Alt+F2 and enter restart

Cinnamon 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.