Default Console Option has no effect ?

H4R0

Well-Known Member
Apr 5, 2020
616
143
48
From time to time i need to manage my vm's over the proxmox gui.

The problem for me is i want to always use xterm, my vm's dont have a virtual gpu.

Setting the default console viewer in datacenter -> options has no effect tho.

Proxmox still opens up novnc on the console tab for vm's, clicking on the button however opens a xterm pop up.

I want to manage my vm's inside the main tab and dont use a pop up..

1587117471034.png

1587117336851.png
 
  • Like
Reactions: Asiier
You can only use xterm.js if the VM has also a serial socket with a getty listening on it, as long as there's no "socketX" in the hardware of the VM the console selector knows that it cannot really work and so uses noVNC.
 
You can only use xterm.js if the VM has also a serial socket with a getty listening on it, as long as there's no "socketX" in the hardware of the VM the console selector knows that it cannot really work and so uses noVNC.

The vm has a serial port and is listening on it. The xterm pop up works without any problems.

So i dont get why it wont open xterm on the left console tab but does with the console button.
 
I'm getting the exact same behavior as H4R0

Everything is configured correctly and the default is xterm.js but when ever I click on "Console" it would open noVCN instead of xterm.js
Although, the "Console" button in the top right corner does properly launch xterm.js by default.
 
I'm getting the exact same behavior as H4R0

Everything is configured correctly and the default is xterm.js but when ever I click on "Console" it would open noVCN instead of xterm.js
Although, the "Console" button in the top right corner does properly launch xterm.js by default.

fyi i ended up using the proxmox shell and ssh into my vm's
 
  • Like
Reactions: Asiier
fyi i ended up using the proxmox shell and ssh into my vm's

Yeah, I do that when ever I need to type more than a couple commands
But using the browser is pretty useful when I just have to check something quickly...

Hope they manage to fix it since noVCN doesn't work that well... (Especially with different keyboard layouts) At least compared to xterm.js which is almost as using SSH in terms of usability.
 
  • Like
Reactions: H4R0
Yeah, I do that when ever I need to type more than a couple commands
But using the browser is pretty useful when I just have to check something quickly...

Hope they manage to fix it since noVCN doesn't work that well... (Especially with different keyboard layouts) At least compared to xterm.js which is almost as using SSH in terms of usability.

yeah i meant the web gui shell, for proxmox it opens up xterm instead of novnc, so you can use the main shell and just ssh into guests.

So instead of using the left console option for your guest, select your hypervisor and then the left console option.

i still would prefer if xterm would work for other vm's as well, but setting up proper serial support in the guest is also annoying.
 
FWIW, the external-window console gets already opened as xterm.js if one configured it that way. For the inline console we could check for a serial console in addition to that, as only it that case xterm.js can actually work, IIRC.
 
  • Like
Reactions: mietz
FWIW, the external-window console gets already opened as xterm.js if one configured it that way. For the inline console we could check for a serial console in addition to that, as only it that case xterm.js can actually work, IIRC.
That sounds great keep us posted!
 
I fixed this with a hacky tamper monkey script:

JavaScript:
// ==UserScript==
// @name         Proxmox swap embedded console
// @version      1.0
// @description  Swap noVNC to xterm.js in Proxmox embedded console
// @match        *://*/
// @include      /^https:\/\/.*:8006\/#v.*:=node%2F.*:.*:=consolejs:$/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function modifyConsoleSource(div) {
            const iframe = div.querySelector('iframe');
            if (iframe && iframe.src) {
                const urlParams = new URLSearchParams(iframe.src.split('?')[1]);
                const vmid = urlParams.get('vmid');
                const node = urlParams.get('node');

                if (vmid && node) {
                    const newSrc = `/?console=kvm&xtermjs=1&vmid=${vmid}&node=${node}&cmd=`;
                    const currentSrc = new URL(iframe.src, window.location.origin).toString();
                    const normalizedNewSrc = new URL(newSrc, window.location.origin).toString();

                    if (currentSrc !== normalizedNewSrc) {
                        iframe.src = newSrc;
                        console.log('Modified iframe src:', newSrc);
                    } else {
                        setTimeout(() => {}, 1000);
                    }
                } else {
                    console.err('Could not extract vmid or node from iframe src');
                }
            } else {
                setTimeout(() => {
                    console.warn('Iframe not found within div, sleeping 3 seconds');
                }, 3000);
            }
    }
    function checkIfPageHasConsole() {
        const pve_div = document.querySelector('div[id^="PVE-qemu-Config-"]');
        const lxc_div = document.querySelector('div[id^="pveLXCConfig-"]');
        const novnc_div = document.querySelector('div[id^="pveNoVncConsole-"]');
        if (novnc_div && pve_div &&! lxc_div) {
            modifyConsoleSource(novnc_div)
        }
    }
    const observer = new MutationObserver(checkIfPageHasConsole);
    observer.observe(document.body, { childList: true, subtree: true });
})();

You might be able to detect in javascript if the display is set to socket by searching /using the Ext Object. But this was good enough for me.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!