Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add QEMU Guest Agent #6152

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

add QEMU Guest Agent #6152

wants to merge 6 commits into from

Conversation

hgy59
Copy link
Contributor

@hgy59 hgy59 commented Jun 19, 2024

Description

  • initial version of qemu-ga, builds for arch-x64-7.1 only

Fixes #6019

Checklist

  • Build rule all-supported completed successfully
  • New installation of package completed successfully
  • Package upgrade completed successfully (Manually install the package again)
  • Package functionality was tested
  • Any needed documentation is updated/created

Type of change

  • New Package

- initial version, builds for arch-x64-7.1 only
@hgy59
Copy link
Contributor Author

hgy59 commented Jun 19, 2024

@sgelineau17 can you please try, whether this works with proxmox?

@tofuHero
Copy link

this qemu-ga build is not work on my DSM vm.

this is DSM vm setting:
图片

and this vm status:
图片

qemu-ga is installed on this vm:
图片

qemu-ga command output:

root@a300-DS920plus:~# qemu-ga 
1720684752.201439: critical: failed to write persistent state to /var/packages/qemu-ga/var/run/qga.state: Failed to create file “/var/packages/qemu-ga/var/run/qga.state.TI8LQ2”: No such file or directory
1720684752.201478: critical: unable to create state file at path /var/packages/qemu-ga/var/run/qga.state
1720684752.201488: critical: failed to load persistent state
1720684752.201495: critical: error initializing guest agent

@hgy59
Copy link
Contributor Author

hgy59 commented Jul 11, 2024

@tofuHero did you try to add the missing folder /var/packages/qemu/var/run ?

after creating the run folder, I get a different error (not running under qemu/proxmox):

$ sudo qemu-ga
1720716108.104297: critical: error opening channel '/dev/virtio-ports/org.qemu.guest_agent.0': No such file or directory
1720716108.104594: critical: failed to create guest agent channel
1720716108.104675: critical: failed to initialize guest agent channel

@r0bb10
Copy link

r0bb10 commented Jul 11, 2024

@tofuHero did you try to add the missing folder /var/packages/qemu/var/run ?

after creating the run folder, I get a different error (not running under qemu/proxmox):

$ sudo qemu-ga
1720716108.104297: critical: error opening channel '/dev/virtio-ports/org.qemu.guest_agent.0': No such file or directory
1720716108.104594: critical: failed to create guest agent channel
1720716108.104675: critical: failed to initialize guest agent channel

i've done that and also got this error.

@hgy59
Copy link
Contributor Author

hgy59 commented Jul 11, 2024

@r0bb10 I did some analysis on the qemu-ga package of https://spk7.imnks.com/

  1. qemu-ga runs as a service
  2. the service must run as root, so you have to patch the privilege file after installation and each update (to replace package by root) and then restart the package
  3. the package installs the var/run folder
  4. the package includes two kernel modules for console (hvc_console.ko and virtio_console.ko)
  5. before service start:
    • the package loads the console modules on demand with insmod
    • the package creates the virtio-ports device on demand (and binds /dev/vport1p1 to /dev/virtio-ports/org.qemu.guest_agent.0)
    • the package creates the folder /var/local/run on demand

We could clone the functions of the implementation by imnks.com/jim.plus, but I doubt that it will be more stable.

- must run as root, so manual action is required for installation an upgrade
- ensure /dev/virtio-ports/org.qemu.guest_agent.0 exists before service starts
@hgy59
Copy link
Contributor Author

hgy59 commented Jul 13, 2024

@tofuHero, @r0bb10 I did some progress.
On my virtual DSM qemu-ga is running now as service (with manual patch of privilege file and manual service start).

I guess when not running virtual dsm, the kernel module virtio_console.ko is not running and we must include it in the package.

Can you please check with:
lsmod | grep -i virtio_console

on my virtual dsm it shows:

# lsmod | grep -i virtio_console
virtio_console         19522  1
virtio_ring             5789  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi
virtio                  5698  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi

@r0bb10
Copy link

r0bb10 commented Jul 13, 2024

