<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.steffe.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stefan</id>
	<title>indicium - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.steffe.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stefan"/>
	<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php/Special:Contributions/Stefan"/>
	<updated>2026-05-13T20:29:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=284</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=284"/>
		<updated>2025-05-09T13:35:23Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
==== Install latest Nvidia drivers from Nvidia (instead of Debian) ====&lt;br /&gt;
&lt;br /&gt;
https://linuxcapable.com/install-nvidia-drivers-on-debian/&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Possible missing firmware ===&lt;br /&gt;
&lt;br /&gt;
Download the missing firmware file from here: https://web.git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
&lt;br /&gt;
Then copy it into /lib/firmware and run&lt;br /&gt;
 sudo update-initramfs -u&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
 ls -l /dev/mapper&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 sudo lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 sudo lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;-r&amp;quot; option above should make sure to resize the actual file system that resides in that logical volume. If it does not, or you want to do it manually, you can things such as:&lt;br /&gt;
&lt;br /&gt;
===== ext4 ===== &lt;br /&gt;
 sudo resize2fs /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
===== xfs =====&lt;br /&gt;
 sudo xfs_growfs -d /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM swap ====&lt;br /&gt;
Check current swap status and find your LVM swap partition:&lt;br /&gt;
 cat /proc/swaps&lt;br /&gt;
 lsblk&lt;br /&gt;
Then turn off all swaps, resize the swap partition, re-format it as swap and enable it again:&lt;br /&gt;
 sudo swapoff -a&lt;br /&gt;
 sudo lvresize -L +24G /dev/mapper/vg0-swap&lt;br /&gt;
 sudo mkswap /dev/mapper/vg0-swap&lt;br /&gt;
 sudo swapon /dev/mapper/vg0-swap&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
=== Measure elapsed time with precision in bash scripts ===&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
 &amp;lt;cmd&amp;gt;&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
If you then get messages about missing firmware (due to kernel being newer than linux-firmware-nonfree):&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_gsc_1.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/dg2_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_guc_70.bin for module i915&lt;br /&gt;
you can manually:&lt;br /&gt;
* Download the missing firmwares from here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
* Copy them to /lib/firmware/&lt;br /&gt;
* Regenerate initramfs with: &#039;&#039;sudo update-initramfs -u&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;br /&gt;
&lt;br /&gt;
= Clean out journalctl logs =&lt;br /&gt;
 journalctl --flush --rotate --vacuum-time=30d&lt;br /&gt;
&lt;br /&gt;
= Set up public key SSH authentication =&lt;br /&gt;
On your client PC which you want to connect from, run:&lt;br /&gt;
 ssh-keygen&lt;br /&gt;
Accept all the defaults. Use a passphrase if you want to (not for automated setups).&lt;br /&gt;
&lt;br /&gt;
Then send your key to the server for your account:&lt;br /&gt;
 ssh-copy-id -i .ssh/id_rsa.pub 10.0.0.26&lt;br /&gt;
&lt;br /&gt;
If you can not use ssh-copy-id (such as if adding a key for user root which can not log in using password), then simply cat they key from .ssh/id_rsa.pub on your client to the .ssh/authorized_keys file on your server.&lt;br /&gt;
&lt;br /&gt;
= Nice utils =&lt;br /&gt;
parcellite is a nice clipboard manager to synchronize your clipboards!&lt;br /&gt;
 sudo apt install parcellite&lt;br /&gt;
&lt;br /&gt;
ksnip is a great screenshot util to easily take screenshots and add arrows, text boxes etc to the screen shot&lt;br /&gt;
 sudo apt install ksnip&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=280</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=280"/>
		<updated>2025-03-31T06:48:51Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* How to extend your LVM swap */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
==== Install latest Nvidia drivers from Nvidia (instead of Debian) ====&lt;br /&gt;
&lt;br /&gt;
https://linuxcapable.com/install-nvidia-drivers-on-debian/&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Possible missing firmware ===&lt;br /&gt;
&lt;br /&gt;
Download the missing firmware file from here: https://web.git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
&lt;br /&gt;
Then copy it into /lib/firmware and run&lt;br /&gt;
 sudo update-initramfs -u&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM swap ====&lt;br /&gt;
Check current swap status and find your LVM swap partition:&lt;br /&gt;
 cat /proc/swaps&lt;br /&gt;
 lsblk&lt;br /&gt;
Then turn off all swaps, resize the swap partition, re-format it as swap and enable it again:&lt;br /&gt;
 sudo swapoff -a&lt;br /&gt;
 sudo lvresize -L +24G /dev/mapper/vg0-swap&lt;br /&gt;
 sudo mkswap /dev/mapper/vg0-swap&lt;br /&gt;
 sudo swapon /dev/mapper/vg0-swap&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
=== Measure elapsed time with precision in bash scripts ===&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
 &amp;lt;cmd&amp;gt;&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
If you then get messages about missing firmware (due to kernel being newer than linux-firmware-nonfree):&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_gsc_1.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/dg2_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_guc_70.bin for module i915&lt;br /&gt;
you can manually:&lt;br /&gt;
* Download the missing firmwares from here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
* Copy them to /lib/firmware/&lt;br /&gt;
* Regenerate initramfs with: &#039;&#039;sudo update-initramfs -u&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;br /&gt;
&lt;br /&gt;
= Clean out journalctl logs =&lt;br /&gt;
 journalctl --flush --rotate --vacuum-time=30d&lt;br /&gt;
&lt;br /&gt;
= Set up public key SSH authentication =&lt;br /&gt;
On your client PC which you want to connect from, run:&lt;br /&gt;
 ssh-keygen&lt;br /&gt;
Accept all the defaults. Use a passphrase if you want to (not for automated setups).&lt;br /&gt;
&lt;br /&gt;
Then send your key to the server for your account:&lt;br /&gt;
 ssh-copy-id -i .ssh/id_rsa.pub 10.0.0.26&lt;br /&gt;
&lt;br /&gt;
If you can not use ssh-copy-id (such as if adding a key for user root which can not log in using password), then simply cat they key from .ssh/id_rsa.pub on your client to the .ssh/authorized_keys file on your server.&lt;br /&gt;
&lt;br /&gt;
= Nice utils =&lt;br /&gt;
parcellite is a nice clipboard manager to synchronize your clipboards!&lt;br /&gt;
 sudo apt install parcellite&lt;br /&gt;
&lt;br /&gt;
ksnip is a great screenshot util to easily take screenshots and add arrows, text boxes etc to the screen shot&lt;br /&gt;
 sudo apt install ksnip&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=279</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=279"/>
		<updated>2025-03-31T06:47:38Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* LVM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
==== Install latest Nvidia drivers from Nvidia (instead of Debian) ====&lt;br /&gt;
&lt;br /&gt;
https://linuxcapable.com/install-nvidia-drivers-on-debian/&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Possible missing firmware ===&lt;br /&gt;
&lt;br /&gt;
Download the missing firmware file from here: https://web.git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
&lt;br /&gt;
Then copy it into /lib/firmware and run&lt;br /&gt;
 sudo update-initramfs -u&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM swap ====&lt;br /&gt;
Check current swap status and find your LVM swap partition:&lt;br /&gt;
 cat /proc/swaps&lt;br /&gt;
 lsblk&lt;br /&gt;
Then turn off all swaps:&lt;br /&gt;
 sudo swapoff -a&lt;br /&gt;
Resize the swap partition, re-format it as swap and enable it again:&lt;br /&gt;
 sudo lvresize -L +24G /dev/mapper/vg0-swap&lt;br /&gt;
 sudo mkswap /dev/mapper/vg0-swap&lt;br /&gt;
 sudo swapon /dev/mapper/vg0-swap&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
=== Measure elapsed time with precision in bash scripts ===&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
 &amp;lt;cmd&amp;gt;&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
If you then get messages about missing firmware (due to kernel being newer than linux-firmware-nonfree):&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_gsc_1.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/dg2_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_guc_70.bin for module i915&lt;br /&gt;
you can manually:&lt;br /&gt;
* Download the missing firmwares from here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
* Copy them to /lib/firmware/&lt;br /&gt;
* Regenerate initramfs with: &#039;&#039;sudo update-initramfs -u&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;br /&gt;
&lt;br /&gt;
= Clean out journalctl logs =&lt;br /&gt;
 journalctl --flush --rotate --vacuum-time=30d&lt;br /&gt;
&lt;br /&gt;
= Set up public key SSH authentication =&lt;br /&gt;
On your client PC which you want to connect from, run:&lt;br /&gt;
 ssh-keygen&lt;br /&gt;
Accept all the defaults. Use a passphrase if you want to (not for automated setups).&lt;br /&gt;
&lt;br /&gt;
Then send your key to the server for your account:&lt;br /&gt;
 ssh-copy-id -i .ssh/id_rsa.pub 10.0.0.26&lt;br /&gt;
&lt;br /&gt;
If you can not use ssh-copy-id (such as if adding a key for user root which can not log in using password), then simply cat they key from .ssh/id_rsa.pub on your client to the .ssh/authorized_keys file on your server.&lt;br /&gt;
&lt;br /&gt;
= Nice utils =&lt;br /&gt;
parcellite is a nice clipboard manager to synchronize your clipboards!&lt;br /&gt;
 sudo apt install parcellite&lt;br /&gt;
&lt;br /&gt;
ksnip is a great screenshot util to easily take screenshots and add arrows, text boxes etc to the screen shot&lt;br /&gt;
 sudo apt install ksnip&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=278</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=278"/>
		<updated>2025-03-14T13:27:30Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
==== Install latest Nvidia drivers from Nvidia (instead of Debian) ====&lt;br /&gt;
&lt;br /&gt;
https://linuxcapable.com/install-nvidia-drivers-on-debian/&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Possible missing firmware ===&lt;br /&gt;
&lt;br /&gt;
Download the missing firmware file from here: https://web.git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
&lt;br /&gt;
Then copy it into /lib/firmware and run&lt;br /&gt;
 sudo update-initramfs -u&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
=== Measure elapsed time with precision in bash scripts ===&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
 &amp;lt;cmd&amp;gt;&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
If you then get messages about missing firmware (due to kernel being newer than linux-firmware-nonfree):&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_gsc_1.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/dg2_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_guc_70.bin for module i915&lt;br /&gt;
you can manually:&lt;br /&gt;
* Download the missing firmwares from here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
* Copy them to /lib/firmware/&lt;br /&gt;
* Regenerate initramfs with: &#039;&#039;sudo update-initramfs -u&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;br /&gt;
&lt;br /&gt;
= Clean out journalctl logs =&lt;br /&gt;
 journalctl --flush --rotate --vacuum-time=30d&lt;br /&gt;
&lt;br /&gt;
= Set up public key SSH authentication =&lt;br /&gt;
On your client PC which you want to connect from, run:&lt;br /&gt;
 ssh-keygen&lt;br /&gt;
Accept all the defaults. Use a passphrase if you want to (not for automated setups).&lt;br /&gt;
&lt;br /&gt;
Then send your key to the server for your account:&lt;br /&gt;
 ssh-copy-id -i .ssh/id_rsa.pub 10.0.0.26&lt;br /&gt;
