Customizations to Proxmox VE 6.0 Persistent

This document worked for VE 7.X edition too.

Preparation

First, we’ll create a directory where we’ll store our customizations (you can call it whatever you want, as long as you are consistent across the commands):

$ sudo mkdir /usr/share/custom

Next, create the script which will apply the customizations and make it executable:

$ sudo echo '#!/usr/bin/env bash' > /usr/share/custom/apply.sh
$ sudo chmod a+x /usr/share/custom/apply.sh

Create the Hook

Finally, create a file telling apt to execute the script after being invoked:

$ sudo echo 'DPkg::Post-Invoke { "/usr/share/custom/apply.sh"; };' > /etc/apt/apt.conf.d/90custom

Now /usr/share/custom/apply.sh will be executed when apt installs or upgrades a package, reapplying the customizations. Be careful of what you put in there, though!

Read more

Share

Enable Serial Terminal on Debain using Grub Configuration (Grub2)

Edit /etc/default/grub, enter:

# vi /etc/default/grub

Append / modify as follows:

GRUB_CMDLINE_LINUX='console=tty0 console=ttyS0,19200n8'
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1"

Save and close the file. Next run the following command to generate a grub2 config file /boot/grub/grub.cfg :

# update-grub

Ref:
https://www.cyberciti.biz/faq/howto-setup-serial-console-on-debian-linux/

Share

Add serial console boot for Opensuse 15.5

While it works with UEFI boot using “legacy BIOS” the serial console works after grub has prompted the boot menu. But this might be too late e.g. in special cases like encrypted disk where grub needs to request the password.

KVM Guest has already been changed for serial support as outlined below in /etc/default/grub:

change to:

GRUB_TERMINAL="gfxterm serial"

add following line after theme definition:

GRUB_SERIAL_COMMAND="serial --unit=0 --speed=9600 --parity=no"
add console=ttyS0 to GRUB_CMDLINE_LINUX_DEFAULT

To apply changes run:

update-bootloader --refresh

Accessing console works:

virsh console --safe --force <guest_name>;
Share

Serial Terminal Configuration in RHEL Distribution

Serial Terminal Configuration in RHEL 7

Add, or update if already present, the following lines to /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

GRUB_CMDLINE_LINUX_DEFAULT applies this configuration only to the default menu entry, use GRUB_CMDLINE_LINUX to apply it to all the menu entries.
NOTE: each line type above should only appear once within the /etc/default/grub file. If the line already exists, then just modify it rather than add a second copy of same. That is, only one GRUB_CMDLINE_LINUX_DEFAULT line should exist in the file, etc.

Rebuild the /boot/grub2/grub.cfg file by running the grub2-mkconfig -o command as follows:

On BIOS-based machines: ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
On UEFI-based machines: ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Red Hat Enterprise Linux 8

Read more

Share

Preparing Cloud-Init Templates

The first step is to prepare your VM. Basically you can use any VM. Simply install the Cloud-Init packages inside the VM that you want to prepare. On Debian/Ubuntu based systems this is as simple as:

apt-get install cloud-init

This command is not intended to be executed on the Proxmox VE host, but only inside the VM.

Already many distributions provide ready-to-use Cloud-Init images (provided as .qcow2 files), so alternatively you can simply download and import such images. For the following example, we will use the cloud image provided by Ubuntu at https://cloud-images.ubuntu.com.

# download the image
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
# create a new VM with VirtIO SCSI controller
qm create 9000 --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
# import the downloaded disk to the local-lvm storage, attaching it as a SCSI drive
qm set 9000 --scsi0 local-lvm:0,import-from=/path/to/bionic-server-cloudimg-amd64.img

Ubuntu Cloud-Init images require the virtio-scsi-pci controller type for SCSI drives.

The next step is to configure a CD-ROM drive, which will be used to pass the Cloud-Init data to the VM.

Read more

Share

Install qemu-guest-agent on Opensuse 15.5

Add repository and install manually

For openSUSE Tumbleweed run the following as root:

zypper addrepo https://download.opensuse.org/repositories/Virtualization/openSUSE_Tumbleweed/Virtualization.repo
zypper refresh
zypper install qemu-guest-agent

For 15.6 run the following as root:

zypper addrepo https://download.opensuse.org/repositories/Virtualization/15.6/Virtualization.repo
zypper refresh
zypper install qemu-guest-agent

For 15.5 run the following as root:

zypper addrepo https://download.opensuse.org/repositories/Virtualization/15.5/Virtualization.repo
zypper refresh
zypper install qemu-guest-agent
Share

Install wkhtmltopdf on Debian 11

1. Install prerequisites: Install wget (if not already installed):

# sudo apt update
# sudo apt install wget

2. Install wkhtmltopdf on Debian 11

The links below contain the latest releases as of 10/25/2022. Please double check GitHub for the latest available release: https://github.com/wkhtmltopdf/packaging/releases/latest

# wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb
# sudo apt install ./wkhtmltox*bullseye_amd64.deb

Check that the version installed is what you were expecting:

# wkhtmltopdf --version
wkhtmltopdf 0.12.6.1 (with patched qt)
Share

Install nano on Windows

I’m a bit fascinated with nano editor and since I spend most of the time on linux terminal- it becomes my first choice over vi editor 🙂

Long story short, you can install it on windows in 2 methods-

Method-1: Windows Command Prompt

You can just easily install Nano via WinGet, which is Windows’ package manager if you’re on Windows 10 or later. Open command prompt as admin and type this in:

winget install GNU.Nano

Method-2: Windows Powershell

Install Chocolatey using Powershell:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Run choco install -y nano.
Run nano: nano.

Alternately, if you already have git installed, just run C:\Program Files\Git\usr\bin\nano.exe

Ref:
https://superuser.com/questions/1493801/how-to-install-the-nano-cli-editor-on-windows-10

Share

Zimbra delete e-mails from deferred queue

Problem

How to delete e-mails from deferred queue sent by a particular account?

Solution

1) This command will show the queue id of messages sent by “sender@domain.com”. Check it is deleting correct queue id.

Run as root:

# /opt/zimbra/common/sbin/postqueue -p | egrep -v '^ *\(|-Queue ID-' | awk 'BEGIN { RS = "" } { if ($7 == "sender@domain.com") print $1} '

2) Once it will confirm, delete email sent by “sender@domain.com”

Run as root:

# /opt/zimbra/common/sbin/postqueue -p |egrep -v '^ *\(|-Queue ID-' | awk 'BEGIN { RS = "" } { if ($7 == "sender@domain.com") print $1} '| tr -d '*!'| /opt/zimbra/common/sbin/postsuper -d -

Note: Replace “sender@domain.com” with actual sender e-mail address.

Read more

Share