How to get the console log of a vm in a booting loop?

SebTardif

New Member
Feb 18, 2023
4
1
1
I'm very new to Proxmox. However, I did try a lot of things to self-serve answer my question above.

So my situation is that I start a VM, and it start decompressing the kernel, run some command, and quit... and start over in a loop.

That show extremely fast on my screen so I'm not able to see the error because it disappear so fast. Then I guessed if I do 'qm start xyz', then I will see the log there, but not really, it just come back to the terminal prompt. Then I guessed, I have at the bottom of the proxmox ui, in the task list a line about that console, so I will 'right click' with my mouse to see the option to see the log history...but no, there is no context menu, and it's really option free...

Then I guessed maybe this is under 'qm monitor xyz'. I'm able to list the command, but I coudn't guess which on could help.
 
@bbgeek17 Any idea why almost same command fail?

qm start 100 && sleep 1 && qm terminal 100 > output.txt
2023/03/06 10:17:08 socat[7604] E tcgetattr(1, 0x55bf475bd3e0): Inappropriate ioctl for device
 
Its because you are trying to redirect an output of an interactive command to a file. Its similar if you tried to execute "vi > text.log"
If you want to log things you have few options:
a) run "script [optional log file name]" , then execute your commands. All output from the terminal will be logged into the file.
b) run "screen -Logfile [file]" - screen is a bit more complex, so you will need to get familiar with shortcuts to operate in it
c) In our test infrastructure we use the following config combination to preserve console output for debugging:
qm set $VMID -args "-chardev file,id=char0,mux=on,path=/tmp/serial.$VMID.log,signal=off -serial chardev:char0"
qm set $VMID --serial1 socket --vga serial1


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: m8e and SebTardif
@bbgeek17 Thanks for all the ideas.

One interesting finding, is that the following also works:
Bash:
ssh -tt localhost "qm start 100 && timeout 30 qm terminal 100" > output.txt
 
  • Like
Reactions: m8e
Hi, I've just stumbled across this thread and am very interested in the multiplexing of serial ports and their output.

Let me know if it's bad form to post here instead of opening a new thread.

I have tried using the -args and -serial1 and -vga settings above. It is not working for me but I feel I'm close.

I'm trying to capture boot messages to a file and also present a login prompt when a user runs the qm terminal.

qm terminal looks like it will use the socket in /var/run/qemu-server/$VMID.serial1 but then what is this actually connected to in the guest? COM0? COM1?

I've tried adding this to my qm create:
--args "-chardev file,id=char0,mux=on,path=/tmp/serial.650000.log,signal=off -serial chardev:char0" \
--sockets 1 \
--vga serial1

And it looks like it passes this through to the qemu command:
-chardev socket,id=serial1,path=/var/run/qemu-server/650000.serial1,server=on,wait=off \
-device isa-serial,chardev=serial1 \
-chardev file,id=char0,mux=on,path=/tmp/serial.650000.log,signal=off \
-serial chardev:char0

I tried this too:
--args "-chardev file,id=char0,mux=on,path=/tmp/serial.650000.log,signal=off -device isa-serial,chardev=char0" \
--sockets 1 \
--vga serial1

And that gives:
-chardev socket,id=serial1,path=/var/run/qemu-server/650000.serial1,server=on,wait=off \
-device isa-serial,chardev=serial1 \
-chardev file,id=char0,mux=on,path=/tmp/serial.650000.log,signal=off \
-device isa-serial,chardev=char0

All the difference seems to do is reorder the COM ports in the guest and sends either the output to the log file OR to the qm terminal socket but not both.

What gives? Do I need to tell my guest to send io to all COM ports? Am I misunderstanding something because it doesn't look like multiplexing of a single guest COM port is happening here at all...
 
Last edited: