Create a Proxmox Ubuntu Cloud-Init Template

Step 1: Download the Ubuntu image 1 2 3 4 5 6 SRC_IMG="https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-disk-kvm.img" #VMSTORAGE="/vmstorage" VMSTORAGE="/var/lib/vz/images" IMG_NAME="jammy-server-cloudimg-amd64-disk-kvm.qcow2" IMG_PATH="$VMSTORAGE/$IMG_NAME" wget -O $IMG_PATH $SRC_IMG Step 2: Add necessary packages 1 2 sudo apt install -y libguestfs-tools sudo virt-customize -a $IMG_PATH --install cloud-initramfs-growroot,atop,htop,nano,vim,qemu-guest-agent,curl,wget,unattended-upgrades,git Step 3: Modify /etc/ssh/sshd_config 1 sudo virt-customize -a $IMG_PATH --run-command "sed -i 's/.*PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config" Step 4: Modify /etc/apt/apt.conf.d/50unattended-upgrades 1 2 export EDITOR=nano sudo -E virt-edit -a $IMG_PATH /etc/apt/apt.conf.d/50unattended-upgrades Step 5: Modify /etc/default/grub 1 2 3 export EDITOR=nano sudo -E virt-edit -a $IMG_PATH /etc/default/grub sudo virt-customize -a $IMG_PATH --run-command "update-grub" Step 6: Install ohmybash 1 2 sudo virt-customize -a $IMG_PATH --run-command "git clone https://github.com/ohmybash/oh-my-bash.git /opt/ohmybash" Step 7: Fix timezone 1 sudo virt-customize -a $IMG_PATH --timezone "Europe/Berlin" Step 8: Create the Proxmox template 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 TEMPL_NAME="ubuntu2204-cloud" VMID="9000" MEM="512" DISK_SIZE="10G" DISK_STOR="vmstorage" NET_BRIDGE="vmbr0" qm create $VMID --name $TEMPL_NAME --memory $MEM --net0 virtio,bridge=$NET_BRIDGE qm importdisk $VMID $IMG_NAME $DISK_STOR qm set $VMID --agent enabled=1 qm set $VMID --scsihw virtio-scsi-pci --scsi0 $DISK_STOR:vm-$VMID-disk-0 qm set $VMID --ide2 $DISK_STOR:cloudinit qm set $VMID --boot c --bootdisk scsi0 qm set $VMID --serial0 socket --vga serial0 qm set $VMID --ipconfig0 ip=dhcp qm set $VMID --ciuser=christian qm set $VMID --cipassword="bla" qm set $VMID --searchdomain=ka.beiheimdaheim.de qm resize $VMID scsi0 $DISK_SIZE qm template $VMID

June 21, 2022 · 2 min · 216 words · christian

RPM spec: Installing a custom init-script

Well, I’m sitting again here grinding my head on how to fix up a certain package. Now, I had to look it up again, so this time I’m writing it down! 1 2 3 Source1: ${name}.initd ... install -o root -g root -m 755 %{S:1} $RPM_BUILD_ROOT/etc/init.d/ndo2db

March 26, 2009 · 1 min · 46 words · christian

Windows: Running msconfig as non privileged user

Well, the title is kinda misleading since you need administrator privileges to run msconfig in it’s full scope. But this is just a hint to myself on how to execute msconfig without logging out and then logging in as administrator. 1 runas /user:Administrator C:WINDOWSpchealthhelpctrbinariesmsconfig.exe

March 25, 2009 · 1 min · 44 words · christian

TSM client: Backing up files with umlauts on SLES

In the past, I always had problems with SLES and our Tivoli Storage Manager client’s when backing up files with german umlauts. Well, today I looked a bit harder, and quite quickly found a solution. 1 2 sles9 root [0] > env | grep ^LC LC_CTYPE=de_DE.UTF-8 As you can see from the above, SLES9/10 ain’t setting LANG or LC_ALL (which I searched for first), but is setting LC_CTYPE. So, simply changing the LC_CTYPE in the init-script and/or prepending the dsmc command line with a new LC_CTYPE fixes my umlauts problems! ...

