nmap usage

Discover Live Hosts – Ping Scan – Host Discovery Without Port Scanning

nmap -sn 192.168.1.0/24

Scan a Specific Host

nmap -sV 192.168.1.100

TCP SYN Scan (Stealth Scan)

nmap -sS 192.168.1.100
nmap -sS -p 22,80,443 192.168.1.10

TCP Connect Scan (Full Handshake)

nmap -sT 192.168.1.100 # Works without root privileges

Service and Version Detection

nmap -sV 192.168.1.100
nmap -sV --version-intensity 5 192.168.1.100 # More thorough probing (scale: 0-9)

OS Detection (OS Fingerprinting)

nmap -O 192.168.1.100
nmap -O --osscan-guess 192.168.1.100 # Shows best guess even with low confidence

Aggressive Scan (All-in-One Detection)
The -A flag runs four operations at once:

  • OS detection (-O)
  • Service and version detection (-sV)
  • Default NSE script scan (-sC)
  • Traceroute
nmap -A 192.168.1.100
nmap -A -T4 192.168.1.100 # Aggressive scan at fast timing

Bluetooth headphones won’t connect

my Ozeino headphones often stop talking to my Debian NUC system.

To fix, open a terminal on the linux box

elevate to sudo. perform the following while playing with the power/connect button on the headphones.

bluetoothctl scan on
bluetoothctl pair 7c:4d:f0:25:85:89

bluetoothctl connect 7c:4d:f0:25:85:89

if still no luck, then delete the device:

bluetoothctl remove 7c:4d:f0:25:85:89
bluetoothctl pair 7c:4d:f0:25:85:89

Linux Cockpit Terminal screen illegible

If the Terminal screen on a server’s Cockpit page is illegible, you’ll need to set the site permissions from your client web browser.

Go to the site at http://x.x.x.x:9090, login, click the Terminal option.

Click the lock icon in the address bar.

Click on Connection Not Secure.

Click on More Information.

Click on the Permissions icon.

Under “Extract Canvas Data”, unselect “Use Default” and select “Allow”.

Refresh the page. You may have to change the font size.

upgrade to Debian 13 Trixie

Pre-Upgrade System Preparation

elevate to root

Create System Backup
mkdir mkdir /mnt/athena_backups/"$HOSTNAME"_backups
tar -czf /mnt/athena_backups/"$HOSTNAME"_backups/etc-backup-$(date +%Y%m%d).tar.gz /etc
dpkg --get-selections > /mnt/athena_backups/"$HOSTNAME"_backups/package-selections-$(date +%Y%m%d).txt
Ensure Debian 12 is fully updated before proceeding
apt update
apt upgrade -y
apt dist-upgrade -y
apt clean
apt autoremove -y
Verify system integrity before upgrade
apt --fix-broken install
dpkg --configure -a
Create safety copy of repository settings
cp /etc/apt/sources.list /etc/apt/sources.list.bookworm-backup
cp -r /etc/apt/sources.list.d /etc/apt/sources.list.d.bookworm-backup
Update Main Sources List and Additional Repositories
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
find /etc/apt/sources.list.d -name "*.list" -exec sed -i 's/bookworm/trixie/g' {} ;

This systematically updates all repository references from Bookworm to Trixie across all configuration files.

apt update

Third-party repositories may not immediately support Trixie. Consider temporarily disabling them by adding ‘#’ at the beginning of their lines in sources configuration files.

Minimal Upgrade First
apt upgrade --without-new-pkgs
Full Distribution Upgrade
apt full-upgrade
Confirm successful upgrade completion
cat /etc/debian_version
lsb_release -a
cat /etc/os-release
Clean Obsolete Packages
apt autoremove -y
apt autoclean
Update Package Cache
apt update
apt list --upgradable
System Reboot: Complete the upgrade process
systemctl reboot

Backup Nextcloud

sudo su -
cd /var/www/html/nextcloud/