&lt;br /&gt;
If you can not use ssh-copy-id (such as if adding a key for user root which can not log in using password), then simply cat they key from .ssh/id_rsa.pub on your client to the .ssh/authorized_keys file on your server.&lt;br /&gt;
&lt;br /&gt;
= Nice utils =&lt;br /&gt;
parcellite is a nice clipboard manager to synchronize your clipboards!&lt;br /&gt;
 sudo apt install parcellite&lt;br /&gt;
&lt;br /&gt;
ksnip is a great screenshot util to easily take screenshots and add arrows, text boxes etc to the screen shot&lt;br /&gt;
 sudo apt install ksnip&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=274</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=274"/>
		<updated>2024-11-20T11:13:55Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Set up public key SSH authentication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
==== Install latest Nvidia drivers from Nvidia (instead of Debian) ====&lt;br /&gt;
&lt;br /&gt;
https://linuxcapable.com/install-nvidia-drivers-on-debian/&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
=== Measure elapsed time with precision in bash scripts ===&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
 &amp;lt;cmd&amp;gt;&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
If you then get messages about missing firmware (due to kernel being newer than linux-firmware-nonfree):&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_gsc_1.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/dg2_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_guc_70.bin for module i915&lt;br /&gt;
you can manually:&lt;br /&gt;
* Download the missing firmwares from here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
* Copy them to /lib/firmware/&lt;br /&gt;
* Regenerate initramfs with: &#039;&#039;sudo update-initramfs -u&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;br /&gt;
&lt;br /&gt;
= Clean out journalctl logs =&lt;br /&gt;
 journalctl --flush --rotate --vacuum-time=30d&lt;br /&gt;
&lt;br /&gt;
= Set up public key SSH authentication =&lt;br /&gt;
On your client PC which you want to connect from, run:&lt;br /&gt;
 ssh-keygen&lt;br /&gt;
Accept all the defaults. Use a passphrase if you want to (not for automated setups).&lt;br /&gt;
&lt;br /&gt;
Then send your key to the server for your account:&lt;br /&gt;
 ssh-copy-id -i .ssh/id_rsa.pub 10.0.0.26&lt;br /&gt;
&lt;br /&gt;
If you can not use ssh-copy-id (such as if adding a key for user root which can not log in using password), then simply cat they key from .ssh/id_rsa.pub on your client to the .ssh/authorized_keys file on your server.&lt;br /&gt;
&lt;br /&gt;
= Nice utils =&lt;br /&gt;
parcellite is a nice clipboard manager to synchronize your clipboards!&lt;br /&gt;
 sudo apt install parcellite&lt;br /&gt;
&lt;br /&gt;
ksnip is a great screenshot util to easily take screenshots and add arrows, text boxes etc to the screen shot&lt;br /&gt;
 sudo apt install ksnip&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=271</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=271"/>
		<updated>2024-10-04T10:20:12Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Graphics drivers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
==== Install latest Nvidia drivers from Nvidia (instead of Debian) ====&lt;br /&gt;
&lt;br /&gt;
https://linuxcapable.com/install-nvidia-drivers-on-debian/&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
=== Measure elapsed time with precision in bash scripts ===&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
 &amp;lt;cmd&amp;gt;&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
If you then get messages about missing firmware (due to kernel being newer than linux-firmware-nonfree):&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_gsc_1.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/dg2_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_guc_70.bin for module i915&lt;br /&gt;
you can manually:&lt;br /&gt;
* Download the missing firmwares from here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
* Copy them to /lib/firmware/&lt;br /&gt;
* Regenerate initramfs with: &#039;&#039;sudo update-initramfs -u&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;br /&gt;
&lt;br /&gt;
= Clean out journalctl logs =&lt;br /&gt;
 journalctl --flush --rotate --vacuum-time=30d&lt;br /&gt;
&lt;br /&gt;
= Set up public key SSH authentication =&lt;br /&gt;
On your client PC which you want to connect from, run:&lt;br /&gt;
 ssh-keygen&lt;br /&gt;
Accept all the defaults. Use a passphrase if you want to (not for automated setups).&lt;br /&gt;
&lt;br /&gt;
Then send your key to the server for your account:&lt;br /&gt;
 ssh-copy-id -i .ssh/id_rsa.pub 10.0.0.26&lt;br /&gt;
&lt;br /&gt;
If you can not use ssh-copy-id (such as if adding a key for user root which can not log in using password), then simply cat they key from .ssh/id_rsa.pub on your client to the .ssh/authorized_keys file on your server.&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Tesla&amp;diff=270</id>
		<title>Tesla</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Tesla&amp;diff=270"/>
		<updated>2024-09-11T06:23:17Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Created page with &amp;quot;Link to Europe 2020 years Model 3 owners manual: https://tesla-info.com/doc/m3/model_3_owners_manual_europe_en_2020_44.pdf&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Link to Europe 2020 years Model 3 owners manual: https://tesla-info.com/doc/m3/model_3_owners_manual_europe_en_2020_44.pdf&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Cars&amp;diff=269</id>
		<title>Cars</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Cars&amp;diff=269"/>
		<updated>2024-09-11T06:22:45Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Touareg]]&lt;br /&gt;
