Linux Virt-Manager上のOpenBSD 7.6でserialを有効に

OpenBSD 7.6 amd64をLinuxのVirt-Manager上で動かしています．serialを有効にしてhostからvirsh consoleで繋げるようにしてみました．

初期状態ではディスク暗号化のアンロックやbootプロンプトは見えます．bootプロンプトでserialを有効にすることもできますが毎回やらないといけないので面倒です．

こちらのFAQを参考に設定しました．

OpenBSD FAQ: Keyboard and Display Controls

ブートプロセスをserialへ(amd64/i386)

/etc/boot.conf に以下を追記

set tty com0

ログインプロンプト以降のserial対応

/etc/ttys を編集して， tty00 からの行を書き換えます．

書き換え前

tty00 "/usr/libexec/getty std.9600" unknown off

書き換え後

tty00 "/usr/libexec/getty std.9600" vt220 on secure

Note

9600部分はserial速度で，115200でも動作しました．

これで次回以降serialが有効になり，virsh consoleで接続して利用できます．

$ virsh console openbsd7.6
Connected to domain 'openbsd7.6'
Escape character is ^] (Ctrl + ])
probing: pc0 com0 mem[640K 239M 8M 548K 3M 176K]
disk: hd0 sr0*
>> OpenBSD/amd64 BOOTX64 3.67
Passphrase:
>> OpenBSD/amd64 BOOTX64 3.67
boot>
booting sr0a:/bsd: 19916757+4318224+413632+0+1236992 [1541351+128+1395768+1092498]=0x1c89138
entry point at 0x1001000
[ using 4030776 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2024 OpenBSD. All rights reserved. https://www.OpenBSD.org

OpenBSD 7.6 (GENERIC) #332: Mon Sep 30 08:45:17 MDT 2024
deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
: (中略)
Sat Nov 2 06:52:42 JST 2024

OpenBSD/amd64 (fugu.my.domain) (tty00)

login: matoken
Password:
Last login: Sat Nov 2 06:28:00 on tty00
OpenBSD 7.6 (GENERIC) #332: Mon Sep 30 08:45:17 MDT 2024

Welcome to OpenBSD: The proactively secure Unix-like operating system.

Please use the sendbug(1) utility to report bugs in the system.
Before reporting a bug, please try to reproduce it with the latest
version of the code. With bug reports, please try to ensure that
enough information to reproduce the problem is enclosed, and if a
known fix for it exists, include that as well.

You have new mail.
fugu$ neofetch _ matoken@fugu.my.domain
(_) ----------------------
| . OS: OpenBSD 7.6 amd64
. |L /| . _ Host: QEMU Standard PC (i440
_ . |\ _| \--+._/| . (_) Uptime: 1 min
/ ||\| Y J ) / |/| ./ Packages: 44 (pkg_info)
J |)'( | ` F`.'/ _ Shell: ksh v5.2.14 99/07/13.
-<| F __ .-< (_) Terminal: /dev/tty00
| / .-'. `. /-. L___ CPU: Intel i7-10510U (1) @ 1
J \ < \ | | O\|.-' _ Memory: 60MiB / 224MiB
_J \ .- \/ O | | \ |F (_)
'-F -<_. \ .-' `-' L__
__J _ _. >-' )._. |-'
`-|.' /_. \_| F
/.- . _.<
/' /.' .' `\
/L /' |/ _.-'-\
/'J ___.---'\|
|\ .--' V | `. `
|/`. `-. `._)
/ .-.\
\ ( `\
`.\

fugu$

ホスト環境

$ dpkg-query -W virt-manager libvirt-clients libvirt-daemon qemu-user qemu-system-x86
libvirt-clients 10.8.0-1
libvirt-daemon 10.8.0-1
qemu-system-x86 1:9.1.1+ds-2
qemu-user 1:9.1.1+ds-2
virt-manager 1:4.1.0-4
$ /sbin/modinfo kvm_intel | head -1
filename: /lib/modules/6.11.5-amd64/kernel/arch/x86/kvm/kvm-intel.ko.xz