March 2, 2009 · 2 min · 387 words · christian

Nagios: NSclient++ in a clustered Environment

Well, most of you already know that I’m a Nagios fanatic. I like to watch as many aspects as I possibly can. So, yesterday I started figuring out ways to watch our different cluster groups (housing a bunch – try above 20.000 – of file shares). Now, my first tries failed horribly. I brought down a complete cluster group, resulting in a major annoyance. Now, today I went at it a bit smarter 😛 I cloned myself two VM’s off my Windows Server 2003 Enterprise R2 template, created a new cluster. ...

February 26, 2009 · 2 min · 258 words · christian

Linux: Getting information about an EXT3 filesystem

You know, I’m not getting any younger. It’s getting harder remembering every damn command … so here is how you get information out of your EXT3 filesystem: 1 2 3 4 5 6 7 8 9 10 sles10sp2 ~ [0] > tune2fs -l /dev/sda2 | grep "^Filesystem" Filesystem volume name: <none> Filesystem UUID: 8eec8235-4d9e-4b58-acf9-3c68c977d5ea Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal resize_inode filetype needs_recovery sparse_super large_file Filesystem state: clean Filesystem OS type: Linux Filesystem created: Tue May 27 10:48:56 2008

February 13, 2009 · 1 min · 85 words · christian

Restarting the NSclient++ service without the management applet

For people, who are as click and point-lazy as me, here is how you restart the service without using the service management applet. 1 2 net stop "NSClientpp (Nagios) 0.3.5.2 2008-09-24 w32" net start "NSClientpp (Nagios) 0.3.5.2 2008-09-24 w32"

February 11, 2009 · 1 min · 39 words · christian

MySQL: Setting up an InnoDB raw device

Well, since I had to brood about this (again I might add), I’m gonna write it down this time … Setting up the InnoDB raw device isn’t that hard, just make sure the device has proper permissions (either add mysql to the disk group or create a udev rule). 1 KERNEL="sdb2", OWNER="mysql", GROUP="mysql" Now after that (and a reboot/udevcontrol reload_rules later), you should be able to initialize the InnoDB device. Yes, the InnoDB device needs initializing. ...

February 11, 2009 · 2 min · 380 words · christian

Monitoring the IBM BladeCenter chassis with Nagios

Today I ended up working out the details on what we want to monitor regarding our BladeCenter. The most interesting details (for us that is) are these: Fan speeds for Chassis Cooling/Power Module Cooling Bay(s) Temperature Power Domain utilization It wasn’t * that* hard to implement. Only trouble(s) I ran into, were ( 1) IBM did a real shitty job with the MIB’s. If you look closely into the mmblade.mib, you’re gonna notice, that not a single OID is specified for the events. ( 2) As the MIB’s weren’t documented anywhere, I had to look them up via snmpwalk (which I had never used before). So as a reminder (to myself), here’s how it is done: 1 snmpwalk -v1 -c public -O n 10.0.0.35 .1.3.6.1.4.1.2.3.51.2.2 This will get you a list, with a lot of output (5154 lines to be exact). Lucky me, the web interface of the management module/ssh interface is rather verbose, so all you need to do is compare those values with what you are looking for. So for myself (and anyone interested) read ahead for the list of checks we are currently running on the management module.

February 10, 2009 · 4 min · 772 words · christian

Installing SLES10 via network with no DHCP available

In our current fight against the BladeCenter switches, we’re currently facing the problem that the blades ain’t able to send/receive DHCP-traffic. So in order to move forward, we had to use static IP addresses. And since SLES10 ain’t straight forward on that, I had to look it up. Now, here’s for me (and everyone else tired of searching) how to do it: 1 2 3 4 5 6 7 8 9 install=http://ftp.barfoo.org/install/SLES10-x64/CD1 netdevice=eth0 hostip=10.0.1.240 netmask=255.255.255.0 gateway=10.0.1.1 nameserver=10.0.1.2 domain=home.barfoo.org insmod=bnx2 splash=verbose

January 30, 2009 · 1 min · 80 words · christian