&lt;br /&gt;
[[Golf]]&lt;br /&gt;
&lt;br /&gt;
[[Saab]]&lt;br /&gt;
&lt;br /&gt;
[[Tesla]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=268</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=268"/>
		<updated>2024-08-23T08:23:51Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Linux performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
=== Measure elapsed time with precision in bash scripts ===&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
 &amp;lt;cmd&amp;gt;&lt;br /&gt;
 date +%s.%N&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
If you then get messages about missing firmware (due to kernel being newer than linux-firmware-nonfree):&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_gsc_1.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/dg2_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_huc_gsc.bin for module i915&lt;br /&gt;
 Possible missing firmware /lib/firmware/i915/mtl_guc_70.bin for module i915&lt;br /&gt;
you can manually:&lt;br /&gt;
* Download the missing firmwares from here: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/&lt;br /&gt;
* Copy them to /lib/firmware/&lt;br /&gt;
* Regenerate initramfs with: &#039;&#039;sudo update-initramfs -u&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;br /&gt;
&lt;br /&gt;
= Clean out journalctl logs =&lt;br /&gt;
 journalctl --flush --rotate --vacuum-time=30d&lt;br /&gt;
&lt;br /&gt;
= Set up public key SSH authentication =&lt;br /&gt;
On your client PC which you want to connect from, run:&lt;br /&gt;
 ssh-keygen&lt;br /&gt;
Accept all the defaults. Use a passphrase if you want to (not for automated setups).&lt;br /&gt;
&lt;br /&gt;
Then send your key to the server for your account:&lt;br /&gt;
 ssh-copy-id -i .ssh/id_rsa.pub 10.0.0.26&lt;br /&gt;
&lt;br /&gt;
If you can not use ssh-copy-id (such as if adding a key for user root which can not log in using password), then simply cat they key from .ssh/id_rsa.pub on your client to the .ssh/authorized_keys file on your server.&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=BIOS&amp;diff=260</id>
		<title>BIOS</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=BIOS&amp;diff=260"/>
		<updated>2024-08-06T07:56:18Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;BIOS are generally a bit trickier to configure after the upgrade to DDR5.&lt;br /&gt;
&lt;br /&gt;
= Context Memory Restore =&lt;br /&gt;
&lt;br /&gt;
Once a newly installed computer boots up, expect it to stay black for ~1-2 minutes during boot while DDR is trained.&lt;br /&gt;
&lt;br /&gt;
To avoid this, you can enable _Memory Context Restore_ found here on the ASUS B650E-F:&lt;br /&gt;
 Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore&lt;br /&gt;
By enabling this, the computer will then do one training on the next reboot, and then reuse that data for upcoming boots, giving the same kind of boot behavior as DDR4 and below.&lt;br /&gt;
&lt;br /&gt;
= AMD EXPO =&lt;br /&gt;
&lt;br /&gt;
This allows for auto overclocking according to your DDR5 memory. This may increase DDR training time.&lt;br /&gt;
&lt;br /&gt;
Enabling both AMD EXPO and Context Memory Restore should work well, but sometimes it gives stability issues, and you have to refrain from using one of them.&lt;br /&gt;
&lt;br /&gt;
For me, it worked fine with the 1807 BIOS, but not with the 2616 or 3014 BIOS.&lt;br /&gt;
&lt;br /&gt;
= No display =&lt;br /&gt;
Sometimes the displayport can not be used while configuring BIOS. This is the case on the ASUS B650E-F in conjunction with a RTX 3070 graphics card. You have to connect the HDMI to see the BIOS screen every time.&lt;br /&gt;
&lt;br /&gt;
= Method for BIOS updating for ASUS Rog Strix B650E =&lt;br /&gt;
* Connect HDMI to monitor&lt;br /&gt;
* Disconnect Displayport to monitor&lt;br /&gt;
* Put BIOS CAP file on USB stick and reboot into bios (DEL after DDR5 training)&lt;br /&gt;
* Advanced - Tools - EZ Flasher, update BIOS&lt;br /&gt;
* After full update, hit F1 to enter BIOS, do a &amp;quot;Load Optimized Defaults&amp;quot; and reboot again&lt;br /&gt;
* Go into BIOS and change:&lt;br /&gt;
** Advanced - Ai Tweaker - Ai Overclock Tuner - EXPO I&lt;br /&gt;
** Advanced - Boot - Secure Boot - OS Type - Windows UEFI Mode&lt;br /&gt;
** Advanced - Boot - Secure Boot - Secure Boot Mode - Standard&lt;br /&gt;
* Save and reboot, verify that Windows boots and is stable. Verify DDR frequency is 3GHz (DDR-6000).&lt;br /&gt;
* Either be happy here and live with 1.5 minutes extra boot time, or attempt Memory Context Restore (NOTE: May crash your Windows installation and/or file system):&lt;br /&gt;
** Reboot again, hit DEL (after DDR training) to enter BIOS and change (MUST set ALL of them):&lt;br /&gt;
*** Advanced - Ai Tweaker - DRAM Timing Control - Memory Context Restore - Enabled&lt;br /&gt;
*** Advanced - Ai Tweaker - DRAM Timing Control - Power Down Enable - Enabled&lt;br /&gt;
*** Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore - Enabled&lt;br /&gt;
*** Advanced - AMD CBS - UMC Common Options - DDR options - DDR Controller Configuration - DDR Power Options - Power Down Enabled - Enabled&lt;br /&gt;
** Save and reboot (DDR training will happen one final time)&lt;br /&gt;
** Verify that Windows boots and is stable.&lt;br /&gt;
** Reboot, DDR training should now be much faster. Verify that Windows is stable. Verify DDR frequency is 3GHz (DDR-6000)&lt;br /&gt;
* Finally disconnect HDMI and reconnect Displayport.&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=BIOS&amp;diff=259</id>
		<title>BIOS</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=BIOS&amp;diff=259"/>
		<updated>2024-08-06T07:44:06Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;BIOS are generally a bit trickier to configure after the upgrade to DDR5.&lt;br /&gt;
&lt;br /&gt;
= Context Memory Restore =&lt;br /&gt;
&lt;br /&gt;
Once a newly installed computer boots up, expect it to stay black for ~1-2 minutes during boot while DDR is trained.&lt;br /&gt;
&lt;br /&gt;
To avoid this, you can enable _Memory Context Restore_ found here on the ASUS B650E-F:&lt;br /&gt;
 Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore&lt;br /&gt;
By enabling this, the computer will then do one training on the next reboot, and then reuse that data for upcoming boots, giving the same kind of boot behavior as DDR4 and below.&lt;br /&gt;
&lt;br /&gt;
= AMD EXPO =&lt;br /&gt;
&lt;br /&gt;
This allows for auto overclocking according to your DDR5 memory. This may increase DDR training time.&lt;br /&gt;
&lt;br /&gt;
Enabling both AMD EXPO and Context Memory Restore should work well, but sometimes it gives stability issues, and you have to refrain from using one of them.&lt;br /&gt;
&lt;br /&gt;
For me, it worked fine with the 1807 BIOS, but not with the 2616 or 3014 BIOS.&lt;br /&gt;
&lt;br /&gt;
= No display =&lt;br /&gt;
Sometimes the displayport can not be used while configuring BIOS. This is the case on the ASUS B650E-F in conjunction with a RTX 3070 graphics card. You have to connect the HDMI to see the BIOS screen every time.&lt;br /&gt;
&lt;br /&gt;
= Method for BIOS updating for ASUS Rog Strix B650E =&lt;br /&gt;
* Connect HDMI to monitor&lt;br /&gt;
* Disconnect Displayport to monitor&lt;br /&gt;
* Put BIOS CAP file on USB stick and reboot into bios (DEL after DDR5 training)&lt;br /&gt;
* Advanced - Tools - EZ Flasher, update BIOS&lt;br /&gt;
* After full update, hit F1 to enter BIOS, do a &amp;quot;Load Optimized Defaults&amp;quot; and reboot again&lt;br /&gt;
* Go into BIOS and change:&lt;br /&gt;
** Advanced - Ai Tweaker - Ai Overclock Tuner - EXPO I&lt;br /&gt;
** Advanced - Boot - Secure Boot - OS Type - Windows UEFI Mode&lt;br /&gt;
** Advanced - Boot - Secure Boot - Secure Boot Mode - Standard&lt;br /&gt;
* Save and reboot, verify that Windows boots and is stable. Verify DDR frequency is 3GHz (DDR-6000).&lt;br /&gt;
* Either be happy here and live with 1.5 minutes extra boot time, or attempt CBS (NOTE: May crash your Windows installation and/or file system):&lt;br /&gt;
** Reboot again, hit DEL (after DDR training) to enter BIOS and change:&lt;br /&gt;
*** Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore - Enabled&lt;br /&gt;
** Save and reboot (DDR training will happen one final time)&lt;br /&gt;
** Verify that Windows boots and is stable.&lt;br /&gt;
** Reboot, DDR training should now be much faster. Verify that Windows is stable. Verify DDR frequency is 3GHz (DDR-6000)&lt;br /&gt;
* Finally disconnect HDMI and reconnect Displayport.&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=BIOS&amp;diff=258</id>
		<title>BIOS</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=BIOS&amp;diff=258"/>
		<updated>2024-08-06T07:40:47Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;BIOS are generally a bit trickier to configure after the upgrade to DDR5.&lt;br /&gt;
&lt;br /&gt;
= Context Memory Restore =&lt;br /&gt;
&lt;br /&gt;
Once a newly installed computer boots up, expect it to stay black for ~1-2 minutes during boot while DDR is trained.&lt;br /&gt;
&lt;br /&gt;
To avoid this, you can enable _Memory Context Restore_ found here on the ASUS B650E-F:&lt;br /&gt;
 Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore&lt;br /&gt;
By enabling this, the computer will then do one training on the next reboot, and then reuse that data for upcoming boots, giving the same kind of boot behavior as DDR4 and below.&lt;br /&gt;
&lt;br /&gt;
= AMD EXPO =&lt;br /&gt;
&lt;br /&gt;
This allows for auto overclocking according to your DDR5 memory. This may increase DDR training time.&lt;br /&gt;
&lt;br /&gt;
Enabling both AMD EXPO and Context Memory Restore should work well, but sometimes it gives stability issues, and you have to refrain from using one of them.&lt;br /&gt;
&lt;br /&gt;
For me, it worked fine with the 1807 BIOS, but not with the 2616 BIOS.&lt;br /&gt;
&lt;br /&gt;
= No display =&lt;br /&gt;
Sometimes the displayport can not be used while configuring BIOS. This is the case on the ASUS B650E-F in conjunction with a RTX 3070 graphics card. You have to connect the HDMI to see the BIOS screen every time.&lt;br /&gt;
&lt;br /&gt;
= Method for BIOS updating for ASUS Rog Strix B650E =&lt;br /&gt;
* Connect HDMI to monitor&lt;br /&gt;
* Disconnect Displayport to monitor&lt;br /&gt;
* Put BIOS CAP file on USB stick and reboot into bios (DEL after DDR5 training)&lt;br /&gt;
* Advanced - Tools - EZ Flasher, update BIOS&lt;br /&gt;
* After full update, hit F1 to enter BIOS, do a &amp;quot;Load Optimized Defaults&amp;quot; and reboot again&lt;br /&gt;
* Go into BIOS and change:&lt;br /&gt;
** Advanced - Ai Tweaker - Ai Overclock Tuner - EXPO I&lt;br /&gt;
** Advanced - Boot - Secure Boot - OS Type - Windows UEFI Mode&lt;br /&gt;
** Advanced - Boot - Secure Boot - Secure Boot Mode - Standard&lt;br /&gt;
* Save and reboot, verify that Windows boots and is stable. Verify DDR frequency is 3GHz (DDR-6000).&lt;br /&gt;
* Either be happy here and live with 1.5 minutes extra boot time, or attempt CBS:&lt;br /&gt;
* Reboot again, hit DEL (after DDR training) to enter BIOS and change:&lt;br /&gt;
** Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore - Enabled&lt;br /&gt;
* Save and reboot (DDR training will happen one final time)&lt;br /&gt;
* Verify that Windows boots and is stable.&lt;br /&gt;
* Reboot, DDR training should now be much faster. Verify that Windows is stable. Verify DDR frequency is 3GHz (DDR-6000)&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=BIOS&amp;diff=257</id>
		<title>BIOS</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=BIOS&amp;diff=257"/>
		<updated>2024-08-06T07:40:28Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;BIOS are generally a bit trickier to configure after the upgrade to DDR5.&lt;br /&gt;
&lt;br /&gt;
= Context Memory Restore =&lt;br /&gt;
&lt;br /&gt;
Once a newly installed computer boots up, expect it to stay black for ~1-2 minutes during boot while DDR is trained.&lt;br /&gt;
&lt;br /&gt;
To avoid this, you can enable _Memory Context Restore_ found here on the ASUS B650E-F:&lt;br /&gt;
 Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore&lt;br /&gt;
By enabling this, the computer will then do one training on the next reboot, and then reuse that data for upcoming boots, giving the same kind of boot behavior as DDR4 and below.&lt;br /&gt;
&lt;br /&gt;
= AMD EXPO =&lt;br /&gt;
&lt;br /&gt;
This allows for auto overclocking according to your DDR5 memory. This may increase DDR training time.&lt;br /&gt;
&lt;br /&gt;
Enabling both AMD EXPO and Context Memory Restore should work well, but sometimes it gives stability issues, and you have to refrain from using one of them.&lt;br /&gt;
&lt;br /&gt;
For me, it worked fine with the 1807 BIOS, but not with the 2616 BIOS.&lt;br /&gt;
&lt;br /&gt;
= No display =&lt;br /&gt;
Sometimes the displayport can not be used while configuring BIOS. This is the case on the ASUS B650E-F in conjunction with a RTX 3070 graphics card. You have to connect the HDMI to see the BIOS screen every time.&lt;br /&gt;
&lt;br /&gt;
= Method for BIOS updating for ASUS Rog Strix B650E&lt;br /&gt;
* Connect HDMI to monitor&lt;br /&gt;
* Disconnect Displayport to monitor&lt;br /&gt;
* Put BIOS CAP file on USB stick and reboot into bios (DEL after DDR5 training)&lt;br /&gt;
* Advanced - Tools - EZ Flasher, update BIOS&lt;br /&gt;
* After full update, hit F1 to enter BIOS, do a &amp;quot;Load Optimized Defaults&amp;quot; and reboot again&lt;br /&gt;
* Go into BIOS and change:&lt;br /&gt;
** Advanced - Ai Tweaker - Ai Overclock Tuner - EXPO I&lt;br /&gt;
** Advanced - Boot - Secure Boot - OS Type - Windows UEFI Mode&lt;br /&gt;
** Advanced - Boot - Secure Boot - Secure Boot Mode - Standard&lt;br /&gt;
* Save and reboot, verify that Windows boots and is stable. Verify DDR frequency is 3GHz (DDR-6000).&lt;br /&gt;
* Either be happy here and live with 1.5 minutes extra boot time, or attempt CBS:&lt;br /&gt;
* Reboot again, hit DEL (after DDR training) to enter BIOS and change:&lt;br /&gt;
** Advanced - AMD CBS - UMC Common Options - DDR options - DDR memory features - Memory Context Restore - Enabled&lt;br /&gt;
* Save and reboot (DDR training will happen one final time)&lt;br /&gt;
* Verify that Windows boots and is stable.&lt;br /&gt;
* Reboot, DDR training should now be much faster. Verify that Windows is stable. Verify DDR frequency is 3GHz (DDR-6000)&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=256</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=256"/>
		<updated>2024-08-06T07:14:38Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar). Add these as new lines, do not change the existing ones:&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=255</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=255"/>
		<updated>2024-08-06T07:07:39Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar):&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64, but since backports is lower prioritized, you need to specify that you want the backport version:&lt;br /&gt;
 sudo apt install linux-image-amd64/bookworm-backports&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=245</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=245"/>
		<updated>2024-05-13T15:06:18Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