@tofuHero, @r0bb10 I did some progress. On my virtual DSM qemu-ga is running now as service (with manual patch of privilege file and manual service start).

I guess when not running virtual dsm, the kernel module virtio_console.ko is not running and we must include it in the package.

Can you please check with: lsmod | grep -i virtio_console

on my virtual dsm it shows:

# lsmod | grep -i virtio_console
virtio_console         19522  1
virtio_ring             5789  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi
virtio                  5698  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi

mm installed the latest version Build #6811, done the run-as root, package starts and no error seem obvious

root@vdsm:/volume1/@appstore/qemu-ga/bin# /volume1/@appstore/qemu-ga/bin/qemu-ga -v
1720894497.519524: debug: Guest agent version 9.0.1 started
1720894497.519566: debug: disabling command: guest-get-devices
1720894497.519635: debug: received EOF
1720894497.620480: debug: received EOF
1720894497.721515: debug: received EOF
1720894497.822490: debug: received EOF
1720894497.923571: debug: received EOF
1720894498.024563: debug: received EOF
1720894498.125515: debug: received EOF
1720894498.226596: debug: received EOF
1720894498.327556: debug: received EOF
1720894498.428602: debug: received EOF
1720894498.529475: debug: received EOF
1720894498.630571: debug: received EOF
1720894498.731513: debug: received EOF
1720894498.832537: debug: received EOF
1720894498.933481: debug: received EOF
1720894499.034596: debug: received EOF

and

root@vdsm:/volume1/@appstore/qemu-ga/bin# lsmod | grep -i virtio_console
virtio_console         19522  1
virtio_ring             5789  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi
virtio                  5698  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi

log file

root@vdsm:/volume1/@appdata/qemu-ga# tail -f qemu-ga.log
Sat Jul 13 20:19:30 CEST 2024
Begin service_prestart
End service_prestart
Starting qemu-ga command /volume1/@appstore/qemu-ga/bin/qemu-ga --daemonize --logfile /volume1/@appdata/qemu-ga/qemu-ga.log --pidfile /volume1/@appdata/qemu-ga/qemu-ga.pid

@hgy59 hgy59 mentioned this pull request Jul 14, 2024
10 tasks
@mreid-tt mreid-tt mentioned this pull request Sep 29, 2024
1 task
@xutongtongxue
Copy link

Hi @hgy59 I'm a xpenology user and also waiting for this package from SynoCommunity, I can see there is pull request from you but it has not been merged yet. may I know when the package will be available in the repository? Thanks for you effort for this package.

@sgelineau17
Copy link

Hi @hgy59 I'm a xpenology user and also waiting for this package from SynoCommunity, I can see there is pull request from you but it has not been merged yet. may I know when the package will be available in the repository? Thanks for you effort for this package.

I'm in same the case, I waiting this package from SynoCommunity too.

@hgy59
Copy link
Contributor Author

hgy59 commented Dec 10, 2024

Hi @hgy59 I'm a xpenology user and also waiting for this package from SynoCommunity, I can see there is pull request from you but it has not been merged yet. may I know when the package will be available in the repository? Thanks for you effort for this package.

@xutongtongxue, @sgelineau17 can one confirm that this package works as expected?

@r0bb10
Copy link

r0bb10 commented Dec 10, 2024

Hi @hgy59 I'm a xpenology user and also waiting for this package from SynoCommunity, I can see there is pull request from you but it has not been merged yet. may I know when the package will be available in the repository? Thanks for you effort for this package.

@xutongtongxue, @sgelineau17 can one confirm that this package works as expected?

for me still not working.

@r0bb10
Copy link

r0bb10 commented Dec 10, 2024

with the latest push still shows same error:

root@virtualdsm:/volume1/@appstore/qemu-ga/bin# ./qemu-ga -v
1733853669.949037: debug: Guest agent version 9.0.1 started
1733853669.949079: debug: disabling command: guest-get-devices
1733853669.949158: debug: received EOF
1733853670.049638: debug: received EOF
1733853670.150609: debug: received EOF
1733853670.251617: debug: received EOF
1733853670.352593: debug: received EOF
1733853670.453567: debug: received EOF
1733853670.554584: debug: received EOF
1733853670.655641: debug: received EOF
1733853670.756608: debug: received EOF
1733853670.857595: debug: received EOF
1733853670.958583: debug: received EOF
1733853671.059501: debug: received EOF
1733853671.160601: debug: received EOF
1733853671.261656: debug: received EOF
1733853671.362617: debug: received EOF
1733853671.463610: debug: received EOF
1733853671.564622: debug: received EOF
1733853671.665661: debug: received EOF
1733853671.766663: debug: received EOF
root@virtualdsm:/volume1/@appstore/qemu-ga/bin# lsmod | grep -i virtio_console
virtio_console         19522  1
virtio_ring             5789  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi
virtio                  5698  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi

@xutongtongxue
Copy link

@hgy59 Hi, I just downloaded the latest x64-7.1 artifact from the Actions and tried to install to my synology VM, but the installation failed. My DSM version is 7.2.1-69057, I want to know if this package supports DSM 7.2.1-69057, so I can help test this package. Thanks.

@r0bb10
Copy link

r0bb10 commented Dec 11, 2024

@hgy59 still no go with 9.1.2

root@virtualdsm:/volume1/@appstore/qemu-ga/bin# ./qemu-ga -v
1733905920.599879: debug: Guest agent version 9.1.2 started
1733905920.599994: debug: received EOF
1733905920.700570: debug: received EOF
1733905920.801571: debug: received EOF
1733905920.902575: debug: received EOF
1733905921.003670: debug: received EOF
1733905921.104664: debug: received EOF
1733905921.205585: debug: received EOF
1733905921.306532: debug: received EOF
1733905921.407592: debug: received EOF
1733905921.508484: debug: received EOF
1733905921.609617: debug: received EOF
1733905921.710613: debug: received EOF
1733905921.811618: debug: received EOF
1733905921.912557: debug: received EOF
1733905922.013548: debug: received EOF

@sgelineau17
Copy link

sgelineau17 commented Dec 11, 2024

Hi @hgy59 I'm a xpenology user and also waiting for this package from SynoCommunity, I can see there is pull request from you but it has not been merged yet. may I know when the package will be available in the repository? Thanks for you effort for this package.

@xutongtongxue, @sgelineau17 can one confirm that this package works as expected?

for me still not working.

Hello,
I don't know how to install this package and my DSM are in the last release (DSM 7.2.2-72806 Update 2) and my Proxmox too.
Thanks

@mreid-tt
Copy link
Contributor

@r0bb10, I'm not familiar with this but would the scenario posted here be relevant to the issue you are experiencing?

@hgy59
Copy link
Contributor Author

hgy59 commented Dec 11, 2024