turn maintenance mode on

sudo -u www-data php occ maintenance:mode --on

run backups

tar -cvpzf /mnt/athena_backups/nextcloud_backup/nextcloud-$(date +"%Y-%m-%d").tar.gz -C /var/www/html/nextcloud/ .

turn maintenance mode off

cd /var/www/html/nextcloud/
sudo -u www-data php occ maintenance:mode --off
OR:
cd /var/www/html/nextcloud/config/
sed -i s/"'maintenance' => true"/"'maintenance' => false"/ config.php

mkvtoolnix

MKVToolNix GUI
is a Qt GUI for mkvmerge and a successor of mmg.
mkvmerge
merges multimedia streams into a Matroska file.
mkvinfo
lists all elements contained in a Matroska file.
mkvextract
extracts specific parts from a Matroska file to other formats.
mkvpropedit
allows to analyze and modify some Matroska file properties.

General Format for mkvmerge:

mkvmerge -o video_merged.mkv original.mkv original.srt

where -o or –output file-name is write to the file file-name.

add subs to a video:

mkvmerge -o Max\ Headroom\ -\ S01E01\ -\ Blipverts-merged.mkv Max\ Headroom\ -\ S01E01\ -\ Blipverts.mkv Max\ Headroom\ -\ S01E01\ -\ Blipverts.srt

extract subs from simple file:

mkvmerge -i Star\ Trek\ Lower\ Decks\ -\ S01E01\ -\ Second\ Contact.mkv
mkvextract tracks Star\ Trek\ Lower\ Decks\ -\ S01E01\ -\ Second\ Contact.mkv 2:Star\ Trek\ Lower\ Decks\ -\ S01E01\ -\ Second\ Contact.srt

extract subs from complex file:

mkvmerge -i Cowboy\ Bebop\ (2021)\ -\ S01E01\ -\ Cowboy\ Gospel.mkv
mkvextract tracks Cowboy\ Bebop\ (2021)\ -\ S01E01\ -\ Cowboy\ Gospel.mkv 7:Cowboy\ Bebop\ (2021)\ -\ S01E01\ -\ Cowboy\ Gospel.srt

convert mp4 to mkv with srt:

mkvmerge -o "result.mkv" "orig.mp4" "subs.srt"

Adjust History file to erase duplicates and set larger capacity

vim .bashrc

look for the following lines and adjust HISTCONTROL, HISTSIZE, and HISTFILESIZE accordingly:

#don't put duplicate lines or lines starting with space in the history.
#See bash(1) for more options
HISTCONTROL=ignoreboth:erasedups
#append to the history file, don't overwrite it
shopt -s histappend
#for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=9999
HISTFILESIZE=9999

Remove invalid files by inode

This is for when you find files with invalid names that regular ‘rm’ won’t touch, eg.:

387090 drwx------ 3 root root 4.0K Aug 4 17:14 ''$'\033''[?25h'$'\033''[?7h'/

First you need to get the inode, using:

ls -il

this will show the inode at the left.

To remove the file, use the ‘find’ command. First we’ll see what ‘find’ can see:

find . -inum (inode number from before)

You should see just your invalid file. Remove it with:

find . -inum (inode number from before)  -exec rm -rf {} \;

Installing an M.2 HAT+ on a Raspberry Pi 5

Setup a Raspberry Pi 5 system with standard SD card configuration. Use the Raspberry Pi Imager to configure the Pi.

update the raspi:

sudo apt update && sudo apt full-upgrade

and also update the firmware:

sudo rpi-eeprom-update -a

Shut down the Raspberry Pi.

Install and connect the Raspberry Pi Active Cooler.

The M.2 HAT+ should come with at least four short screws and four long screws, along with four threaded standoffs. Attach the standoffs to the Pi so that they are on top of the Pi.

Add the GPIO extender to the Pi’s GPIO pins. Push down on either end, or with a small screwdriver, to get the extender securely attached.

