Fix libvirt network create error with vagrant

when vagrant up `create': Call to virD omainCreateWithFlags failed: Network not found: no network with matching name 'vagrant-libvirt' (Libvirt::Error) fix it 1cat<<EOF> /var/tmp/vagrant-libvirt.xml 2<!-- 3WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE 4OVERWRITTEN AND LOST. Changes to this xml configuration should be made using: 5 virsh net-edit default 6or other application using the libvirt API. 7--> 8 9<network> 10 <name>vagrant-libvirt</name> 11 <uuid>17f365b0-4da6-4f19-91b6-c4dde30d6ac0</uuid> 12 <forward mode='nat'/> 13 <bridge name='virbr1' stp='on' delay='0'/> 14 <mac address='52:54:00:0f:4f:10'/> 15 <domain name='kvm' localOnly='yes'/> 16 <ip address='192.168.122.1' netmask='255.255.255.0'> 17 <dhcp> 18 <range start='192.168.122.2' end='192.168.122.254'/> 19 </dhcp> 20 </ip> 21</network> 22EOF 23virsh net-define /var/tmp/vagrant-libvirt.xml 24virsh net-start vagrant-libvirt 25virsh net-autostart vagrant-libvirt 26virsh net-list 27brctl show create libvirt network

2022-09-11 · G2G

Archlinux install with UEFI / BTRFS

… in UNATTENDED mode PRE-INSTALL download Archlinux ISO 1aria2c 'https://archlinux.org/releng/releases/2021.01.01/torrent/' 2sha1sum archlinux-2021.01.01-x86_64.iso 3gpg --receive-keys 0x4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC 4gpg --verify archlinux-2021.01.01-x86_64.iso.sig INSTALL FROM LIVECD ! CAUTION ! IT WILL DELETE ALL DATA FROM YOUR FIRST HDD DEVICE ( SATA or SSD ) 1MY_DEVICE="$(awk '/ sd| vd| nvme/{print $4}' /proc/partitions | head -1)" 2 3timedatectl set-ntp true 4 5parted /dev/${MY_DEVICE} -s mklabel gpt mkpart ESP fat32 1M 128M set 1 boot on mkpart primary ext4 128M 100% 6 7mkfs.vfat -n ESP /dev/${MY_DEVICE}1 8mkfs.btrfs -f -L ROOT /dev/${MY_DEVICE}2 9 10mount -t btrfs /dev/${MY_DEVICE}2 /mnt/ 11btrfs subvolume create /mnt/@root 12btrfs subvolume create /mnt/@var 13btrfs subvolume create /mnt/@home 14btrfs subvolume create /mnt/@snapshots 15 16umount /mnt 17mount -o subvol=@root /dev/${MY_DEVICE}2 /mnt 18mkdir /mnt/{var,home,.snapshots} 19mount -o subvol=@var /dev/${MY_DEVICE}2 /mnt/var 20mount -o subvol=@home /dev/${MY_DEVICE}2 /mnt/home/ 21mount -o subvol=@snapshots /dev/${MY_DEVICE}2 /mnt/.snapshots 22 23mkdir /mnt/boot 24mount /dev/${MY_DEVICE}1 /mnt/boot 25 26pacstrap /mnt base linux linux-firmware base-devel make binutils btrfs-progs zsh vim git sudo efibootmgr wpa_supplicant dialog iw bash-completion 27 28genfstab -L /mnt >> /mnt/etc/fstab INSTALL FROM CHROOT 1HOST_NAME='archlinux' 2MY_PUBKEY='<my_ssh_pubkey>' 3MY_USER='<my_user>' 4MY_USER_PASS='<my_password>' 5ROOT_PASS='<root_password>' 6arch-chroot /mnt /bin/bash <<EOF 7ln -sv /usr/share/zoneinfo/Europe/Paris /etc/localtime 8hwclock --systohc 9sed -i '/^#fr_FR.UTF-8\|^#en_US.UTF-8/{s/^#//}' /etc/locale.gen 10locale-gen 11echo 'LANG=en_US.UTF-8' > /etc/locale.conf 12echo 'KEYMAP=us' > /etc/vconsole.conf 13echo 'FONT=latarcyrheb-sun32' >> /etc/vconsole.conf 14echo ${HOST_NAME} > /etc/hostname 15cat <<HOSTS>> /etc/hosts 16127.0.0.1 localhost 17::1 localhost 18127.0.1.1 ${HOST_NAME}.localdomain ${HOST_NAME} 19HOSTS 20 21echo 'root:${ROOT_PASS}' | chpasswd 22useradd -m -g users -G wheel -s /bin/bash ${MY_USER} 23echo '${MY_USER}:${MY_USER_PASS}' | chpasswd 24sed -i.BKP '/HOOKS=/{s/=.*/=(base systemd autodetect modconf block keyboard sd-vconsole sd-encrypt filesystems)/}' /etc/mkinitcpio.conf 25grep HOOKS /etc/mkinitcpio.conf 26mkinitcpio -p linux 27bootctl --path=/boot install 28 29pacman-key --init 30pacman-key --populate archlinux 31 32pacman -Syu --noconfirm 33pacman -S base-devel gnu-netcat intel-ucode ncdu openssh --noconfirm 34 35timedatectl set-ntp true 36 37systemctl enable sshd systemd-networkd systemd-resolved systemd-timesyncd 38 39git clone https://aur.archlinux.org/yay.git /usr/src/yay 40chmod -R ${MY_USER}: /usr/src/yay 41su - ${MY_USER} -c 'cd /usr/src/yay/ && makepkg -si' 42 43cat <<BOOT_ARCH> /boot/loader/entries/arch.conf 44title Arch Linux 45linux /vmlinuz-linux 46initrd /intel-ucode.img 47initrd /initramfs-linux.img 48options rw root=/dev/${MY_DEVICE}2 rootflags=subvol=@root 49BOOT_ARCH 50 51cat <<BOOT_LOAD> /boot/loader/loader.conf 52default arch 53BOOT_LOAD 54 55networkctl list 56 57cat <<NETWORKD_LAN> /etc/systemd/network/lan.network 58[Match] 59Name=e* 60[Network] 61DHCP=ipv4 62NETWORKD_LAN 63 64cat <<RESOLVED> /etc/systemd/resolved.conf.d/dns_servers.conf 65[Resolve] 66DNS=9.9.9.9 67Domains=~. 68RESOLVED 69 70# USERS # 71 72cat <<USER_SUDO> /etc/sudoers.d/${MY_USER} 73${MY_USER} ALL=(ALL) NOPASSWD: ALL 74USER_SUDO 75 76mkdir /root/.ssh /home/${MY_USER}/.ssh 77 78cat <<ROOT_AUTH> /root/.ssh/authorized_keys 79${MY_PUBKEY} 80ROOT_AUTH 81 82cat <<USER_AUTH> /home/${MY_USER}/.ssh/authorized_keys 83${MY_PUBKEY} 84USER_AUTH 85 86chmod -Rc 0700 /root/.ssh /home/${MY_USER}/.ssh 87chown -Rc ${MY_USER}: /home/${MY_USER}/.ssh/ 88 89# VIRTUALIZATION # 90 91pacman -S dmidecode dnsmasq docker-compose ebtables libvirt qemu vagrant --noconfirm 92 93systemctl enable docker libvirtd 94 95usermod -aG docker,libvirt,kvm ${MY_USER} 96 97su - ${MY_USER} -c 'vagrant plugin install vagrant-libvirt' 98 99exit 100EOF 101reboot SOURCES Official ArchLinux Installation Main references for this article: Archlinux install on XPS 13 9360 ArchLinux step-by-step installation on btrfs See more… Minimal instructions for installing ArchLinux Archlinux install from Artizirk Efficient Encrypted UEFI-Booting Arch Installation

2021-01-29 · G2G

Dockerize persistent Firefox with Java 7 support

… for old Raritan PDU/KVM devices Web access Build your Docker image from Dockerfile create your Dockerfile Dockerfile 1FROM i386/debian:jessie 2RUN apt-get update && apt-get install -y firefox-esr icedtea-plugin icedtea-netx openjdk-7-jre openjdk-7-jre-headless tzdata-java 3RUN useradd -ms /bin/bash firefox 4ENV MOZ_FORCE_DISABLE_E10S=1 5USER firefox 6WORKDIR /home/firefox 7CMD tail -f /dev/null tail -f /dev/null force your Docker container to be persistent even if you’ve closed your Firefox session build it 1docker build -t firefox . # make it great again 2docker images --filter reference=firefox # check your docker image information Run your Docker container pop Firefox 1docker run -it --rm -e DISPLAY=${DISPLAY} -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/Downloads:/home/firefox/Downloads firefox firefox # run it with sharing Downloads directory add it to your .bashrc to simplify Firefox docker access .bashrc 1function ffjava7(){ 2 CONTAINER_NAME=firefox 3 xhost +; 4 docker container inspect ${CONTAINER_NAME} > /dev/null 2>&1 ; [ $? -eq 0 ] \ 5 && docker start firefox \ 6 || docker run -d --name ${CONTAINER_NAME} -e DISPLAY=${DISPLAY} -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/Downloads:/home/firefox/Downloads firefox firefox 7} Sources how to build your Docker container https://blog.yadutaf.fr/2017/09/10/running-a-graphical-app-in-a-docker-container-on-a-remote-server/ https://www.sicpers.info/2020/10/running-linux-gui-apps-under-macos-using-docker/ [Mac OSX] https://github.com/jlesage/docker-firefox https://github.com/findepi/docker.firefox-silverlight-pipelight [Silverlight support] fix Firefox tab persistently crashes on some sites https://support.mozilla.org/bm/questions/1266719

2020-10-15 · G2G

Remind Urgent Tasks

… with desktop notifications from Taskwarrior Script it send only tasks with high priority list as desktop notification task_notify_send.sh 1#!/usr/bin/env bash 2 3export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$EUID/bus" 4notify-send -u critical "$(for ID in $(task _ids priority:V -WAITING -PARENT); do echo [$ID]$(task $ID export | jq -r '.[].description') ; done)" Schedule it schedule task notification as systray message every 20 minutes in Crontab 1# crontab -l 2/20 * * * * ~/.local/bin/task_notify_send.sh Sources https://www.sudipbhandari.wtf/task-warrior-reminder/ https://eshapard.github.io/export-taskwarrior-dates-to-remind.html

2020-10-11 · G2G

Fix error symbol grub_calloc not found

… by restoring GRUB for crypted disks After system update and reboot, GRUB failed with this error symbol 'grub_calloc' not found. fix it with these commands 1fsck /dev/nvme0n1p* 2efibootmgr -c --disk /dev/nvme0n1 3efibootmgr -v /dev/nvme0n1 check in your BIOS if EFI boot is always configured (link to /boot/efi/EFI/arch/grubx64.efi) in bonus, if you want to mount your crypted system 1cryptsetup open /dev/nvme0n1p3 data 2pvs 3vgs 4vgchange -ay 5lsblk -fs 6mount /dev/mapper/arch-root /mnt/ 7mount /dev/mapper/arch-home /mnt/home/ 8mount /dev/nvme0n1p2 /mnt/boot/ 9mount /dev/nvme0n1p1 /mnt/boot/efi/ # for UEFI systems 10arch-chroot /mnt GRUB by Archlinux Wiki

2020-09-08 · G2G

Complete Them All Everywhere

…with Espanso text expander in Rust (works in Bash, Firefox,…) Getting Started 1yay -S espanso-bin # install espanso package for archlinux 2espanso status # get espanso service status 3espanso start # start espanso service / create ~/.config/systemd/user/espanso.service if does not exist 4espanso path # list espanso config files 5:date # get current date from trigger :date config files Support fix X11 display context error with starting Espanso service 1[[ -z $(grep DISPLAY $HOME/.config/systemd/user/espanso.service) ]] && \ 2 sed -i '/\[Service\]/aEnvironment="DISPLAY=:0"' $HOME/.config/systemd/user/espanso.service && \ 3 /usr/bin/systemctl --user daemon-reload && \ 4 espanso start # fix x11 display context error Sources Getting Started Official Packages Offical Documentation Pour gagner du temps quand vous tapez au clavier [in French] Use Espanso Text Expander To Save Time And Increase Productivity The Journey to My First 100 GitHub Stars

2020-08-19 · G2G

View markdown pages with Firefox

With Markdown Viewer Addon by Simeon Velichkov. Install https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-chrome/ https://github.com/simov/markdown-viewer View local markdown pages press button from toolbar press advanced options Allowed Origins > select *://* (you may need to use special configuration)[https://github.com/KeithLRobertson/markdown-viewer#support-for-local-files-on-linux] (from issue #131) View file with rst extension press button from toolbar press advanced options MATCH : \.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text|rst)(?:#.*|\?.*)?$ Table of Contents press button from toolbar press CONTENT tab activate TOC Reload automatically page press button from toolbar press CONTENT tab activate AUTORELOAD

2020-08-07 · G2G

Fix easily security alerts for Minimal Mistakes theme

with git command prerequisites 1git remote add upstream git@github.com:mmistakes/minimal-mistakes.git # in your github repository 2git fetch --all update files from mmistakes v.4.19.1 according to Github network alerts 1git checkout 4.19.1 -- minimal-mistakes-jekyll.gemspec package.json package-lock.json 2git commit -m "[update] from minimal mistakes 4.19.1 release"

2020-04-05 · G2G

Set songs tags and rename songs filename with id3v2

in oneliner and mass renaming mode get tags information with exiftool and copy tags /rename mp3 file with id3v2 1IFS=$'\n';for MP3_NAME in *mp3; do 2 ARTIST=$(exiftool -artist "$MP3_NAME" | awk -F': ' '{print $2}'); 3 SONG=$(exiftool -title "$MP3_NAME" | awk -F': ' '{print $2}'); 4 ALBUM=$(exiftool -album "$MP3_NAME" | awk -F': ' '{print $2}'); 5 id3v2 -a "$ARTIST" -t "$SONG" -A "$ALBUM" --genre 45 "$MP3_NAME" ; 6 mv -vi "$MP3_NAME" "${ARTIST} - ${SONG}.mp3" ; 7done; 8IFS=$' \t\n' tags based on mp3 filename if some mp3 files are no tags with exiftool 1# move mp3 files without tags in 3mpty directory 2IFS=$'\n';for SONG in *mp3; do 3 [ -z "$(exiftool -artist "$SONG")" ] && \ 4 mv -vi "$SONG" 3mpty/ ; 5done 6cd 3mpty 7 8# set tags on mp3 files from filename with this format "artist - title.mp3" 9IFS=$'\n'; for SONG_FILENAME in *mp3; do 10 ARTIST=$(echo "$SONG_FILENAME" | sed 's/ - .*$//'); 11 TITLE=$(echo "$SONG_FILENAME" | sed 's/^.*- \(.*\)\..*$/\1/'); 12 id3v2 -a "$ARTIST" -t "$TITLE" "$SONG_FILENAME"; 13done; 14IFS=$' \t\n' id3v2 commands that may help 1id3v2 -h 2id3v2 --list-frames # list id3v2 frames 3id3v2 --list-genres # list id3v1 genres 4id3v2 --delete-all # remove all tags from mp3 file

2020-04-05 · G2G

Manage subtitles with mpv media player

with hotkeys add custom hotkeys to increase / decrease subtitle size 1cat <EOF>> ~/.config/mpv/input.conf 2# increase subtitle font size 3ALT+k add sub-scale +0.1 4 5# decrease subtitle font size 6ALT+j add sub-scale -0.1 HOTKEYS v => show/hide subtitle ALT+k => increase subtitle size ALT+j => decrease subtitle size

2020-02-12 · G2G