Add the backports repository to apt (/etc/apt/sources.list or something similar):&lt;br /&gt;
 deb [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
 deb-src [arch=amd64] http://debian.lth.se/debian bookworm-backports main contrib non-free non-free-firmware&lt;br /&gt;
Then do:&lt;br /&gt;
 sudo apt update&lt;br /&gt;
Then just install the latest linux-image-amd64:&lt;br /&gt;
 sudo apt install linux-image-amd64&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=244</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=244"/>
		<updated>2024-05-13T14:56:51Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;br /&gt;
&lt;br /&gt;
== Kernel ==&lt;br /&gt;
=== Update to newer kernel on Debian ===&lt;br /&gt;
&lt;br /&gt;
=== Update to newer kernel on Ubuntu ===&lt;br /&gt;
Simply install the correct version of linux-generic-hwe:&lt;br /&gt;
 sudo apt install linux-generic-hwe-20.04&lt;br /&gt;
or&lt;br /&gt;
 sudo apt install linux-generic-hwe-22.04&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Saab&amp;diff=242</id>
		<title>Saab</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Saab&amp;diff=242"/>
		<updated>2024-04-13T14:07:14Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Gråkletig olja: http://forum.saabturboclub.com/showthread.php/129665-Majon%C3%A4s-p%C3%A5-oljesticka-samt-i-oljef%C3%A4llan-p%C3%A5-OG9-5&lt;br /&gt;
&lt;br /&gt;
Byta topplockspackning: https://www.facebook.com/groups/saabtuboclub/posts/10156971846276755/&lt;br /&gt;
&lt;br /&gt;
Efterdra toppen: http://forum.saabturboclub.com/showthread.php/4960-FAQ-Dragning-Efterdragning-av-topplock&lt;br /&gt;
&lt;br /&gt;
Vevhusventilation: https://shop.speedparts.se/sv/prod/saab/9-5-98-10/motor/vevhusventilation/9-5-04-10/&lt;br /&gt;
&lt;br /&gt;
Vevhusventilationssats: https://folkraceshop.se/vevhusventilation-saab-9-5-2004-2010&lt;br /&gt;
&lt;br /&gt;
Rengöra tråg: http://forum.saabturboclub.com/showthread.php/100780-Guide-Reng%C3%B6ra-tr%C3%A5g-OG9-5-(B2X5)-g%C3%A4ller-delvis-%C3%A4ven-OG9-3&lt;br /&gt;
&lt;br /&gt;
Video byta ventilkåpspackning: https://www.youtube.com/watch?v=Kw7Ssyf66Wc&lt;br /&gt;
&lt;br /&gt;
Renovering vevhusventilation: https://www.youtube.com/watch?v=Uk-Vg-szcyc&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Saab&amp;diff=241</id>
		<title>Saab</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Saab&amp;diff=241"/>
		<updated>2024-04-13T13:34:56Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Gråkletig olja: http://forum.saabturboclub.com/showthread.php/129665-Majon%C3%A4s-p%C3%A5-oljesticka-samt-i-oljef%C3%A4llan-p%C3%A5-OG9-5&lt;br /&gt;
&lt;br /&gt;
Byta topplockspackning: https://www.facebook.com/groups/saabtuboclub/posts/10156971846276755/&lt;br /&gt;
&lt;br /&gt;
Efterdra toppen: http://forum.saabturboclub.com/showthread.php/4960-FAQ-Dragning-Efterdragning-av-topplock&lt;br /&gt;
&lt;br /&gt;
Vevhusventilation: https://shop.speedparts.se/sv/prod/saab/9-5-98-10/motor/vevhusventilation/9-5-04-10/&lt;br /&gt;
&lt;br /&gt;
Vevhusventilationssats: https://folkraceshop.se/vevhusventilation-saab-9-5-2004-2010&lt;br /&gt;
&lt;br /&gt;
Rengöra tråg: http://forum.saabturboclub.com/showthread.php/100780-Guide-Reng%C3%B6ra-tr%C3%A5g-OG9-5-(B2X5)-g%C3%A4ller-delvis-%C3%A4ven-OG9-3&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Saab&amp;diff=240</id>
		<title>Saab</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Saab&amp;diff=240"/>
		<updated>2024-04-13T13:33:06Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Created page with &amp;quot;Gråkletig olja: http://forum.saabturboclub.com/showthread.php/129665-Majon%C3%A4s-p%C3%A5-oljesticka-samt-i-oljef%C3%A4llan-p%C3%A5-OG9-5  Byta topplockspackning: https://www.facebook.com/groups/saabtuboclub/posts/10156971846276755/  Efterdra toppen: http://forum.saabturboclub.com/showthread.php/4960-FAQ-Dragning-Efterdragning-av-topplock  Vevhusventilation: https://shop.speedparts.se/sv/prod/saab/9-5-98-10/motor/vevhusventilation/9-5-04-10/  Vevhusventilationssats: htt...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Gråkletig olja: http://forum.saabturboclub.com/showthread.php/129665-Majon%C3%A4s-p%C3%A5-oljesticka-samt-i-oljef%C3%A4llan-p%C3%A5-OG9-5&lt;br /&gt;
&lt;br /&gt;
Byta topplockspackning: https://www.facebook.com/groups/saabtuboclub/posts/10156971846276755/&lt;br /&gt;
&lt;br /&gt;
Efterdra toppen: http://forum.saabturboclub.com/showthread.php/4960-FAQ-Dragning-Efterdragning-av-topplock&lt;br /&gt;
&lt;br /&gt;
Vevhusventilation: https://shop.speedparts.se/sv/prod/saab/9-5-98-10/motor/vevhusventilation/9-5-04-10/&lt;br /&gt;
&lt;br /&gt;
Vevhusventilationssats: https://folkraceshop.se/vevhusventilation-saab-9-5-2004-2010&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Cars&amp;diff=239</id>
		<title>Cars</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Cars&amp;diff=239"/>
		<updated>2024-04-13T13:26:48Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Touareg]]&lt;br /&gt;