Open the PI’s PCIe connector using your fingernails. Connect the HAT+ ribbon cable to the PCIe connector, and close the connector.

Align the HAT+’s GPIO over the GPIO connector and push down evenly.

Use the short screws to connect the HAT+ to the standoffs.

Install the Raspberry Pi into its case.

Boot the Raspberry Pi using the SD card as your boot device.

Use the Raspberry Pi Imager to install the Raspberry Pi software to the NVME drive.

Run from a command prompt:

sudo raspi-config

Under Advanced Options, go to Boot Order, then choose NVMe/USB boot.

Exit raspi-config, then shutdown. Remove the SD card, and boot the Pi.

Show Git Branch Names in Your Bash Prompt

from: https://tecadmin.net/how-to-show-git-branch-names-in-your-bash-prompt/

vim ~/.bashrc

add the following:

#Function to show the current Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^]/d' -e 's/ (.*)/(\1)/'
}
#Custom PS1 prompt
export PS1="[\033[1;36m]\u[\033[1;31m]@[\033[1;34m]\h:[\033[1;35m][\e[32m]\w [\e[91m]\$(parse_git_branch)[\e[00m]$ "

load the new settings:

source ~/.bashrc
Posted in git

libvirt / qemu guest won’t start

If you see the error message “Error starting domain: Requested operation is not valid: network ‘default’ is not active”, it means the network hasn’t started.

Do the following:

sudo virsh net-list --all

You will see:

Name State Autostart Persistent

default inactive no yes

sudo virsh net-start default

Network default started

Set it to autostart:

sudo virsh net-autostart default

Check status:

sudo virsh net-list --all

Name State Autostart Persistent

default active yes yes

Posted in KVM

Bambu Labs P1S Filament Chart

