KVM notes

- 3 mins read

KVM notes

Check if the CPU supports virtualization:

egrep -c '(vmx|svm)' /proc/cpuinfo
lscpu | grep Virtualization
  • Install KVM
sudo apt install qemu-kvm qemu-utils libvirt-daemon-system libvirt-clients virtinst virt-manager
  • Check Virtualization
systemctl status libvirtd
systemctl --now enable libvirtd
  • Check qemu and virsh:
kvm --version
virsh --version
  • Components that can be used
sudo virt-host-validate
  • Check IOMMU
dmesg | grep -e DMAR -e IOMMU
  • Edit /etc/default/grub if WARN (IOMMU not enabled)

GRUB_CMDLINE_LINUX="intel_iommu=on" add this line to /etc/default/grub and sudo update-grub

Playing with langchain this is the conversation between a Commodore 64 and a ZX Spectrum.

Debate rules

You are in a debate your goal is to persuade your conversation partner of your point of view. 
Argue about topic polite. Be concise and conclusive use arround 60 words.
DO look up information with your tool to refute your partner's claims.
DO NOT fabricate fake citations.
DO NOT cite any source that you did not look up.
Do not add anything else.
Stop speaking the moment you finish speaking from your perspective.
Context: {memory}

Conversation for 10 rounds

Photon (work notes)

- 1 min read

PHOTON MISC

enable/disable docker

systemctl start docker
systemctl enable docker

install packages

tdnf install git
tdnf install github-cli
tdnf install zsh
tdnf install wget
tdnf install docker-compose
tdnf install nfs-tools
tdnf install nfs-utils
tdnf install tar

keyboard

localectl
localectl list-keymaps
tdnf install kbd
localectl list-keymaps
localectl set-keymap es
reboot

sshd root access

cat > /etc/systemd/network/10-static-en.network << "EOF"
[Match]
Name=eth0
[Network]
Address=192.168.1.200/24
Gateway=192.168.1.1

chmod 644 10-static-en.network