&lt;br /&gt;
[[Golf]]&lt;br /&gt;
&lt;br /&gt;
[[Saab]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=238</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=238"/>
		<updated>2024-02-09T09:58:02Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Switch default compiler */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Restart Gnome ===&lt;br /&gt;
&lt;br /&gt;
Hit ALT+F2, then you get a &amp;quot;gnome run command&amp;quot; thingy. Enter &amp;quot;r&amp;quot; and hit enter!&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=237</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=237"/>
		<updated>2023-11-09T08:06:46Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Change console language to english */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 sudo dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=236</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=236"/>
		<updated>2023-11-09T08:06:33Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Configuring Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Change console language to english ===&lt;br /&gt;
 dpkg-reconfigure locales&lt;br /&gt;
Then select en_US.UTF-8 (plus your local language), and then on next screen set the default language.&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=235</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=235"/>
		<updated>2023-11-09T08:01:50Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=234</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=234"/>
		<updated>2023-11-09T08:01:13Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== Users ===&lt;br /&gt;
Add user stefan to group sudo:&lt;br /&gt;
 sudo adduser stefan sudo&lt;br /&gt;
&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux_kernel&amp;diff=233</id>
		<title>Linux kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux_kernel&amp;diff=233"/>
		<updated>2023-11-01T09:13:36Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Kernel drivers ==&lt;br /&gt;
&lt;br /&gt;
* Kernel platform drivers: http://lwn.net/Articles/448499/&lt;br /&gt;
* Device trees: http://lwn.net/Articles/448502/&lt;br /&gt;
* Nice intro guide: https://bootlin.com/doc/training/linux-kernel/linux-kernel-slides.pdf&lt;br /&gt;
* More trainings: https://bootlin.com/training/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building the kernel ==&lt;br /&gt;
==== Configure ====&lt;br /&gt;
===== config using defconfig =====&lt;br /&gt;
To configure using a specified defconfig for a specified architecture&lt;br /&gt;
 make ARCH=x86 i386_defconfig&lt;br /&gt;
&lt;br /&gt;
===== menuconfig using defconfig =====&lt;br /&gt;
To menuconfig starting from a specified defconfig for a specified architecture&lt;br /&gt;
 make menuconfig ARCH=x86 i386_defconfig&lt;br /&gt;
Be sure to explicitly save the configuration.&lt;br /&gt;
&lt;br /&gt;
===== menuconfig using .config =====&lt;br /&gt;
To menuconfig starting from a .config for a specified architecture&lt;br /&gt;
 make menuconfig ARCH=x86&lt;br /&gt;
When inside menuconfig, choose &amp;quot;Load&amp;quot; and specify path to your .config Then edit the configuration as you see fit, then choose &amp;quot;Save&amp;quot; and save it as &amp;quot;.config&amp;quot; only. Then you can exit menuconfig and do:&lt;br /&gt;
 make savedefconfig ARCH=x86&lt;br /&gt;
to save your updated, minimal defconfig. Be sure to specify your architecture at all times (if it is not the default x86).&lt;br /&gt;
&lt;br /&gt;
==== Build ====&lt;br /&gt;
 make -j4 ARCH=x86 CROSS_COMPILE=/bin/i686-linux- all&lt;br /&gt;
&lt;br /&gt;
== Various kernel information ==&lt;br /&gt;
==== New Linux network names ====&lt;br /&gt;
https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/&lt;br /&gt;
&lt;br /&gt;
== Tips for booting the kernel on a new ARM board ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Uncompressing ===&lt;br /&gt;
Do you get the &#039;&#039;&amp;quot;Uncompressing Linux... done, booting the kernel.&amp;quot;&#039;&#039; print? If not and you are on an ARM architecture, you can enable:&lt;br /&gt;
 CONFIG_EARLY_PRINTK=y&lt;br /&gt;
 CONFIG_DEBUG_LL=y&lt;br /&gt;
 CONFIG_DEBUG_LL_UART_PL01X=y&lt;br /&gt;
 CONFIG_DEBUG_UART_PHYS=0xF7800000&lt;br /&gt;
 CONFIG_DEBUG_UART_VIRT=0xF7800000&lt;br /&gt;
&lt;br /&gt;
If you are working on a &#039;&#039;&#039;arm64&#039;&#039;&#039; architecture, DEBUG_LL is no longer available. The new way to do the same thing is to append something like the following to your kernel cmdline:&lt;br /&gt;
 earlycon=pl011,mmio32,0xF7800000&lt;br /&gt;
&lt;br /&gt;
More info on earlycon and other kernel cmdline options: [https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html]&lt;br /&gt;
&lt;br /&gt;
In both cases you have to adjust the UART config according to your platform! Now you should get the &#039;&#039;Uncompressing Linux...&#039;&#039; print, otherwise your bootloader has either:&lt;br /&gt;
* Not uploaded the kernel to RAM.&lt;br /&gt;
* Not jumped to the correct place in RAM to execute it.&lt;br /&gt;
&lt;br /&gt;
Good places to check out:&lt;br /&gt;
 arch/arm/boot/compressed/head.S&lt;br /&gt;
 arch/arm/boot/compressed/misc.c&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - First assembly files ===&lt;br /&gt;
&lt;br /&gt;
The kernel will boot in two different ways:&lt;br /&gt;
* Without device tree support (old style). Your bootloader should have set up register r1 to contain the machine ID and register r2 to contain a pointer to the ATAGS area.&lt;br /&gt;
* With device tree support (new style). Your bootloader should have set up register r2 to contain a pointer to the DTB (device tree blob).&lt;br /&gt;
&lt;br /&gt;
Do you get &amp;quot;&#039;&#039;&#039;&#039;&#039;Error: unrecognized/unsupported processor variant&#039;&#039;&#039; (0x414fc091).&#039;&#039;&amp;quot;? Then you have set your defconfig flags in your kernel to the wrong CPU type. Make sure to check if your CPU is an ARMv5, ARMv7 or whatever and set the correct defconfig flags (such as CONFIG_ARCH_ and CONFIG_CPU_).&lt;br /&gt;
&lt;br /&gt;
Good places to check out:&lt;br /&gt;
 arch/arm/kernel/head-common.S&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - early c code ===&lt;br /&gt;
You should now be able to reach the function &#039;&#039;start_kernel()&#039;&#039; in file &#039;&#039;init/main.c&#039;&#039;. This is great place to start off. prints are working differently here, the CONFIG_DEBUG_LL and EARLY_PRINTK is not working here, but once you reach the &#039;&#039;setup_arch()&#039;&#039; function in &#039;&#039;arch/arm/kernel/setup.c&#039;&#039;, you can use the &#039;&#039;early_print()&#039;&#039; function to print stuff using the CONFIG_DEBUG_LL stuff again!&lt;br /&gt;
&lt;br /&gt;
==== Hack to get something on the serial line ====&lt;br /&gt;
If you have trouble getting the regular &#039;&#039;pr_xxxx&#039;&#039;-prints going, then you can replace them all in this file with &#039;&#039;early_print()&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Another good hack&#039;&#039;&#039; is to copy the function &#039;&#039;early_print()&#039;&#039; from file arch/arm/kernel/setup.c, and replace the function &#039;&#039;printk()&#039;&#039; in file kernel/prink/printk.c with the implementation from early_print(). Now all printk:s will be redirected to be output by the early assembler routines enabled by CONFIG_DEBUG_LL.&lt;br /&gt;
&lt;br /&gt;
Good places to start with are:&lt;br /&gt;
&lt;br /&gt;
 init/main.c&lt;br /&gt;
 arch/arm/kernel/setup.c&lt;br /&gt;
 arch/arm/kernel/devtree.c&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - interrupts and timers ===&lt;br /&gt;
If the board hangs at calibrate_delay() (you may see &amp;quot;Calibrating delay loop...&amp;quot; in the console), then your interrupts are not working. Check that the correct driver for your IRQ block has been enabled by defconfigs and that you have added correct configuration in your devicetree.&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - getting the serial running the proper way ===&lt;br /&gt;
Make sure you have enabled the correct drivers for your serial HW block and added configuration for them in the devicetree if applicable.&lt;br /&gt;
&lt;br /&gt;
Then make sure you have set up the kernel command line to contain a &#039;&#039;console&#039;&#039; keyword with a suitable UART configuration, either in your device tree file (*.dts) or in your defconfig (CONFIG_CMDLINE=&amp;quot;console=ttyAMA0,115200 earlyprintk init=/linuxrc&amp;quot;) or that it is given from your bootloader. Make sure it is set up to the correct UART and speed.&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - debugging initcalls ===&lt;br /&gt;
If your kernel just stops or crashes in the later stages of kernel boot, it might be good to add the following option to the kernel command line: &#039;&#039;&#039;initcall_debug&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Note however that the prints are printed at DEBUG log level, so if you want to see them, you have to make sure that also DEBUG prints are printed. It might be worthwhile to also add &#039;&#039;&#039;ignore_loglevel&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Other options that might be added can be found here: https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/kernel-parameters.txt&lt;br /&gt;
&lt;br /&gt;
=== Step 7 - overriding kernel command line ===&lt;br /&gt;
For ARM64, if you have trouble with the bootloader overwriting your DTB kernel command line, you may add something like this to your kernel config to override it completely:&lt;br /&gt;
&lt;br /&gt;
 CONFIG_CMDLINE=&amp;quot;console=ttyLP0,115200 earlycon=lpuart32,0x3000000,115200 root=/dev/mmcblk1p2 rootwait rw initcall_debug ignore_loglevel&amp;quot;&lt;br /&gt;
 CONFIG_CMDLINE_FORCE=y&lt;br /&gt;
 # CONFIG_INITRAMFS_FORCE is not set&lt;br /&gt;
&lt;br /&gt;
=== Other logging tips ===&lt;br /&gt;
If you want to dump out a buffer or a bunch of registers, then you can use the excellent:&lt;br /&gt;
 print_hex_dump_bytes(&amp;quot;HEX: &amp;quot;, DUMP_PREFIX_OFFSET, buf, size);&lt;br /&gt;
&lt;br /&gt;
== Testing memory in Linux ==&lt;br /&gt;
&lt;br /&gt;
Enable the following kernel configs:&lt;br /&gt;
 CONFIG_MEMTEST=y&lt;br /&gt;
 CONFIG_DEBUG_MEMORY_INIT=y&lt;br /&gt;
&lt;br /&gt;
Add the following to the kernel command line:&lt;br /&gt;
 &amp;quot;memtest memblock=debug mminit_loglevel=10 loglevel=8&amp;quot;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux_kernel&amp;diff=232</id>
		<title>Linux kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux_kernel&amp;diff=232"/>
		<updated>2023-11-01T08:25:22Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Kernel drivers ==&lt;br /&gt;
&lt;br /&gt;
* Kernel platform drivers: http://lwn.net/Articles/448499/&lt;br /&gt;
* Device trees: http://lwn.net/Articles/448502/&lt;br /&gt;
* Nice intro guide: https://bootlin.com/doc/training/linux-kernel/linux-kernel-slides.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building the kernel ==&lt;br /&gt;
==== Configure ====&lt;br /&gt;
===== config using defconfig =====&lt;br /&gt;
To configure using a specified defconfig for a specified architecture&lt;br /&gt;
 make ARCH=x86 i386_defconfig&lt;br /&gt;
&lt;br /&gt;
===== menuconfig using defconfig =====&lt;br /&gt;
To menuconfig starting from a specified defconfig for a specified architecture&lt;br /&gt;
 make menuconfig ARCH=x86 i386_defconfig&lt;br /&gt;
Be sure to explicitly save the configuration.&lt;br /&gt;
&lt;br /&gt;
===== menuconfig using .config =====&lt;br /&gt;
To menuconfig starting from a .config for a specified architecture&lt;br /&gt;
 make menuconfig ARCH=x86&lt;br /&gt;
When inside menuconfig, choose &amp;quot;Load&amp;quot; and specify path to your .config Then edit the configuration as you see fit, then choose &amp;quot;Save&amp;quot; and save it as &amp;quot;.config&amp;quot; only. Then you can exit menuconfig and do:&lt;br /&gt;
 make savedefconfig ARCH=x86&lt;br /&gt;
to save your updated, minimal defconfig. Be sure to specify your architecture at all times (if it is not the default x86).&lt;br /&gt;
&lt;br /&gt;
==== Build ====&lt;br /&gt;
 make -j4 ARCH=x86 CROSS_COMPILE=/bin/i686-linux- all&lt;br /&gt;
&lt;br /&gt;
== Various kernel information ==&lt;br /&gt;
==== New Linux network names ====&lt;br /&gt;
https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/&lt;br /&gt;
&lt;br /&gt;
== Tips for booting the kernel on a new ARM board ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1 - Uncompressing ===&lt;br /&gt;
Do you get the &#039;&#039;&amp;quot;Uncompressing Linux... done, booting the kernel.&amp;quot;&#039;&#039; print? If not and you are on an ARM architecture, you can enable:&lt;br /&gt;
 CONFIG_EARLY_PRINTK=y&lt;br /&gt;
 CONFIG_DEBUG_LL=y&lt;br /&gt;
 CONFIG_DEBUG_LL_UART_PL01X=y&lt;br /&gt;
 CONFIG_DEBUG_UART_PHYS=0xF7800000&lt;br /&gt;
 CONFIG_DEBUG_UART_VIRT=0xF7800000&lt;br /&gt;
&lt;br /&gt;
If you are working on a &#039;&#039;&#039;arm64&#039;&#039;&#039; architecture, DEBUG_LL is no longer available. The new way to do the same thing is to append something like the following to your kernel cmdline:&lt;br /&gt;
 earlycon=pl011,mmio32,0xF7800000&lt;br /&gt;
&lt;br /&gt;
More info on earlycon and other kernel cmdline options: [https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html]&lt;br /&gt;
&lt;br /&gt;
In both cases you have to adjust the UART config according to your platform! Now you should get the &#039;&#039;Uncompressing Linux...&#039;&#039; print, otherwise your bootloader has either:&lt;br /&gt;
* Not uploaded the kernel to RAM.&lt;br /&gt;
* Not jumped to the correct place in RAM to execute it.&lt;br /&gt;
&lt;br /&gt;
Good places to check out:&lt;br /&gt;
 arch/arm/boot/compressed/head.S&lt;br /&gt;
 arch/arm/boot/compressed/misc.c&lt;br /&gt;
&lt;br /&gt;
=== Step 2 - First assembly files ===&lt;br /&gt;
&lt;br /&gt;
The kernel will boot in two different ways:&lt;br /&gt;
* Without device tree support (old style). Your bootloader should have set up register r1 to contain the machine ID and register r2 to contain a pointer to the ATAGS area.&lt;br /&gt;
* With device tree support (new style). Your bootloader should have set up register r2 to contain a pointer to the DTB (device tree blob).&lt;br /&gt;
&lt;br /&gt;
Do you get &amp;quot;&#039;&#039;&#039;&#039;&#039;Error: unrecognized/unsupported processor variant&#039;&#039;&#039; (0x414fc091).&#039;&#039;&amp;quot;? Then you have set your defconfig flags in your kernel to the wrong CPU type. Make sure to check if your CPU is an ARMv5, ARMv7 or whatever and set the correct defconfig flags (such as CONFIG_ARCH_ and CONFIG_CPU_).&lt;br /&gt;
&lt;br /&gt;
Good places to check out:&lt;br /&gt;
 arch/arm/kernel/head-common.S&lt;br /&gt;
&lt;br /&gt;
=== Step 3 - early c code ===&lt;br /&gt;
You should now be able to reach the function &#039;&#039;start_kernel()&#039;&#039; in file &#039;&#039;init/main.c&#039;&#039;. This is great place to start off. prints are working differently here, the CONFIG_DEBUG_LL and EARLY_PRINTK is not working here, but once you reach the &#039;&#039;setup_arch()&#039;&#039; function in &#039;&#039;arch/arm/kernel/setup.c&#039;&#039;, you can use the &#039;&#039;early_print()&#039;&#039; function to print stuff using the CONFIG_DEBUG_LL stuff again!&lt;br /&gt;
&lt;br /&gt;
==== Hack to get something on the serial line ====&lt;br /&gt;
If you have trouble getting the regular &#039;&#039;pr_xxxx&#039;&#039;-prints going, then you can replace them all in this file with &#039;&#039;early_print()&#039;&#039; instead.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Another good hack&#039;&#039;&#039; is to copy the function &#039;&#039;early_print()&#039;&#039; from file arch/arm/kernel/setup.c, and replace the function &#039;&#039;printk()&#039;&#039; in file kernel/prink/printk.c with the implementation from early_print(). Now all printk:s will be redirected to be output by the early assembler routines enabled by CONFIG_DEBUG_LL.&lt;br /&gt;
&lt;br /&gt;
Good places to start with are:&lt;br /&gt;
&lt;br /&gt;
 init/main.c&lt;br /&gt;
 arch/arm/kernel/setup.c&lt;br /&gt;
 arch/arm/kernel/devtree.c&lt;br /&gt;
&lt;br /&gt;
=== Step 4 - interrupts and timers ===&lt;br /&gt;
If the board hangs at calibrate_delay() (you may see &amp;quot;Calibrating delay loop...&amp;quot; in the console), then your interrupts are not working. Check that the correct driver for your IRQ block has been enabled by defconfigs and that you have added correct configuration in your devicetree.&lt;br /&gt;
&lt;br /&gt;
=== Step 5 - getting the serial running the proper way ===&lt;br /&gt;
Make sure you have enabled the correct drivers for your serial HW block and added configuration for them in the devicetree if applicable.&lt;br /&gt;
&lt;br /&gt;
Then make sure you have set up the kernel command line to contain a &#039;&#039;console&#039;&#039; keyword with a suitable UART configuration, either in your device tree file (*.dts) or in your defconfig (CONFIG_CMDLINE=&amp;quot;console=ttyAMA0,115200 earlyprintk init=/linuxrc&amp;quot;) or that it is given from your bootloader. Make sure it is set up to the correct UART and speed.&lt;br /&gt;
&lt;br /&gt;
=== Step 6 - debugging initcalls ===&lt;br /&gt;
If your kernel just stops or crashes in the later stages of kernel boot, it might be good to add the following option to the kernel command line: &#039;&#039;&#039;initcall_debug&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Note however that the prints are printed at DEBUG log level, so if you want to see them, you have to make sure that also DEBUG prints are printed. It might be worthwhile to also add &#039;&#039;&#039;ignore_loglevel&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Other options that might be added can be found here: https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/kernel-parameters.txt&lt;br /&gt;
&lt;br /&gt;
=== Step 7 - overriding kernel command line ===&lt;br /&gt;
For ARM64, if you have trouble with the bootloader overwriting your DTB kernel command line, you may add something like this to your kernel config to override it completely:&lt;br /&gt;
&lt;br /&gt;
 CONFIG_CMDLINE=&amp;quot;console=ttyLP0,115200 earlycon=lpuart32,0x3000000,115200 root=/dev/mmcblk1p2 rootwait rw initcall_debug ignore_loglevel&amp;quot;&lt;br /&gt;
 CONFIG_CMDLINE_FORCE=y&lt;br /&gt;
 # CONFIG_INITRAMFS_FORCE is not set&lt;br /&gt;
&lt;br /&gt;
=== Other logging tips ===&lt;br /&gt;
If you want to dump out a buffer or a bunch of registers, then you can use the excellent:&lt;br /&gt;
 print_hex_dump_bytes(&amp;quot;HEX: &amp;quot;, DUMP_PREFIX_OFFSET, buf, size);&lt;br /&gt;
&lt;br /&gt;
== Testing memory in Linux ==&lt;br /&gt;
&lt;br /&gt;
Enable the following kernel configs:&lt;br /&gt;
 CONFIG_MEMTEST=y&lt;br /&gt;
 CONFIG_DEBUG_MEMORY_INIT=y&lt;br /&gt;
&lt;br /&gt;
Add the following to the kernel command line:&lt;br /&gt;
 &amp;quot;memtest memblock=debug mminit_loglevel=10 loglevel=8&amp;quot;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=231</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=231"/>
		<updated>2023-10-31T10:15:10Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Repair when computer only boots into Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/nvme0n1p7 /mnt/&lt;br /&gt;
 sudo mount /dev/nvme0n1p1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/nvme0n1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=230</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=230"/>
		<updated>2023-10-31T10:12:58Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Repair when computer only boots into Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, first you need to figure out your target system root and EFI partitions:&lt;br /&gt;
&lt;br /&gt;
 sudo fdisk -l&lt;br /&gt;
 ...&lt;br /&gt;
 Device              Start        End    Sectors   Size Type&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p1       2048    1394687    1392640   680M EFI System&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p2    1394688    1656831     262144   128M Microsoft reserved&lt;br /&gt;
 /dev/nvme0n1p3    1656832 1764220927 1762564096 840.5G Microsoft basic data&lt;br /&gt;
 /dev/nvme0n1p4 1969020928 1971048447    2027520   990M Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p5 1971048448 1997713407   26664960  12.7G Windows recovery environment&lt;br /&gt;
 /dev/nvme0n1p6 1997715456 2000408575    2693120   1.3G Windows recovery environment&lt;br /&gt;
 &#039;&#039;&#039;/dev/nvme0n1p7 1764220928 1936101375  171880448    82G Linux filesystem&#039;&#039;&#039;&lt;br /&gt;
 /dev/nvme0n1p8 1936101376 1969020927   32919552  15.7G Linux swap&lt;br /&gt;
&lt;br /&gt;
So in this case our EFI partition is &#039;&#039;/dev/nvme0n1p1&#039;&#039; and our rootfs partition is &#039;&#039;/dev/nvme0n1p7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Then do something like:&lt;br /&gt;
 sudo mount /dev/sdb2 /mnt/&lt;br /&gt;
 sudo mount /dev/sdb1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/sdb&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=229</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=229"/>
		<updated>2023-10-31T10:08:26Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Dual boot with Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, they are:&lt;br /&gt;
 sudo mount /dev/sdb2 /mnt/&lt;br /&gt;
 sudo mount /dev/sdb1 /mnt/boot/efi&lt;br /&gt;
 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done&lt;br /&gt;
 sudo chroot /mnt&lt;br /&gt;
 sudo grub-install /dev/sdb&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=228</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=228"/>
		<updated>2023-10-31T09:39:21Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Dual boot with Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
&lt;br /&gt;
Download the Debian Live standard ISO from here: https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/&lt;br /&gt;
&lt;br /&gt;
Use Rufus to write it to a bootable USB stick: https://rufus.ie&lt;br /&gt;
&lt;br /&gt;
In Rufus, select your USB drive and the downloaded Debian ISO.&lt;br /&gt;
&lt;br /&gt;
Make sure you select &#039;&#039;Partition schema&#039;&#039; as &#039;&#039;GPT&#039;&#039; and &#039;&#039;Target system&#039;&#039; as &#039;&#039;UEFI (non CSM)&#039;&#039;.&lt;br /&gt;
Hit &amp;quot;Start&amp;quot; and when prompted choose to write the image in &#039;&#039;DD&#039;&#039; mode!&lt;br /&gt;
&lt;br /&gt;
Now insert the USB stick in your broken computer and boot it while hitting a magic key (such as F12) to enter BIOS boot menu. Select to boot your USB stick in &#039;&#039;UEFI mode&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Once Debian Live has started up, follow the instructions here: https://wiki.debian.org/GrubEFIReinstall#Using_A_Live_CD.2FUSB_To_Fix_Your_Current_System&lt;br /&gt;
&lt;br /&gt;
In short, they are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &#039;&#039;os-prober&#039;&#039; was not run during your last &#039;&#039;update-grub&#039;&#039; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo apt install os-prober&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file &#039;&#039;&#039;/etc/default/grub&#039;&#039;&#039; and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=227</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=227"/>
		<updated>2023-10-31T09:29:40Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Repair when computer only boots into Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
If you have a dual boot set&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &amp;quot;os-prober&amp;quot; was not run during your last &amp;quot;update-grub&amp;quot; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file /etc/default/grub and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file /etc/default/grub and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=226</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=226"/>
		<updated>2023-10-31T09:29:16Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Dual boot with Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
First install Windows as usual, then boot (in UEFI mode) from Debian netinst usb stick and install Debian. Install grub on your primary disk drive.&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Windows ===&lt;br /&gt;
If you have a dual boot set&lt;br /&gt;
&lt;br /&gt;
=== Repair when computer only boots into Linux ===&lt;br /&gt;
&lt;br /&gt;
Most probably this is due to that &amp;quot;osprober&amp;quot; was not run during your last &amp;quot;update-grub&amp;quot; session.&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file /etc/default/grub and add the following line:&lt;br /&gt;
 GRUB_DISABLE_OS_PROBER=false&lt;br /&gt;
&lt;br /&gt;
Also make sure you have the os-prober command installed:&lt;br /&gt;
 sudo os-prober&lt;br /&gt;
&lt;br /&gt;
Then run:&lt;br /&gt;
 update-grub&lt;br /&gt;
&lt;br /&gt;
=== Configure grub to always boot into your last selected OS ===&lt;br /&gt;
&lt;br /&gt;
In Linux, edit the file /etc/default/grub and add the following lines:&lt;br /&gt;
 GRUB_DEFAULT=saved&lt;br /&gt;
 GRUB_SAVEDEFAULT=true&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=225</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=225"/>
		<updated>2023-10-31T09:22:42Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Configuring Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dual boot with Windows ==&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Linux&amp;diff=224</id>
		<title>Linux</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Linux&amp;diff=224"/>
		<updated>2023-10-02T06:54:33Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debugging Linux applications ==&lt;br /&gt;
=== LDD ===&lt;br /&gt;
Linux LDD is just a wrapper for:&lt;br /&gt;
 LD_TRACE_LOADED_OBJECTS=1 &amp;lt;cmd&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Core dumps ===&lt;br /&gt;
To check core dump handler:&lt;br /&gt;
 cat /proc/sys/kernel/core_pattern&lt;br /&gt;
 |/usr/sbin/coredump-handler %h_%t_%p.core&lt;br /&gt;
&lt;br /&gt;
=== Valgrind ===&lt;br /&gt;
 valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all &amp;lt;binary&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuring Linux ==&lt;br /&gt;
&lt;br /&gt;
=== Secure Boot ===&lt;br /&gt;
&lt;br /&gt;
If you want to run Linux, but you also dual boot into Windows and need to have your BIOS set up to boot in Secure Boot (for instance if you play Valorant in Windows), then you have two choices.&lt;br /&gt;
&lt;br /&gt;
# Boot Windows in secure mode but Linux in insecure mode.&lt;br /&gt;
# Boot both Windows and Linux in secure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 1 ====&lt;br /&gt;
&lt;br /&gt;
To get the first option working, you need to install Fedora/Nobara with UEFI enabled, but secure boot disabled in BIOS. If you at this point enable secure boot, Linux will not boot (complain about shim error).&lt;br /&gt;
&lt;br /&gt;
Boot up with secure boot disabled and do:&lt;br /&gt;
 sudo mokutil --disable-validation&lt;br /&gt;
Follow the instructions and then reboot your PC and choose to &amp;quot;Change Secure boot state&amp;quot; as described here: https://wiki.ubuntu.com/UEFI/SecureBoot/DKMS&lt;br /&gt;
&lt;br /&gt;
If you do this, you can install GRUB2 and enable Secure Boot in your BIOS again. If you now boot into GRUB2, you can select to boot Windows (which will then properly boot up in Secure Mode) or you can choose to boot Linux which will then boot up in insecure mode.&lt;br /&gt;
&lt;br /&gt;
==== Option 2 ====&lt;br /&gt;
&lt;br /&gt;
If you want to have also Linux booting up in secure mode, you can do that as well, but it requires a bit more work. There is a good guide here: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader&lt;br /&gt;
&lt;br /&gt;
Basically you need to:&lt;br /&gt;
&lt;br /&gt;
1 Create your own MOK key&lt;br /&gt;
 openssl req -newkey rsa:4096 -nodes -keyout mok.key -new -x509 -sha256 -days 3650 -subj &amp;quot;/CN=my Machine Owner Key/&amp;quot; -out mok.crt&lt;br /&gt;
 openssl x509 -outform DER -in mok.crt -out mok.cer&lt;br /&gt;
2 Sign the vmlinuz file in your /boot/ folder with this key&lt;br /&gt;
 sbsign --key mok.key --cert mok.crt --output /boot/vmlinuz-linux /boot/vmlinuz-linux&lt;br /&gt;
3 Enroll your key into your BIOS with mokutil&lt;br /&gt;
 mokutil --import mok.cer&lt;br /&gt;
&lt;br /&gt;
Then Linux will boot up fine in Secure Mode. You will however have 2 issues:&lt;br /&gt;
&lt;br /&gt;
* Whenever a new kernel is installed on your system, you need to sign it with your own MOK key, otherwise it will not boot.&lt;br /&gt;
* You can not install third party drivers such as the Nvidia graphics drivers unless you sign also them with your own MOK key.&lt;br /&gt;
&lt;br /&gt;
=== Graphics drivers ===&lt;br /&gt;
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core&lt;br /&gt;
 sudo dpkg-reconfigure xserver-xorg&lt;br /&gt;
 sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf&lt;br /&gt;
 reboot&lt;br /&gt;
==== Disable Nvidia drivers and enable nouveau drivers ====&lt;br /&gt;
 sudo apt-get purge nvidia-*&lt;br /&gt;
 dpkg --list | grep nvidia&lt;br /&gt;
Make sure the list of nvidia packages is empty&lt;br /&gt;
 sudo apt-get install --reinstall xserver-xorg-video-nouveau&lt;br /&gt;
==== Disable nouveau drivers and enable Nvidia drivers ====&lt;br /&gt;
&#039;&#039;&#039;Option 1&#039;&#039;&#039;, using package manager:&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-driver&lt;br /&gt;
or if your graphics card is not supported by the latest drivers (you can install the nvidia-detect package and run it to get this information):&lt;br /&gt;
 sudo apt-get install --reinstall nvidia-legacy-390xx-driver&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Option 2&#039;&#039;&#039;, using latest official NVidia driver:&lt;br /&gt;
* Go to [http://www.geforce.com] and download the latest Linux driver for your system.&lt;br /&gt;
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)&lt;br /&gt;
* Run the NVidia installer as root&lt;br /&gt;
 systemctl mask gdm&lt;br /&gt;
 systemctl stop gdm&lt;br /&gt;
 killall Xorg&lt;br /&gt;
 sudo ./NVIDIA-&amp;lt;driver-version-name&amp;gt;.run&lt;br /&gt;
&lt;br /&gt;
==== Display configuration set in nvidia-settings is not retained after boot ====&lt;br /&gt;
This is a conflict between nvidia-settings and Debians internal settings application.&lt;br /&gt;
* Remove ~/.config/monitors.xml (this is Debians settings)&lt;br /&gt;
* Reboot&lt;br /&gt;
* Set everything up the way you want with nvidia-settings&lt;br /&gt;
* Go to Settings - Display&lt;br /&gt;
* Do some minor change that brings up the &amp;quot;Apply&amp;quot; button and press it&lt;br /&gt;
* Current settings are now saved to ~/.config/monitors.xml and will be used during next boot.&lt;br /&gt;
&lt;br /&gt;
==== Display configuration for gdm3 ====&lt;br /&gt;
After doing the steps above, do:&lt;br /&gt;
 sudo cp /home/stefan/.config/monitors.xml /var/lib/gdm3/.config&lt;br /&gt;
&lt;br /&gt;
=== Switch default compiler ===&lt;br /&gt;
&lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  c++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  gcc (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
  g++ (Debian 6.1.1-11) 6.1.1 20160802&lt;br /&gt;
 &lt;br /&gt;
 sudo apt-get install gcc-4.9 g++-4.9&lt;br /&gt;
 &lt;br /&gt;
 gcc-4.9 --version&lt;br /&gt;
  gcc-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 g++-4.9 --version&lt;br /&gt;
  g++-4.9 (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
 &lt;br /&gt;
 gcc-5 --version&lt;br /&gt;
  gcc-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 g++-5 --version&lt;br /&gt;
  g++-5 (Debian 5.4.1-1) 5.4.1 20160803&lt;br /&gt;
 &lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30&lt;br /&gt;
 sudo update-alternatives --set cc /usr/bin/gcc&lt;br /&gt;
 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30&lt;br /&gt;
 sudo update-alternatives --set c++ /usr/bin/g++&lt;br /&gt;
 &lt;br /&gt;
 (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian&lt;br /&gt;
  cc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  c++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  gcc (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
  g++ (Debian 4.9.3-14) 4.9.3&lt;br /&gt;
&lt;br /&gt;
To go back:&lt;br /&gt;
 sudo update-alternatives --config gcc&lt;br /&gt;
 sudo update-alternatives --config g++&lt;br /&gt;
&lt;br /&gt;
=== Console is not filling the screen completely ===&lt;br /&gt;
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.&lt;br /&gt;
 ls /sys/class/drm&lt;br /&gt;
 card0@  card0-DisplayPort-1@  card0-DisplayPort-2@  card0-DisplayPort-3@  card0-HDMI Type A-1@  card0-HDMI Type A-2@  card0-LVDS-1@  card0-SVIDEO-1@  card0-VGA-1@  controlD64@  version&lt;br /&gt;
Now check the different &amp;quot;modes&amp;quot; and &amp;quot;connected&amp;quot; and &amp;quot;enabled&amp;quot; nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as&lt;br /&gt;
 video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d&lt;br /&gt;
More information: https://bbs.archlinux.org/viewtopic.php?id=94990&lt;br /&gt;
&lt;br /&gt;
=== udev ===&lt;br /&gt;
==== udev rules ====&lt;br /&gt;
Some sample udev rules which might come handy:&lt;br /&gt;
 KERNEL==&amp;quot;tty*&amp;quot;, GROUP=&amp;quot;dialout&amp;quot;, MODE=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEM==&amp;quot;gpio&amp;quot;, GROUP:=&amp;quot;gpio&amp;quot;, MODE:=&amp;quot;0660&amp;quot;&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, KERNEL==&amp;quot;ttyUSB*&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;XXXXXXXX&amp;quot;, SYMLINK+=&amp;quot;ftdiserial2usb&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Use %m for the device number in symlink names.&lt;br /&gt;
&lt;br /&gt;
==== udev info ====&lt;br /&gt;
To query a device about its properties (which can be used in udev rules):&lt;br /&gt;
&lt;br /&gt;
 udevadm info --path=/sys/class/leds/example --query=all --attribute-walk&lt;br /&gt;
 udevadm info --name /dev/sda&lt;br /&gt;
 udevadm info -a /dev/sda&lt;br /&gt;
&lt;br /&gt;
More info: https://linux.die.net/man/7/udev&lt;br /&gt;
&lt;br /&gt;
==== udev debugging ====&lt;br /&gt;
Command to reload udev rules:&lt;br /&gt;
 sudo udevadm control --reload-rules &amp;amp;&amp;amp; sudo udevadm trigger&lt;br /&gt;
&lt;br /&gt;
Command to test udev rules:&lt;br /&gt;
 udevadm test --action=add /class/gpio&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
How to make the scrollback work in screen? Add the following to your .screenrc file:&lt;br /&gt;
 termcapinfo xterm ti@:te@&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== LVM ===&lt;br /&gt;
&lt;br /&gt;
==== How to extend your LVM disk ====&lt;br /&gt;
Investigate your current setup with:&lt;br /&gt;
 lsblk&lt;br /&gt;
&lt;br /&gt;
Then you can perform operations like these (which reduces size of live-root with 50GB and extends size of live-home with 50GB):&lt;br /&gt;
 lvreduce -r -L -50G /dev/mapper/nobara_localhost--live-root&lt;br /&gt;
 lvextend -r -L +50G /dev/mapper/nobara_localhost--live-home&lt;br /&gt;
&lt;br /&gt;
== Linux performance ==&lt;br /&gt;
 [http://www.brendangregg.com/ http://www.brendangregg.com/]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=VmWare&amp;diff=223</id>
		<title>VmWare</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=VmWare&amp;diff=223"/>
		<updated>2023-09-23T11:39:39Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Fix &amp;quot;Failed - Object type requires hosted I/O&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For updates: https://esxi-patches.v-front.de/&lt;br /&gt;
&lt;br /&gt;
=Solve installation errors=&lt;br /&gt;
&lt;br /&gt;
If you get errors during installation such as:&lt;br /&gt;
&lt;br /&gt;
 [root@boss:/tmp] esxcli software profile update -p ESXi-6.7.0-20191204001-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml&lt;br /&gt;
  [InstallationError]&lt;br /&gt;
  [Errno 28] No space left on device&lt;br /&gt;
        vibs = VMware_locker_tools-light_11.0.1.14773994-15160134&lt;br /&gt;
  Please refer to the log file for more details.&lt;br /&gt;
&lt;br /&gt;
Then you can try to manually install the VIB by doing:&lt;br /&gt;
&lt;br /&gt;
 esxcli software vib install -v https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vib20/tools-light/&#039;&#039;&#039;&#039;&#039;&amp;lt;vibname from above&amp;gt;&#039;&#039;&#039;&#039;&#039;.vib&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
&lt;br /&gt;
 esxcli software vib install -v https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/esx/vmw/vib20/tools-light/VMware_locker_tools-light_11.0.1.14773994-15160134.vib&lt;br /&gt;
&lt;br /&gt;
And then resume the full update&lt;br /&gt;
&lt;br /&gt;
=List installed VIB:s=&lt;br /&gt;
To list VIB:s for the current installation:&lt;br /&gt;
 esxcli software vib list&lt;br /&gt;
&lt;br /&gt;
To list VIB:s that will be active after a reboot:&lt;br /&gt;
 esxcli software vib list --rebooting-image&lt;br /&gt;
&lt;br /&gt;
=List remote VIB:s=&lt;br /&gt;
 esxcli software sources vib list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml&lt;br /&gt;
&lt;br /&gt;
=Fix &amp;quot;Failed - Object type requires hosted I/O&amp;quot;=&lt;br /&gt;
SSH into the ESXI host. Locate the vmdk file, example:&lt;br /&gt;
 # cd /vmfs/volumes/BigAndQuick/HomeAssistant/&lt;br /&gt;
 # vmkfstools -x check hass.io.vmdk&lt;br /&gt;
 Disk needs repair.&lt;br /&gt;
 # vmkfstools -x repair hass.io.vmdk&lt;br /&gt;
 Disk was successfully repaired.&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Windows&amp;diff=222</id>
		<title>Windows</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Windows&amp;diff=222"/>
		<updated>2023-09-05T19:57:23Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Energy management =&lt;br /&gt;
&lt;br /&gt;
== Why computer was woken from sleep ==&lt;br /&gt;
To check why computer was woken from suspend:&lt;br /&gt;
 powercfg /lastwake&lt;br /&gt;
&lt;br /&gt;
== To disable Windows Update waking up the computer ==&lt;br /&gt;
Run as Administrator:&lt;br /&gt;
 gpedit.msc&lt;br /&gt;
&lt;br /&gt;
Then go to:&lt;br /&gt;
 Computer Configuration / Administrative Templates / Windows Components / Windows Update / Enabling Windows Update Power Management to automatically wake up the system to install scheduled updates&lt;br /&gt;
and set it to &amp;quot;Disabled&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
For swedish Windows:&lt;br /&gt;
 Datorkonfiguration / Administrativa mallar / Windows-komponenter / Windows Update / Aktivera automatisk väckning via Energisparfunktioner för installation av schemalagda uppdateringar&lt;br /&gt;
and set it to &amp;quot;Inaktiverad&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== To disable hibernation ==&lt;br /&gt;
&lt;br /&gt;
 powercfg.exe /h off&lt;br /&gt;
&lt;br /&gt;
== To uninstall a specific driver ==&lt;br /&gt;
&lt;br /&gt;
In a elevated command prompt:&lt;br /&gt;
 dism /online /get-drivers /format:table &amp;gt; c:\drivers.txt&lt;br /&gt;
Look through the drivers.txt file, and then you can do things like:&lt;br /&gt;
 pnputil.exe /d oem111.inf&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Boats&amp;diff=221</id>
		<title>Boats</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Boats&amp;diff=221"/>
		<updated>2023-08-15T21:51:42Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Good resource covering details on Evinrude E-Tec: https://continuouswave.com/whaler/reference/&lt;br /&gt;
&lt;br /&gt;
Official Evinrude diagnostic kits: https://www.powersports-diag.com/en/14-evinrude-diagnostic-kits&lt;br /&gt;
&lt;br /&gt;
Unofficial but solid source: https://matthewnavis.com/&lt;br /&gt;
&lt;br /&gt;
How to make your own: https://continuouswave.com/ubb/Forum6/HTML/002257.html&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Boats&amp;diff=220</id>
		<title>Boats</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Boats&amp;diff=220"/>
		<updated>2023-08-15T21:13:20Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Good resource covering details on Evinrude E-Tec: https://continuouswave.com/whaler/reference/&lt;br /&gt;
&lt;br /&gt;
Official Evinrude diagnostic kits: https://www.powersports-diag.com/en/14-evinrude-diagnostic-kits&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Boats&amp;diff=219</id>
		<title>Boats</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Boats&amp;diff=219"/>
		<updated>2023-08-15T21:11:35Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Created page with &amp;quot;Good resource covering details on Evinrude E-Tec: https://continuouswave.com/whaler/reference/&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Good resource covering details on Evinrude E-Tec: https://continuouswave.com/whaler/reference/&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=218</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=218"/>
		<updated>2023-08-15T21:11:06Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Indicium - The source of information =&lt;br /&gt;
&lt;br /&gt;
[[Linux kernel]]&lt;br /&gt;
&lt;br /&gt;
[[Linux]]&lt;br /&gt;
&lt;br /&gt;
[[Git]]&lt;br /&gt;
&lt;br /&gt;
[[Programming]]&lt;br /&gt;
&lt;br /&gt;
[[Learn programming]]&lt;br /&gt;
&lt;br /&gt;
[[Web]]&lt;br /&gt;
&lt;br /&gt;
[[Pinball]]&lt;br /&gt;
&lt;br /&gt;
[[FreeNAS]]&lt;br /&gt;
&lt;br /&gt;
[[Video Encoding]]&lt;br /&gt;
&lt;br /&gt;
[[Kodi]]&lt;br /&gt;
&lt;br /&gt;
[[Cars]]&lt;br /&gt;
&lt;br /&gt;
[[VmWare]]&lt;br /&gt;
&lt;br /&gt;
[[Windows]]&lt;br /&gt;
&lt;br /&gt;
[[Home Automation]]&lt;br /&gt;
&lt;br /&gt;
[[Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Backup]]&lt;br /&gt;
&lt;br /&gt;
[[Boats]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Backup&amp;diff=217</id>
		<title>Backup</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Backup&amp;diff=217"/>
		<updated>2023-07-19T16:28:24Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Created page with &amp;quot;Some interesting backup tools:  https://www.borgbackup.org/  https://github.com/m-manu/rsync-sidekick&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some interesting backup tools:&lt;br /&gt;
&lt;br /&gt;
https://www.borgbackup.org/&lt;br /&gt;
&lt;br /&gt;
https://github.com/m-manu/rsync-sidekick&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=216</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=216"/>
		<updated>2023-07-19T16:27:44Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Indicium - The source of information =&lt;br /&gt;
&lt;br /&gt;
[[Linux kernel]]&lt;br /&gt;
&lt;br /&gt;
[[Linux]]&lt;br /&gt;
&lt;br /&gt;
[[Git]]&lt;br /&gt;
&lt;br /&gt;
[[Programming]]&lt;br /&gt;
&lt;br /&gt;
[[Learn programming]]&lt;br /&gt;
&lt;br /&gt;
[[Web]]&lt;br /&gt;
&lt;br /&gt;
[[Pinball]]&lt;br /&gt;
&lt;br /&gt;
[[FreeNAS]]&lt;br /&gt;
&lt;br /&gt;
[[Video Encoding]]&lt;br /&gt;
&lt;br /&gt;
[[Kodi]]&lt;br /&gt;
&lt;br /&gt;
[[Cars]]&lt;br /&gt;
&lt;br /&gt;
[[VmWare]]&lt;br /&gt;
&lt;br /&gt;
[[Windows]]&lt;br /&gt;
&lt;br /&gt;
[[Home Automation]]&lt;br /&gt;
&lt;br /&gt;
[[Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Backup]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Golf&amp;diff=215</id>
		<title>Golf</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Golf&amp;diff=215"/>
		<updated>2023-07-15T12:38:16Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jacking up the car: https://www.youtube.com/watch?v=Kp3d05rT4lk&lt;br /&gt;
&lt;br /&gt;
Oil change: https://www.youtube.com/watch?v=j4wcAy-F2ok&lt;br /&gt;
&lt;br /&gt;
Air filter change: https://www.youtube.com/watch?v=LsaBOXA32xI&lt;br /&gt;
&lt;br /&gt;
Change cabin air filter: https://www.youtube.com/watch?v=sH0l39fTy0Q&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P0012:&lt;br /&gt;
&lt;br /&gt;
https://www.700r4transmissionhq.com/p0012-volkswagen-golf/&lt;br /&gt;
&lt;br /&gt;
http://wiki.ross-tech.com/wiki/index.php/16396/P0012/000018&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=Pu-PR3uhV5Q&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=y8i3i3Dxidc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P0236:&lt;br /&gt;
&lt;br /&gt;
https://www.yourmechanic.com/article/p0236-obd-ii-trouble-code-turbocharger-boost-sensor-a-circuit-range-performance-by-jay-safford&lt;br /&gt;
&lt;br /&gt;
Probably bad MAP sensor. Replaced with Bosch sensor: https://www.bildelaronline24.se/bosch/678552&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Golf&amp;diff=214</id>
		<title>Golf</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Golf&amp;diff=214"/>
		<updated>2022-10-25T19:36:25Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jacking up the car: https://www.youtube.com/watch?v=Kp3d05rT4lk&lt;br /&gt;
&lt;br /&gt;
Oil change: https://www.youtube.com/watch?v=j4wcAy-F2ok&lt;br /&gt;
&lt;br /&gt;
Air filter change: https://www.youtube.com/watch?v=LsaBOXA32xI&lt;br /&gt;
&lt;br /&gt;
Change cabin air filter: https://www.youtube.com/watch?v=sH0l39fTy0Q&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P0012:&lt;br /&gt;
&lt;br /&gt;
https://www.700r4transmissionhq.com/p0012-volkswagen-golf/&lt;br /&gt;
&lt;br /&gt;
http://wiki.ross-tech.com/wiki/index.php/16396/P0012/000018&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=Pu-PR3uhV5Q&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=y8i3i3Dxidc&lt;br /&gt;
&lt;br /&gt;
P0236:&lt;br /&gt;
&lt;br /&gt;
https://www.yourmechanic.com/article/p0236-obd-ii-trouble-code-turbocharger-boost-sensor-a-circuit-range-performance-by-jay-safford&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Golf&amp;diff=213</id>
		<title>Golf</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Golf&amp;diff=213"/>
		<updated>2022-10-25T19:05:40Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jacking up the car: https://www.youtube.com/watch?v=Kp3d05rT4lk&lt;br /&gt;
&lt;br /&gt;
Oil change: https://www.youtube.com/watch?v=j4wcAy-F2ok&lt;br /&gt;
&lt;br /&gt;
Air filter change: https://www.youtube.com/watch?v=LsaBOXA32xI&lt;br /&gt;
&lt;br /&gt;
Change cabin air filter: https://www.youtube.com/watch?v=sH0l39fTy0Q&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P0012:&lt;br /&gt;
&lt;br /&gt;
https://www.700r4transmissionhq.com/p0012-volkswagen-golf/&lt;br /&gt;
&lt;br /&gt;
http://wiki.ross-tech.com/wiki/index.php/16396/P0012/000018&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=Pu-PR3uhV5Q&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=y8i3i3Dxidc&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Golf&amp;diff=212</id>
		<title>Golf</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Golf&amp;diff=212"/>
		<updated>2022-10-25T19:05:27Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jacking up the car: https://www.youtube.com/watch?v=Kp3d05rT4lk&lt;br /&gt;
&lt;br /&gt;
Oil change: https://www.youtube.com/watch?v=j4wcAy-F2ok&lt;br /&gt;
&lt;br /&gt;
Air filter change: https://www.youtube.com/watch?v=LsaBOXA32xI&lt;br /&gt;
&lt;br /&gt;
Change cabin air filter: https://www.youtube.com/watch?v=sH0l39fTy0Q&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P0012:&lt;br /&gt;
&lt;br /&gt;
http://wiki.ross-tech.com/wiki/index.php/16396/P0012/000018&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=Pu-PR3uhV5Q&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=y8i3i3Dxidc&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=211</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=211"/>
		<updated>2022-10-20T19:08:23Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Indicium - The source of information =&lt;br /&gt;
&lt;br /&gt;
[[Linux kernel]]&lt;br /&gt;
&lt;br /&gt;
[[Linux]]&lt;br /&gt;
&lt;br /&gt;
[[Git]]&lt;br /&gt;
&lt;br /&gt;
[[Programming]]&lt;br /&gt;
&lt;br /&gt;
[[Learn programming]]&lt;br /&gt;
&lt;br /&gt;
[[Web]]&lt;br /&gt;
&lt;br /&gt;
[[Pinball]]&lt;br /&gt;
&lt;br /&gt;
[[FreeNAS]]&lt;br /&gt;
&lt;br /&gt;
[[Video Encoding]]&lt;br /&gt;
&lt;br /&gt;
[[Kodi]]&lt;br /&gt;
&lt;br /&gt;
[[Cars]]&lt;br /&gt;
&lt;br /&gt;
[[VmWare]]&lt;br /&gt;
&lt;br /&gt;
[[Windows]]&lt;br /&gt;
&lt;br /&gt;
[[Home Automation]]&lt;br /&gt;
&lt;br /&gt;
[[Raspberry Pi]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=210</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.steffe.net/index.php?title=Main_Page&amp;diff=210"/>
		<updated>2022-10-20T17:01:39Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Indicium - The source of information&lt;br /&gt;
&lt;br /&gt;
[[Linux kernel]]&lt;br /&gt;
&lt;br /&gt;
[[Linux]]&lt;br /&gt;
&lt;br /&gt;
[[Git]]&lt;br /&gt;
&lt;br /&gt;
[[Programming]]&lt;br /&gt;
&lt;br /&gt;
[[Learn programming]]&lt;br /&gt;
&lt;br /&gt;
[[Web]]&lt;br /&gt;
&lt;br /&gt;
[[Pinball]]&lt;br /&gt;
&lt;br /&gt;
[[FreeNAS]]&lt;br /&gt;
&lt;br /&gt;
[[Video Encoding]]&lt;br /&gt;
&lt;br /&gt;
[[Kodi]]&lt;br /&gt;
&lt;br /&gt;
[[Cars]]&lt;br /&gt;
&lt;br /&gt;
[[VmWare]]&lt;br /&gt;
&lt;br /&gt;
[[Windows]]&lt;br /&gt;
&lt;br /&gt;
[[Home Automation]]&lt;br /&gt;
&lt;br /&gt;
[[Raspberry Pi]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
</feed>