Skip to content

Commit

Permalink
virtme-ng: fix sending kernel log to stderr in script mode
Browse files Browse the repository at this point in the history
With commit f3749da ("virtme-ng: redirect kernel log to stderr in
interactive mode") we have broken the kernel log redirection in script
mode: if the kernel panics now we don't see the log anymore on stderr.

Fix this by distinguishing the proper console inside the guest between
interactive mode vs script mode.

Test case:
 $ vng -vr -- "echo c > /proc/sysrq-trigger"

Fixes: f3749da ("virtme-ng: redirect kernel log to stderr in interactive mode")
Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
Andrea Righi committed Feb 13, 2024
1 parent ae47c86 commit eacf6bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions virtme/architectures.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def earlyconsole_args():

@staticmethod
def serial_console_args():
return ["virtme_console=ttyS0"]
return ["ttyS0"]

@staticmethod
def config_base():
Expand Down Expand Up @@ -225,7 +225,7 @@ def earlyconsole_args():

@staticmethod
def serial_console_args():
return ["virtme_console=ttyAMA0"]
return ["ttyAMA0"]

def kimg_path(self):
return "arch/arm/boot/zImage"
Expand Down Expand Up @@ -274,7 +274,7 @@ def earlyconsole_args():

@staticmethod
def serial_console_args():
return ["virtme_console=ttyAMA0"]
return ["ttyAMA0"]

def kimg_path(self):
return "arch/arm64/boot/Image"
Expand Down Expand Up @@ -334,7 +334,7 @@ def qemuargs(is_native, use_kvm):

@staticmethod
def serial_console_args():
return ["virtme_console=ttyS0"]
return ["ttyS0"]

def kimg_path(self):
return "arch/riscv/boot/Image"
Expand Down
4 changes: 2 additions & 2 deletions virtme/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ def do_it() -> int:
qemuargs.extend(["-serial", "chardev:console"])
qemuargs.extend(["-mon", "chardev=console"])

kernelargs.extend(arch.serial_console_args())
kernelargs.extend(["virtme_console=" + arg for arg in arch.serial_console_args()])

qemuargs.extend(arch.qemu_nodisplay_args())

Expand Down Expand Up @@ -1123,7 +1123,7 @@ def do_script(shellcmd: str, ret_path=None, show_boot_console=False) -> None:
qemuargs.extend(arch.qemu_serial_console_args())
qemuargs.extend(["-chardev", f"file,id=console,path={output}"])

kernelargs.extend(arch.serial_console_args())
kernelargs.extend(["console=" + arg for arg in arch.serial_console_args()])
kernelargs.extend(arch.earlyconsole_args())
kernelargs.extend(console_args)

Expand Down

0 comments on commit eacf6bb

Please sign in to comment.