Vmm /



====== 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: ====

<code bash> ssh USERNAME@us5.ircnow.org </code> ==== What’s my vm: ====

<code bash> grep -B1 -A10 "owner USERNAME" /etc/vm.conf` `vmctl status | grep USERNAME` </code> ==== Disks for my vm: ====

<code bash> vmctl create -s 16G diskname.qcow2 file diskname.qcow2 ls -lh diskname.qcow2 </code> ==== Control my 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

==== What does my vm boot from? ====

  * 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: ==

<code bash> /install.amd/vmlinuz priority=low vga=788 initrd=/install.amd/initrd.gz --- </code> === Good: ===

<code bash> /install.amd/vmlinuz priority=low DEBIAN_FRONTEND=text initrd=/install.amd/initrd.gz --- console=ttyS0,115200 </code> === Guess: ===

  * 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

=== Reference: ===

  * 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

==== Sample answers when installing ====

=== 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! LOL

=== Pre network questions ===

How to stop from scrolling off screen? lol.
Defaults are fine.

=== Network questions ===

No autoconfigure.
Static IP address assigned to you hint: dig VMNAME.us5.ircnow.org
Netmask: (default)
Gateway: (NOT default)
DNS: (NOT default)
Timeout for link autodetect - efault of 3 is fine. It never times out anyway if you got it wrong and hangs. LOL
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: </var/log/auth.log grep "Invalid user" | wc -l
Protip: Someone tries to guess a password EVERY MINUTE LOL

=== 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” enables user and group quotas on /home no comma no quotes LOL
Protip: easier to make swap on a separate .qcow2

=== Final questions ===

Protip: “targeted” works
Enable backports with “1 2 3” no comma no quotes LOL
Select and install software takes a long time do NOT press enter to make it wake up or it will skip choices LOL
DOn’t install desktop stuff on the SERVER lol
Install GRUB to the MBR (make sure you get the right disk LOL 1st disk?)
You don’t need to “remove the installation media”

==== After reboot ====

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

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

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

<code bash> sed -i 's/deb cdrom/deb [trusted=yes] cdrom/' /etc/apt/sources.list </code> To get new kernel: (IMPORTANT!)

<code bash> apt list | egrep 'linux-image.*bpo..-amd64-unsigned'

  1. based on latest above

apt install linux-image-5.6.0-0.bpo.2-amd64-unsigned uname -r #still old reboot uname -r #new </code> Now you put your authorized_keys in and switch to ssh instead of console.

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

<code bash> find /var/cache/apt/archives -name '*.deb' | wc -l du -ah /var/cache/apt/archives | sort -h | tail </code> To find an empty .qcow2 disk to put swap on:

<code bash> 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 </code> To not need password to sudo

<code bash> /etc/sudoers #edit this file with this line USERNAME ALL=(ALL:ALL) NOPASSWD:ALL </code> ===== Packages =====

<code bash> apt get apt-file </code>