Virtualization is at the heart of many things today, especially in development. Proxmox is a Debian based OS which is exactly aimed at VMs and container, tried and tested over the years.
I own an older laptop with an OLED display which suffered some burnin. It has 32GB of RAM and 12 cores on the CPU, so it makes it the perfect candidate for a home server on which to experiment.
Read more:
Textbook install
The internet is full of tutorials on how to install Proxmox on a machine, so we will just use one of those to get started:
Some ideas:
- in case the install interface boots, but once you select the graphical interface nothing happens, restart the install process and before selecting the graphical interface install, press
e, addnomodeseton the line starting with/linux, then pressCtrl+x; - a wired connection is preferred over a wireless one, due to bridging defaults;
- having the wired connection set when installing with ease the process;
- remember to run the post install proxmox script;
- in case you are using a usb adapter for the ethernet, be aware that the usb adapter is the ethernet card itself, which means you will be bound to it and will have to update the configuration with new ones;
See more:
- https://www.proxmox.com/en/products/proxmox-virtual-environment/overview
- https://etcher.balena.io/
- https://community-scripts.org/scripts?q=post+install
zsh
I like pretty things, so antigen is something I install on most of my servers, together with zsh:
apt install zsh gitwget -O /usr/local/bin/install_antigen https://raw.githubusercontent.com/cristidraghici/debian-server-bash-scripts/master/install_antigen.shchmod +x /usr/local/bin/install_antigeninstall_antigen --root
ssh
To avoid adding the password every time we connect, we can add public ssh keys to your authorized_keys:
cat ~/.ssh/id_rsa.pub- copy the value and ssh into your server;
nano ~/.ssh/authorized_keys- paste the key and save.
This is the manual way of doing it via the command line.
Setup the graphics
With the laptop I own which has an Intel and an Nvidia graphic cards, it's important to setup the Hybrid mode for video in BIOS. What we aim is stop the screen once the OS starts and also be able to use the NVIDIA gpu in a VM for running A.I. locally.
Make sure that the laptop does not go into suspend when closing the lid:
nano /etc/systemd/logind.conf- alter the following:
HandleLidSwitch=ignoreHandleLidSwitchExternalPower=ignoreHandleLidSwitchDocked=ignoreLidSwitchIgnoreInhibited=no
systemctl restart systemd-logind
Remove nomodeset from the proxmox installer:
nano /etc/default/grub.d/installer.cfg- remove
nomodeset
Update grub:
nano /etc/default/grub- change
GRUB_TIMEOUTto0 - change
GRUB_CMDLINE_LINUX_DEFAULT="quiet"toGRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=0 console=tty3 intel_iommu=on iommu=pt consoleblank=10 vt.global_cursor_default=0" update-grubreboot
Custom resolution
The display I use uses a high resolution by default. That makes it hard to operate when in starts in commands line.
To fix this, we will add some customization:
nano /etc/default/console-setup- alter the font size to:
FONTSIZE="32x16"and save the file and exit; setupconreboot
If the above worked, but font is not bigger on restart, then it means we need to make it permanent. The choice to do this is via a service:
systemctl enable console-setupsystemctl restart console-setup
Only AC power
When running out of AC power, we want the server to gracefully shutdown and start once AC is back on. With this laptop, it's possible to have it boot up when AC power is available. And for shutting down, we can create a script and a acpid:
apt updateapt install acpidsystemctl enable acpidsystemctl start acpidtouch /etc/acpi/events/ac-losstouch /etc/acpi/ac-loss.shchmod +x /etc/acpi/ac-loss.sh
Create the AC event in /etc/acpi/events/ac-loss:
event=ac_adapter.*
action=/etc/acpi/ac-loss.shCode language: JavaScript (javascript)
Create the shutdown scripts in /etc/acpi/ac-loss.sh:
#!/bin/bash
AC_PATH="/sys/class/power_supply/AC/online"
DELAY=10
STATUS=$(cat $AC_PATH 2>/dev/null)
if [ "$STATUS" = "0" ]; then
echo "$(date): AC unplugged, starting $DELAY second shutdown timer..."
for ((i=0;i<DELAY;i++)); do
sleep 1
STATUS_NOW=$(cat $AC_PATH 2>/dev/null)
if [ "$STATUS_NOW" = "1" ]; then
echo "$(date): AC restored, cancelling shutdown."
exit 0
fi
done
STATUS_FINAL=$(cat $AC_PATH 2>/dev/null)
if [ "$STATUS_FINAL" = "0" ]; then
echo "$(date): AC lost for $DELAY seconds, shutting down!"
/sbin/shutdown -h now "AC power lost"
fi
fiCode language: PHP (php)
The last step is to restart the daemon:
systemctl restart acpid
Troubleshooting
USB adapter sleep
For this setup, we are using a USB adapter for the network connection. It seems that it falls asleep because of a Linux kernel feature called "USB Autosuspent". The immediate fix is just to disable this feature:
echo -1 > /sys/module/usbcore/parameters/autosuspend
To make it permanent, we can update grub:
nano /etc/default/grub- add:
GRUB_CMDLINE_LINUX_DEFAULT="... usbcore.autosuspend=-1and save and close; update-grubreboot