Hello,
I don't know how to install this package and my DSM are in the last release (DSM 7.2.2-72806 Update 2) and my Proxmox too.
Thanks

  1. download the artifacts file for x64-7.1 from github build action (current is here https://github.com/SynoCommunity/spksrc/actions/runs/12262090338/artifacts/2301545743) (don't worry DSM 7.1 package is for DSM 7.2 too)
  2. extract the spk file from the zip archive
  3. manually install the spk in DSM package center
  4. you have to ssh into DSM and patch the privileges file as documented in the install wizard page
  5. I guess you have to enable serial driver/console/port (?) as reported here Qemu Guest Agent for Synology VM on Proxmox #6019 (comment)

@r0bb10
Copy link

r0bb10 commented Dec 11, 2024

Hello,
I don't know how to install this package and my DSM are in the last release (DSM 7.2.2-72806 Update 2) and my Proxmox too.
Thanks

  1. download the artifacts file for x64-7.1 from github build action (current is here https://github.com/SynoCommunity/spksrc/actions/runs/12262090338/artifacts/2301545743) (don't worry DSM 7.1 package is for DSM 7.2 too)
  2. extract the spk file from the zip archive
  3. manually install the spk in DSM package center
  4. you have to ssh into DSM and patch the privileges file as documented in the install wizard page
  5. I guess you have to enable serial driver/console/port (?) as reported here Qemu Guest Agent for Synology VM on Proxmox #6019 (comment)

still no go adding serial0 (i already had serial2 enabled, adding 0 suggested in the link did do nothing :( )
dunno if it's related to run on virtualdsm but it's wierd, it should work.

any check i can do to help debugging?

@xutongtongxue
Copy link

Hello,
I don't know how to install this package and my DSM are in the last release (DSM 7.2.2-72806 Update 2) and my Proxmox too.
Thanks

  1. download the artifacts file for x64-7.1 from github build action (current is here https://github.com/SynoCommunity/spksrc/actions/runs/12262090338/artifacts/2301545743) (don't worry DSM 7.1 package is for DSM 7.2 too)
  2. extract the spk file from the zip archive
  3. manually install the spk in DSM package center
  4. you have to ssh into DSM and patch the privileges file as documented in the install wizard page
  5. I guess you have to enable serial driver/console/port (?) as reported here Qemu Guest Agent for Synology VM on Proxmox #6019 (comment)

still no go adding serial0 (i already had serial2 enabled, adding 0 suggested in the link did do nothing :( ) dunno if it's related to run on virtualdsm but it's wierd, it should work.

any check i can do to help debugging?

The latest package in the skp7 repository requires the serial console to be removed from PVE, have you tried removing the serial console to see if the package works? Thanks.

@xutongtongxue
Copy link

xutongtongxue commented Dec 12, 2024

@hgy59 @r0bb10 I tried installing the package(change the privilege and start a service), the PVE now can get the IP from the qemu-ga and the shutdown command from PVE also works fine. Thanks.

image
image

When try to click shutdown from PVE web console, the result of 'tail -f /volume1/@appdata/qemu-ga/qemu-ga.log' are as follows.

image

Stoping the qemu-ga service and run manmually.

image

Below is my env.
# PVE version: 8.2.9
# Synology loader: RR V22.24.1.1
# Synology version: DSM 7.2.1-69057
# Hardware setting:
image

@r0bb10
Copy link

r0bb10 commented Dec 12, 2024

@xutongtongxue we are using different enviroments, you are on xpenology i'm on virtualdsm.

@hgy59 i see on the latest screenshots posted that qemu-ga shows the docker container stopping via serial0, i can see this happen on serial2 on my side on virtualdsm, is it possible to set qemu-ga to listen to serial2?

@xutongtongxue
Copy link

@sgelineau17 @tofuHero please try this, I have installed the this package and it works fine for me. Below is my env. Thanks.

# PVE version: 8.2.9
# Synology loader: RR V22.24.1.1
# Synology version: DSM 7.2.1-69057

Hello,
I don't know how to install this package and my DSM are in the last release (DSM 7.2.2-72806 Update 2) and my Proxmox too.
Thanks

  1. download the artifacts file for x64-7.1 from github build action (current is here https://github.com/SynoCommunity/spksrc/actions/runs/12262090338/artifacts/2301545743) (don't worry DSM 7.1 package is for DSM 7.2 too)
  2. extract the spk file from the zip archive
  3. manually install the spk in DSM package center
  4. you have to ssh into DSM and patch the privileges file as documented in the install wizard page
  5. I guess you have to enable serial driver/console/port (?) as reported here Qemu Guest Agent for Synology VM on Proxmox #6019 (comment)

@xutongtongxue
Copy link

@xutongtongxue we are using different enviroments, you are on xpenology i'm on virtualdsm.

@hgy59 i see on the latest screenshots posted that qemu-ga shows the docker container stopping via serial0, i can see this happen on serial2 on my side on virtualdsm, is it possible to set qemu-ga to listen to serial2?

@r0bb10 Sorry I didn't know your issue or the backaground of issue. I just check the flows again and still did't get your issue. Can you explain your requirements and problems again. Perhaps, I can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Qemu Guest Agent for Synology VM on Proxmox
6 participants