virsh consoleで仮想マシンに接続できない

virt manager

virsh consoleコマンドでvmに繋がらなくなりました.

$ virsh console openbsd7.9
error: operation failed: Active console session exists for this domain

エラーメッセージから検索してdaemonを再起動したり,hostを再起動しても駄目です.

virshのmanを見るとこんなオプションが.

Option‐ally the --force flag may be specified, requesting to disconnect any existing sessions, such as in a case of a broken connection.
— `man 1 virsh`

--force オプションをを付けると繋がり,一度繋がると --force 無しでも繋がるようになりました.

$ virsh console openbsd7.9 --force
Connected to domain 'openbsd7.9'
Escape character is ^] (Ctrl + ])
^]
$ virsh console openbsd7.9
Connected to domain 'openbsd7.9'
Escape character is ^] (Ctrl + ])

fugu$ pfetch
      _____       matoken@fugu.matoken.org
    \-     -/     os     OpenBSD 7.9
 \_/         \    host   pc-i440fx-9.1
 |        O O |   uptime 1h 56m
 |_  <   )  3 )   pkgs   117
 / \         /    memory 169M / 989M
    /-_____-\

fugu$

恐らく電池切れでホストのOSが強制終了したときに既存のセッション情報が残ってしまい今回のような状態になったのだと思います.

環境
$ dpkg-query -W libvirt-clients libvirt-daemon
libvirt-clients 12.3.0-1
libvirt-daemon  12.3.0-1
$ uname -rm
7.0.9+deb14-amd64 x86_64
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)