Vmm /

Debian

Tips for installing a Debian/Devuan VM on a BSD bare metal server running vmd

Version information

  * Debian 10.4.0
  * Devuan 3.0.0
  * OpenBSD 6.7
  * 18/6/2020

On BSD bare metal server running vmd:

Logging on:

ssh user@furit.ircnow.org

vm configuration

grep -B1 -A10 "owner USERNAME" /etc/vm.conf`
`vmctl status | grep USERNAME`

making virtual disk

vmctl create -s 16G diskname.qcow2
file diskname.qcow2
ls -lh diskname.qcow2

controling vm

Start: vmctl start VMNAME
Get in: vmctl console VMNAME
Start and get in: vmctl start -c VMNAME
Get out: <NEWLINE>~.
Get out without get out ssh: <NEWLINE>~~.
Graceful shutdown: vmctl stop VMNAME
Cut Power: vmctl stop -f VMNAME
Console messes up the screen: reset; clear

vm booting

  * Guess - MBR (no GPT) of diskname.qcow2
  * If invalid, cdrom
  * Can’t be controlled without root or something idk ’bout

===== Inside my vm =====

Boot parameters

Bad:

/install.amd/vmlinuz priority=low vga=788 initrd=/install.amd/initrd.gz 

Good:

/install.amd/vmlinuz priority=low DEBIAN_FRONTEND=text initrd=/install.amd/initrd.gz --- console=ttyS0,115200

Guesses:

  * system no like video
  * system no auto find console or console speed
  * parameter after — will be copied to system boot menu
  * curses frontend crashes console

=== References: ===

  * Debian Boot Parameters https://www.debian.org/releases/stable/amd64/ch05s03.en.html
  * Console Crashes For No Reason https://marc.info/?l=openbsd-tech&m=159028442625596&w=2

Installation

Initial Menu

Advanced options >> Expert install >> <html><TAB></html> edit boot parameters and boot

Protip: Type line at end, then Ctrl+B to edit middle - don’t overshoot!

Pre network questions

Defaults are fine.

Network questions

No autoconfigure. Static IP address assigned to you hint: dig VMNAME.us5.ircnow.org Netmask: 255.255.255.0 (default) Gateway: 38.81.163.129 (NOT default) DNS: 8.8.8.8 (NOT default) Timeout for link autodetect - efault of 3 is fine. It never times out anyway if you got it wrong and hangs. Protip: You can never enter the network setup menu (or type < to get out of it) to avoid this. Hostname: Don’t think it matters. Domain name: does it have to be us5.ircnow.org???

Pre disk questions

Protip: openssl rand -base64 12 makes a 16 char password Protip: Save password to a file on bare metal computer and copy paste it in Protip: Ctrl+c or Ctrl+shift+c = xsel -b ; Select with mouse = xsel ; Middle mouse button pastes xsel Protip: Can’t only have ssh key because you need to login from console when network is down! Protip: grep "Invalid user" /var/log/auth.log | wc -l

Disk questions

Protip: mbt is called “msdos” here
Reminder: GPT no work!!! i think
Protip: expr 1024 \* 1024 \* 1024 \* 4%% to get 4GiB instead of 4GB, use suffix b Protip: “10 11” Protip: easier to make swap on a separate .qcow2

Final questions

Protip: “targeted” works Enable backports with “1 2 3” Select and install software takes a long time do NOT press enter to make it wake up or it will skip choices Don’t install desktop stuff on the SERVER Install GRUB to the MBR You don’t need to “remove the installation media”

Post installation

Protip: Don’t hold keys down or you may lock the console

To keep all .dpkg (to make a local archive later):

printf '%s' 'Binary::apt::APT::Keep-Downloaded-Packages "1";' > /etc/apt/apt.conf.d/99keep-downloaded-packages

To trust cdrom:

sed -i 's/deb cdrom/deb [trusted=yes] cdrom/' /etc/apt/sources.list

To get new kernel: (IMPORTANT!)

apt list | egrep 'linux-image.*bpo..-amd64-unsigned'
#based on latest above
apt install linux-image-5.6.0-0.bpo.2-amd64-unsigned
uname -r #still old
reboot
uname -r #new

Now you put your authorized_keys in and switch to ssh instead of console.

To see kept .dpkg (to make a local archive later):

find /var/cache/apt/archives -name '*.deb' | wc -l
du -ah /var/cache/apt/archives | sort -h | tail

To find an empty .qcow2 disk to put swap on:

lsblk
mkswap /dev/DONT_GET_THIS_WRONG
lsblk -o name,UUID | grep DONT_GET_THIS_WRONG
uuid=$(lsblk -o name,UUID | grep vdc | awk '{print $2}')
echo \$uuid #should exist!
printf "%s\n" "UUID=$uuid none swap" >> /etc/fstab #applies on reboot
swapon /dev/DONT_GET_THIS_WRONG #applies now
swapon #verify have swap now

To not need password to sudo

/etc/sudoers #edit this file with this line
USERNAME ALL=(ALL:ALL) NOPASSWD:ALL

===== Packages =====

apt get apt-file