cat 'Working Xterm.js on an Alpinelinux VM under Proxmox.md'

Posted on Jun 19, 2021
tl;dr: Yes - we can get xterm.js running in no time! We do, however, need to follow the whole guide.

Hey Victor,

Copy-pasting commands from another guide didn’t work. Can you please teach me how to get the Proxmox implementation of Xterm.js working on my Alpine Linux VM?

  Hold my NoVNC console, I’m going in!  

Getting started

Step 0. - Create or take a look at one of your existing Alpine Linux VM(s).
Note the VM ID (in my case it’s 999)

Step 1. - Enable a serial console at boot.
By default, Alpine runs sys extlinux as bootloader, we’ll need to enable a serial port there. For a freshly installed Alpine (3.10+) VM, these commands should do the trick.
If you’ve already made changes to your extlinux config, do the below alterations manually!!

sed -i 's/default_kernel_opts=\"/default_kernel_opts=\"console=ttyS0,115200 /' /etc/update-extlinux.conf
sed -i 's/serial_port=/serial_port=0/' /etc/update-extlinux.conf

Step 2. - Allow logins from the newly created serial console.
We also need to make sure /dev/ttyS0 is allowed to actually log in, otherwise we’ll just get our password refused:

sed -i 's/\#ttyS0\:\:/ttyS0\:\:/' /etc/inittab

Step 3. - Update the extlinux config to reflect your new changes.

update-extlinux

Step 4. - Add a serial device to your VM.
SSH in to your Proxmox host and issue the qm set <vmid> -serial0 socket command.

qm set 999 -serial0 socket

Since this is my guide and nothing ever goes wrong, you should see a:

update VM 999: -serial0 socket

(You could also use the WebUI: VM > Hardware > Add > Serial Port > 0) Great!

Step 5. - The finale (aka “rebooting your VM”)
Reboot the VM and you should see the magic of Xterm.js being enabled.
a

You know what the best part is?
b

That’s right, we can actually log in as well!

Enjoy your awesome js terminal with loads of nice features, such as copypasting, so you can follow more of my guides!