(taken from https://wiki.bambulab.com/en/general/filament-guide-material-table and modified slightly)

MaterialEnclosed printer
(X1C, X1, X1E, P1S, enclosed P1P, etc.)
0.2 mm Nozzle0.4 mm Nozzle 0.6 mm Nozzle0.8 mm Nozzle Hardened Steel Nozzle Required? *Nozzle Temperature
(± 10 °C)
Compatible with AMS / AMS lite? **
PLA***YESYESYESYESYESNO190 – 240YES
Wood / Rock / Metal-filled PLAYESNOYESYESYESYES for Metal-filled PLA190 – 240YES  when not very brittle, rough or soft
PLA-CF/GFYESNORecommended for Bambu PLA-CFYESYESYES210 – 240YES for Bambu PLA-CF
PLA Glow / Glow-in -the-darkYESNORecommendedYESYESRecommended for long-term printing210 – 240YES for AMS, not recommended for AMS lite
PVA, BVOH
Dry State
YESYES 
(Dry State)
YESYESYESNO190 – 240YES 
(Dry State)
Support W, Support for PLA, Support for PLA/PETGYESYESYESYESYESNO190 – 240YES
PETGYES
Recommended
YESYESYESYESNO240 – 270YES
PETG-CFYES
Recommended
NORecommended for Bambu PETG-CFYESYESYES240 – 270YES for AMS, not recommended for AMS lite
TPUYESNot recommendedYESYESYESNO200 – 250NO
ABS RecommendedYESYESYESYESNO240 – 280YES
ABS-GF RecommendedNOYESYESYESYES240 – 280YES
ASA RecommendedYESYESYESYESNO240 – 280YES
PC RecommendedNot recommendedYESYESYESNO260 – 290YES
PA RecommendedNOYESYESYESNO260 – 290YES
Support for PA/PET RecommendedNOYESHighly recommendedYESYES260 – 300YES for Bambu PA-CF, PAHT-CF
PA-CF/GF
PA6-CF/GF
PAHT-CF/GF
 RecommendedNOYESHighly recommendedYESYES260 – 300YES for Bambu PA-CF, PAHT-CF
PET-CF/GF RecommendedNOYESHighly recommendedYESYES260 – 300NO
PPA-CF/GF RecommendedNOYESHighly recommendedYESYES285 – 320NO
PPS RecommendedNOYESYESYESNO285 – 330YES
PPS-CF/GF RecommendedNOYESHighly recommendedYESYES310 – 350
* (Common nozzle materials include hardened steel, stainless steel and brass)

** Please note that it only explains the filament compatibility with AMS / AMS lite from the perspective of filament loading and unloading. In actual use, the compatibility between the printers and the filaments must also be considered.

***The PLA here refers to normal PLA, that is, PLA that does not contain carbon fiber (CF), glass fiber (GF) or other metal, inorganic non-metal fillers with high hardness and big particle size, , including PLA Basic, PLA Matte , PLA Tough, PLA Metal, PLA Silk, PLA Aero, PLA Dynamic, etc., excluding PLA-CF, PLA-GF, PLA Sparkle, PLA Marble, etc.

Collect all .ssh folders

Set up a folder call ~/Documents/keys on the collector system

Using tmux-cssh, log in to all source systems.

On all source systems, enter:

tar -cvzf $HOSTNAME.tar.gz ~/.ssh/* && scp $HOSTNAME.tar.gz jeff@calypso:/home/jeff/Documents/keys

You should now have all systems (assuming that they could scp to the collector) listed in the keys folder, with the source hostname in the filename.

Install Teams For Linux

Debian/Ubuntu and other derivatives

sudo mkdir -p /etc/apt/keyrings
sudo wget -qO /etc/apt/keyrings/teams-for-linux.asc https://repo.teamsforlinux.de/teams-for-linux.asc
echo "deb [signed-by=/etc/apt/keyrings/teams-for-linux.asc arch=$(dpkg --print-architecture)] https://repo.teamsforlinux.de/debian/ stable main" | sudo tee /etc/apt/sources.list.d/teams-for-linux-packages.list
sudo apt update
sudo apt install teams-for-linux

RHEL/Fedora and other derivatives

curl -1sLf -o /tmp/teams-for-linux.asc https://repo.teamsforlinux.de/teams-for-linux.asc; rpm --import /tmp/teams-for-linux.asc; rm -f /tmp/teams-for-linux.asc
curl -1sLf -o /etc/yum.repos.d/teams-for-linux.repo https://repo.teamsforlinux.de/rpm/teams-for-linux.repo
yum update
yum install teams-for-linux

Using KVM/libvirt/qemu

Setup KVM in Linux

Install virsh:

$ sudo apt-get install libvirt-bin
This can be local, or even remote. In most cases, if you want to manage VMs running on the local hypervisor:
$ virsh connect qemu:///system
List any existing VMs:
$ virsh list

You can export the XML of an existing virtual machine:

$ virsh dumpxml myoldvm > ~/myoldvm.xml

And then edit myoldvm.xml, which should be rather straightforward. For more information about libvirt XML format, see:
http://libvirt.org/format.html

Once you have an XML file describing the new virtual machine you want to create, import it into virsh, and run it immediately:

$ virsh create ~/myoldvm.xml
See if it worked:
$ virsh list

Working with a Running Virtual Machine:

$ virsh start mynewvm
$ virsh reboot mynewvm
$ virsh shutdown mynewvm
$ virsh suspend mynewvm
$ virsh resume mynewvm

To delete a virtual machine, first terminate it (if running), and then undefine it:

$ virsh destroy mynewvm
$ virsh undefine mynewvm
Posted in KVM

conky config for raspberry pi

conky.config ={
— CONKY SETTINGS

background = false,
update_interval = 1,
total_run_times = 0,

cpu_avg_samples = 2,
net_avg_samples = 2,

override_utf8_locale = true,

double_buffer = true,
no_buffers = true,

text_buffer_size = 32768,

— CONKY: WINDOW SPECIFICATIONS
own_window = true,
own_window_argb_value = 192,
own_window_argb_visual = true,
own_window_class = ‘conky-semi’,
own_window_colour = ‘#0b0d18’,
own_window_hints = ‘undecorated,below,sticky,skip_taskbar,skip_pager’,
— own_window_transparent = true,
own_window_transparent = true,
own_window_type = ‘normal’,
— own_window_type = ‘desktop’,
double_buffer = true,

border_inner_margin = 6,
border_width = 5,

minimum_height = 1000,

minimum_width = 280,
maximum_width = 280,

alignment = ‘top_right’,
gap_x = -1910,
gap_y = 40,

— GRAPHICS SETTINGS
draw_shades = false,
draw_outline = true,
draw_borders = false,
draw_graph_borders = true,
— draw_graph_borders = false,

— TEXT SETTINGS
use_xft = true,
font = ‘Montserrat Regular:size=10’,
xftalpha = 0.2,

uppercase = false,

— Pad percentages to this many decimals (0 = no padding)
pad_percents = 2,

— COLOUR SETTINGS
default_color = ‘AAAAAA’,
default_shade_color = ‘333333’,
— default_outline_color = ‘111111’,
default_outline_color = ‘010101’,
color1 = ‘999999’,
color2 = ‘CCCCCC’,
color3 = ‘EEEEEE’,
color4 = ‘444444’,
color5 = ‘555555’,
color6 = ‘666666’,
color7 = ‘3b71a1’,
};

conky.text = [[

${alignc}${font Arial:size=20}${color #0040FF}Raspberry Pi OS ${color #0040FF}
${alignc}${color #0040FF}Hostname: ${color #0040FF}${nodename}
${color6}${hr 2}${color}
${alignc}${color1}${font Montserrat Bold:size=20}${time %H:%M:%S}${font}${color}${alignc}
${voffset -9}
${alignc}${font Montserrat Light:size=10}${time %A %d %B %Y}${font}${alignc}
${color6}${hr 2}${color}
${voffset -6}
${font Arial:bold:size=9}${color #00AAFF}System ${color #0000AA}${hr 2}

${color #00AAFF}${font Montserrat Light:size=9}Hostname:${alignr}$font${color #505050}$nodename
${color #00AAFF}${font Montserrat Light:size=9}Uptime:${alignr}$font${color #505050}$uptime_short
${color #00AAFF}${font Montserrat Light:size=9}Kernel:${alignr}$font${color #505050}$kernel ${voffset 5}
${color #00AAFF}${font Montserrat Light:size=9}Distro:${alignr}$font${color #505050}${exec lsb_release -a 2>/dev/null | grep -i description | cut -s -f2}
${color #00AAFF}${font Montserrat Light:size=9}Frequency:${alignr}$font${color #505050}${freq_g cpu0}Ghz
${color #00AAFF}${font Montserrat Light:size=9}Uptime:${alignr}$font${color #505050}${uptime}
${font Arial:bold:size=9}${color #00AAFF}CPU ${color #0000AA}${hr 2}
${voffset -15}
${font Montserrat Light:size=9}${color1}CPU TEMP:${color}${font} ${font :size=10}${alignr}${hwmon 1 temp 1}°${color4}C${color}${voffset 5}
${voffset -15}
$font${color #505050}CPU1 ${color #AAAAAA}${cpu cpu1}%${color #505050} ${cpubar cpu1}
CPU2 ${color #AAAAAA}${cpu cpu2}%${color #505050} ${cpubar cpu2}
CPU3 ${color #AAAAAA}${cpu cpu3}%${color #505050} ${cpubar cpu3}
CPU4 ${color #AAAAAA}${cpu cpu4}%${color #505050} ${cpubar cpu4}
${voffset -8}
${font Arial:bold:size=9}${color #00AAFF}Network ${color #0000AA}${hr 2}
${voffset -15}
${font Montserrat Light:size=10}${color1}IP ADDRESS:${color}${font} ${alignr}${addr eth0}
${voffset 5}${font Montserrat Light:size=10}${font}Download ${alignr}${downspeedf eth0}k/s (${totaldown eth0})
${color3}${downspeedgraph eth0 50,280 ADFF2F 32CD32 -t}
${font Montserrat Light:size=10}${font}Upload ${alignr}${upspeedf eth0}k/s (${totalup eth0})
${color3}${upspeedgraph eth0 50,280 FF0000 8B0000 -t}
${font Arial:bold:size=9}${color #00AAFF}HDD ${color #0000AA}${hr 2}
${color1}Used: ${color3}${fs_used /}${color1}${goto 175}Free:${goto 225}${color3}${fs_free /}
${color2}${fs_bar /}
${font Montserrat Light:size=8}${color1}DISK I/O:${color}${font} ${alignr}$diskio
${voffset 2}${font Montserrat Light:size=8}${color1}READ: ${color}${font} ${goto 80}${color4}${diskiograph_read 15,210 ADFF2F 32CD32 750}${color}
${voffset 2}${font Montserrat Light:size=8}${color1}WRITE:${color}${font} ${goto 80}${color4}${diskiograph_write 15,210 FF0000 8B0000 750}${color}
${font Arial:bold:size=9}${color #00AAFF}Memory ${color #0000AA}${hr 2}
$font${color DimGray}RAM $alignc $mem / $memmax $alignr ${color 188f18}$memperc%
${color 188f18}$membar${voffset 1}
${font Arial:bold:size=9}${color #00AAFF}Processes ${color #0000AA}${hr 2}
${voffset -15}
${font :size=10}${font Montserrat Light:size=8}${color1}TOTAL:${color}${font} ${alignr}${processes}
${voffset -10}
${font Montserrat Light:size=9}${color1}APP NAME: ${goto 160}MEMORY: ${goto 245}CPU: ${color}${font}
${voffset -16}
${font Montserrat Light:size=9}${color1}${top_mem name 1} ${color}${font} ${goto 160}${top mem 1} % ${goto 235}${top cpu 1} %
${font Montserrat Light:size=9}${color1}${top_mem name 2} ${color}${font} ${goto 160}${top mem 2} % ${goto 235}${top cpu 2} %
${font Montserrat Light:size=9}${color1}${top_mem name 3} ${color}${font} ${goto 160}${top mem 3} % ${goto 235}${top cpu 3} %
${font Montserrat Light:size=9}${color1}${top_mem name 4} ${color}${font} ${goto 160}${top mem 4} % ${goto 235}${top cpu 4} %
${font Montserrat Light:size=9}${color1}${top_mem name 5} ${color}${font} ${goto 160}${top mem 5} % ${goto 235}${top cpu 5} %

]];

when ubuntu software comes up empty

Ubuntu Software aka Snap Store opens up essentially blank.

Close the Snap Store application

Open the terminal (Ctrl+Alt+T)

Type the command:

ps -ef|grep snap-store|grep -v grep

…to check if snap-store process is still running

If you get anything in the output, that indicates that snap-store is still running. The output may be like:

username 24225 1871 2 21:41 ? 00:00:23 /snap/snap-store/542/usr/bin/snap-store

in that case type the command

kill (number)

…where number is the first number shown in the line above, right after the username (in this case 24225)

repeat step 3 to confirm that snap-store is not running anymore

type the command:

snap-store

…and watch the output for “access denied” messages.

#########

On Ubuntu 20.04LTS the app called “Ubuntu software” is in reality snap-store (the terminal command running it is “snap-store”, not “gnome-software”). Ubuntu 20.04 does not seem to come with gnome-software installed by default. For me, closing the app, then typing

killall snap-store

in a terminal and then re-launching the app solved the problem without a reboot.

ubuntu Nautilus won’t open, or fails often

“Files” File manager (Nautilus) is not working on an Ubuntu system. Files either stops working, or won’t load at all.

try:

  1. reinstalling nautilus-data using below command
sudo apt-get install --reinstall nautilus-data  ## this one worked in 22.04
  1. terminating the running nautilus process
ps awx | grep nautilus
sudo kill (process ID) 
  1. Uninstalling and reinstalling Nautilus

sudo apt-get remove nautilus

sudo apt-get autoremove
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nautilus

rsync standard setting

rsync -Pavuc <source> <target>

What does it mean?

-P  --same as --partial --progress
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-v, --verbose increase verbosity
-u, --update skip files that are newer on the receiver
-c, --checksum skip based on checksum, not mod-time & size
-a includes:
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-p, --perms preserve permissions
-t, --times preserve modification times
-g, --group preserve group
-o, --owner preserve owner (super-user only)
-D  --same as --devices --specials
      --devices preserve device files (super-user only)
      --specials preserve special files

Change the site tab icon in WordPress

Upload the image you want to use to your site’s media collection.

In your site’s WP editor, go to Appearance > Customize

Choose Site Identity

Select Site Icon down near the bottom of the sidebar (depending on your theme, version, etc.)

Choose your image. You may have to crop it down a bit.

Publish/Update and you’re done.

Ubuntu install qemu/libvirtd

egrep -c '(vmx|svm)' /proc/cpuinfo # to confirm virtualization is enabled in BIOS > you need anything greater than zero returned
sudo apt update
sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo apt install -y qemu-kvm
qemu-system-x86_64 --version ## verify install
sudo apt install -y  virtinst libvirt-daemon
sudo systemctl enable --now libvirtd # enable service
sudo apt install -y virt-manager ## install the GUI
reboot



when transferring from old machine:

copy over the qcow files to appropriate path

restore backups of folder /etc/libvirt/qemu

make sure the paths in the xml files are correct

fix/import the xml files with:

virsh define rhel901.xml

Posted in KVM

Create comic book files

After downloading comic book or anime images as a mix of .webp and .jpg, run the following:

find . -name "* *" -type f | rename -v -f 's/ /_/g' && for f in *.webp; do dwebp $f -o $f.jpg;done && rename -v 's/\.webp\.jpg/\.jpg/' * && rm *.webp && sudo chown -R jeff:users * && sudo chmod -R 777 *

This will change any spaces to underscores, convert any .webp to .webp.jpg, rename those to just .jpg, set permissions and ownership.

Use the compress option in Gnomes Files to compress the jpg’s into a .zip, then rename the .zip to .cbz

or:

zip bookname.cbz *.jpg

Install cryptsetup on Linux

In this example, we’ll set up a 16Gb encrypted partition on a separate disk.

Note that this will wipe everything on your partition.

As root, use fdisk to determine which partition you want to use:

# fdisk -l

You could also use lsblk to show your installed drives:

# lsblk

In our case, we’re going to encrypt /dev/sde1, a 16GB USB stick.

First thing you need to do is to come up with a passphrase that you can remember.

Next, we’ll start the encryption process.

In our case, we want:

# cryptsetup -v luksFormat --type=luks2 /dev/sde1

Pay attention to the prompts.

You can check the man page for more options.

Now let’s open the encrypted volume, and give it a name for mapping the partition:

# cryptsetup open /dev/sde1 mypart

Next, give it a filesystem, using ext4:

# mkfs.ext4 /dev/mapper/mypart

Now create a mount point:

# mkdir /mnt/testenc
To mount the encrypted volume, you can use the cryptsetup with the mount command.
# cryptsetup --type luks open /dev/sde1 mypart
# mount -t ext4 /dev/mapper/mypart /mnt/testenc

To close the partition, do the following:

# umount /place/to/mount
# cryptsetup close mypart