install docker-compose (check versions on github https://github.com/docker/compose/releases)

curl -L https://github.com/docker/compose/releases/download/v2.9.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

install portainer - expose port 9000

docker volume create portainer_data
ls -la
docker run -d -p 9000:9000 --name Portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

docker run -d -p 8000:8000 -p 9443:9443 --name rh_portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

iptables - open docker expose ports

iptables -L  (list rules)
iptables -nL (show port numbers)
# open port 9000
iptables -I INPUT 4 -p tcp --dport 9000 -j ACCEPT

save iptables

add -I INPUT 4 -p tcp –dport 9000 -j ACCEPT

NVidia Install (work notes)

- 5 mins read

NVIDIA Install

https://communities.vmware.com/t5/Photon-OS-Discussions/NVidia-Triton-on-Photon-OS/m-p/2926221 https://plmlab.math.cnrs.fr/plmshift/gpu_driver/-/blob/master/photon3.0/Dockerfile

nvidia_binary_version="515.76"
nvidia_binary="NVIDIA-Linux-x86_64-${nvidia_binary_version}.run"
mkdir tmp
cd tmp
wget -q https://us.download.nvidia.com/XFree86/Linux-x86_64/${nvidia_binary_version}/${nvidia_binary}
chmod +x ${nvidia_binary}
./${nvidia_binary} --accept-license --ui=none --no-kernel-module --no-questions
nvidia-smi
# required
tdnf install tar
tdnf install -y build-essential wget tar
tdnf install -y linux-esx-devel

nvidia_binary_version="470.57.02"
nvidia_binary="NVIDIA-Linux-x86_64-${nvidia_binary_version}.run"
wget -q https://us.download.nvidia.com/XFree86/Linux-x86_64/${nvidia_binary_version}/${nvidia_binary} 
chmod +x ${nvidia_binary}

./${nvidia_binary} --kernel-source-path=/usr/lib/modules/`uname -r`/build --ui=none --no-questions --accept-license


Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 470.57.02.....

Welcome to the NVIDIA Software Installer for Unix/Linux

Detected 32 CPUs online; setting concurrency level to 32.
Installing NVIDIA driver version 470.57.02.
There appears to already be a driver installed on your system (version: 470.57.02).  As part of installing this driver (version:
470.57.02), the existing driver will be uninstalled.  Are you sure you want to continue? (Answer: Continue installation)
Performing CC sanity check with CC="/usr/bin/cc".
Performing CC check.
Using the kernel source path '/usr/lib/modules/5.10.132-1.ph4-esx/build' as specified by the '--kernel-source-path' commandline
option.
Kernel source path: '/usr/lib/modules/5.10.132-1.ph4-esx/build'
Kernel output path: '/usr/lib/modules/5.10.132-1.ph4-esx/build'
Performing Compiler check.
Performing Dom0 check.
Performing Xen check.
Performing PREEMPT_RT check.
Performing vgpu_kvm check.
Cleaning kernel module build directory.
Building kernel modules
  : [##############################] 100%
Kernel module compilation complete.
Unable to determine if Secure Boot is enabled: No such file or directory
Kernel messages:
[   18.636632] IPv6: ADDRCONF(NETDEV_CHANGE): veth9f70f59: link becomes ready
[   18.636662] br-ff0ee4ab2a87: port 1(veth9f70f59) entered blocking state
[   18.636663] br-ff0ee4ab2a87: port 1(veth9f70f59) entered forwarding state
[   19.117388] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information.
[   19.117393] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <[email protected]>. All Rights Reserved.
[   75.562344] kauditd_printk_skb: 62 callbacks suppressed
[   75.562348] audit: type=1006 audit(1662044975.583:97): pid=1653 uid=0 subj==unconfined old-auid=4294967295 auid=0 tty=(none)
old-ses=4294967295 ses=1 res=1
[   75.647052] audit: type=1006 audit(1662044975.667:98): pid=1643 uid=0 subj==unconfined old-auid=4294967295 auid=0 tty=(none)
old-ses=4294967295 ses=2 res=1
[  814.633125] nvidia: loading out-of-tree module taints kernel.
[  814.633137] nvidia: module license 'NVIDIA' taints kernel.
[  814.633138] Disabling lock debugging due to kernel taint
[  814.665314] nvidia-nvlink: Nvlink Core is being initialized, major device number 246

[  814.666286] nvidia 0000:1b:00.0: enabling device (0000 -> 0003)
[  814.667559] nvidia 0000:1b:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[  814.712479] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  470.57.02  Tue Jul 13 16:14:05 UTC 2021
[  814.728936] nvidia_uvm: module uses symbols from proprietary module nvidia, inheriting taint.
[  814.732612] nvidia-uvm: Loaded the UVM driver, major device number 244.
[  814.737822] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  470.57.02  Tue Jul 13 16:06:24 UTC
2021
[  814.740363] [drm] [nvidia-drm] [GPU ID 0x00001b00] Loading driver
[  814.740365] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:1b:00.0 on minor 1
[  814.745448] [drm] [nvidia-drm] [GPU ID 0x00001b00] Unloading driver
[  814.748380] nvidia-modeset: Unloading
[  814.753086] nvidia-uvm: Unloaded the UVM driver.
[  814.756718] nvidia-nvlink: Unregistered the Nvlink Core, major device number 246

WARNING: nvidia-installer was forced to guess the X library path '/usr/lib64' and X module path '/usr/lib64/xorg/modules'; these
         paths were not queryable from the system.  If X fails to find the NVIDIA X driver module, please install the `pkg-config`
         utility and the X.Org SDK/development package for your distribution and reinstall the driver.


WARNING: Unable to find a suitable destination to install 32-bit compatibility libraries. Your system may not be set up for 32-bit
         compatibility. 32-bit compatibility files will not be installed; if you wish to install them, re-run the installation and
         set a valid directory with the --compat32-libdir option.

Uninstalling the previous installation with /usr/bin/nvidia-uninstall.
Searching for conflicting files:
  Searching: [##############################] 100%
Installing 'NVIDIA Accelerated Graphics Driver for Linux-x86_64' (470.57.02):
  Installing: [##############################] 100%
Driver file installation is complete.
Running post-install sanity check:
  Checking: [##############################] 100%
Post-install sanity check passed.
Running runtime sanity check:
  Checking: [##############################] 100%
Runtime sanity check passed.
Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver
will be used when you restart X?  Any pre-existing X configuration file will be backed up. (Answer: No)

Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 470.57.02) is now complete.  Please update your
xorg.conf file as appropriate; see the file /usr/share/doc/NVIDIA_GLX-1.0/README.txt for details.


nvidia-smi
Thu Sep  1 15:24:11 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:1B:00.0 Off |                  N/A |
|  0%   62C    P0     1W / 200W |      0MiB /  7982MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

nvidia-container-toolkit

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html https://github.com/NVIDIA/nvidia-docker

GPT News anonymizer

- 3 mins read

I’m using at home my own server to run gpt models. Without cost I can do funny and stupid things. This one run a pipeline of tasks to anonymize news, critics, sumarize, extract names, places, products, etc.

First I get the entries from google trends

Then I use the GPT model to generate the news.

With this I can generate my own “News Corporation”

The pipeline is like this:

Crazy idea to draw over screen using any tablet or phone :-) of course on linux

Is a client-server application that allows users to use their tablet devices to draw over their computer screen. It is designed to enhance creativity and collaboration by providing an interactive drawing experience. This documentation will guide you through the installation, setup, and usage of the program.

WORK IN PROGRESS

Features Two drawing modes: Mouse Drawing Mode (local) and Tablet Drawing Mode (remote) Tablet Drawing Mode accessible via a web interface, compatible with various tablet devices including iPads and Android tablets/phones. Screen capture and drawing capabilities on captured images. Supports image resizing for optimal tablet viewing.

Wireguard Setup (work notes)

- 2 mins read

Generate a valid and working WireGuard configuration file /etc/wireguard/wg0.conf. Our setup guide offers details.

Note: You may have to replace the Endpoint hostname with the WireGuard server IP address in the WireGuard configuration file. DNS may or may not be applied when systemd brings the wg0 interface up. Add the WireGuard service to systemd:

sudo systemctl enable [email protected]
sudo systemctl daemon-reload

Start the new service immediately:

sudo systemctl start wg-quick@wg0

Reboot your computer system to verify the automatic connection on startup works as expected.

Install nvidia drivers ubuntu 20.04 / 22.04

hypervisor.cpuid.v0 -> FALSE in vmware

sudo apt install build-essential  libglvnd-dev

First Disable nouveau & enable unsuported GPU’s for open source drivers:

  1. Go to: /etc/modprobe.d/
  2. Make a file: blacklist-nvidia-nouveau.conf
  3. Put this in the file:
blacklist nouveau
options nouveau modeset=0
  1. Make a other “nvidia.conf” file and put this in the file: options nvidia
NVreg_OpenRmEnableUnsupportedGpus=1
  1. Updat kernel init ram fs:
sudo update-initramfs -u
  1. Uninstall intel microcode
sudo dpkg -l | grep intel
sudo apt purge intel-microcode
sudo update-grub
  1. Reboot
  2. Go to the Nvidia site to the page to download the driver that you want.
mkdir tmp & cd tmp
wget https://es.download.nvidia.com/XFree86/Linux-x86_64/515.76/NVIDIA-Linux-x86_64-515.76.run
  1. Copy the URL of the download butten and past it behind wget to download it to the current folder
  2. Sudo chmod 700 the file
sudo chmod 700 NVIDIA*
  1. Run the install file: sudo .\filename.run -m=kernel-open
  2. After the instalation reboot the server
  3. Test with nvidia-smi
sudo apt install nvidia-driver-470-server
sudo apt install nvidia-utils-470-server

sudo lshw -C display

  *-display
       description: VGA compatible controller
       product: SVGA II Adapter
       vendor: VMware
       physical id: f
       bus info: pci@0000:00:0f.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=vmwgfx latency=64
       resources: irq:16 ioport:1070(size=16) memory:e8000000-efffffff memory:fe000000-fe7fffff memory:c0000-dffff
  *-display UNCLAIMED
       description: VGA compatible controller
       product: NVIDIA Corporation
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:0b:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller cap_list
       configuration: latency=64
       resources: memory:fc000000-fcffffff memory:d0000000-dfffffff memory:e4000000-e5ffffff ioport:5000(size=128)

List Drivers

LVM Add Disk (work notes)

- 4 mins read

Introduction & Explanation (pasted)

Why LVM?

The reason why we love LVM is because when you need to increase the space it’s really easy. If you have vanilla EXT4 and you want to enlarge it, then you need to work out extents and at this point we feel it’s too complicated and technical. See here if you simply want to add a new EXT4 disk without LVM.

Below are the commands used to get the whole operation going.

Docker Ubuntu (work notes)

- 1 min read

Install on ubuntu 20.04

sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker