• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

PfSense VM on ProxMox : Qemu-agent installation

Virtualization
24
42
72.3k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    tlex
    last edited by tlex Feb 19, 2022, 9:18 PM Mar 15, 2021, 6:39 PM

    Update procedure for PfSense 2.6.0
    (Shell) Install Qemu-agent package :

    pkg install qemu-guest-agent
    

    (web gui): Install "Shellcmd" from the package manager "System/PackageManager"

    (web gui): Create the following "earlyshellcmd" from "Service/Shellcmd":

    service qemu-guest-agent start
    

    (Shell) Edit /etc/rc.conf.local:

    qemu_guest_agent_enable="YES"
    qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
    

    System: Settings / Advanced: Tunables -> Add

    Tunable: virtio_console_load, Value: YES
    

    Reboot


    troubleshooting
    (Shell) Check if agent is running from pfsense shell :

    service qemu-guest-agent status
    

    Check qemu logs for errors:

    cat /var/log/qemu-ga.log
    

    *** Old procedure ***

    Based on : https://www.truenas.com/community/threads/qemu-guest-agent.91764/

    I was installing Qemu-Agent on my TrueNas vm and decided to give it a run on my PfSense vm. Works A1 for me ;)

    download package :
    https://www.truenas.com/community/resources/qemu-guest-agent.167/

    Enable ssh from PfSense Gui:
    (System -> Advanced -> Admin Access - > Enable Secure Shell)

    Upload using sftp to /root or whatever
    Decompress archive

    cp virtio_console.ko /boot/modules
    Run : kldload virtio_console.ko
    chmod +x qemu-ga
    cp qemu-ga /usr/local/bin
    chmod +x qemu-guest-agent
    cp qemu-guest-agent /usr/local/etc/rc.d/qemu-guest-agent.sh

    (remark qemu-guest-agent.sh needs .sh file extension to work)

    vi /etc/rc.conf.local

    qemu_guest_agent_enable="YES"
    qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
    virtio_console_load="YES"
    

    Install Schellcmd package and create the following commands

    COMMAND: service qemu-guest-agent       
    SHELLCMD TYPE: shellcmd
    
    COMMAND: cp /root/qemu-guest-agent /usr/local/etc/rc.d      SHELLCMD TYPE: earlyshellcmd
    

    Reboot PfSense

    G M T 3 Replies Last reply Mar 27, 2021, 11:10 AM Reply Quote 11
    • G
      Gektor @tlex
      last edited by Mar 27, 2021, 11:10 AM

      @tlex
      Thanks, it really works.
      But i think if (when) pfSense is update for newer versions, it will break that installation?

      K 1 Reply Last reply Mar 27, 2021, 11:27 AM Reply Quote 0
      • K
        kiokoman LAYER 8 @Gektor
        last edited by Mar 27, 2021, 11:27 AM

        @gektor
        most likely, yes

        ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
        Please do not use chat/PM to ask for help
        we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
        Don't forget to Upvote with the 👍 button for any post you find to be helpful.

        1 Reply Last reply Reply Quote 0
        • S
          sing
          last edited by sing Apr 13, 2021, 6:44 PM Apr 13, 2021, 6:43 PM

          quemu-gest-agent is now available on FreeBSD ports. Can it be attached to pfSense? It is already registered as a feature request.

          Bug 254105 - [new port] emulators/qemu-guest-agent: QEMU Guest Agent for FreeBSD

          Index of /head/emulators/qemu-guest-agent

          V 1 Reply Last reply Aug 5, 2021, 6:12 AM Reply Quote 0
          • V
            viktor_g Netgate @sing
            last edited by Aug 5, 2021, 6:12 AM

            @sing you can install qemu-agent via pkg install qemu-guest-agent on the latest pfSense snapshot

            new QEMU guest agent package feature request:
            https://redmine.pfsense.org/issues/12179

            H D 2 Replies Last reply Nov 19, 2021, 11:28 AM Reply Quote 0
            • M
              MrPete @tlex
              last edited by Aug 10, 2021, 10:14 PM

              @tlex looks like the second shellcmd is not needed (and if needed, is wrong?!) - cp qemu-guest-agent to etc/rc.d...

              1 Reply Last reply Reply Quote 0
              • H
                hyperstriker @viktor_g
                last edited by Nov 19, 2021, 11:28 AM

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • D
                  dersch @viktor_g
                  last edited by Jan 25, 2022, 2:03 PM

                  @viktor_g i can confirm this with 2.6.0

                  1 Reply Last reply Reply Quote 0
                  • B
                    ballistic
                    last edited by Jan 28, 2022, 2:57 PM

                    Does not work on 2.5.2\

                    Only thing I saw going wrong was;

                    [2.5.2-RELEASE][admin@pfsense-paul.server-works.com]/root: kldload virtio_console.ko
                    kldload: virtio_console.ko will be loaded from /boot/modules, not the current directory
                    kldload: an error occurred while loading module virtio_console.ko. Please check dmesg(8) for more details.

                    dmesg:
                    interface virtio_console.1 already present in the KLD 'kernel'!
                    linker_load_file: /boot/modules/virtio_console.ko - unsupported file type

                    B 1 Reply Last reply Jan 28, 2022, 4:28 PM Reply Quote 0
                    • B
                      ballistic @ballistic
                      last edited by Jan 28, 2022, 4:28 PM

                      Ok nevermind it does work. I just forgot to powerdown the VM. A reboot wasnt enough after enabling the Qemu agent in Proxmox.

                      1 Reply Last reply Reply Quote 0
                      • C
                        ctminime
                        last edited by Feb 19, 2022, 4:38 AM

                        With the release of pfSense 2.6.0, I was able to do a "pkg install qemu-guest-agent" and it installed no problem. After installing, it said to do a couple of things:
                        Modifiy your '/etc/rc.conf' file by adding these settings

                        qemu_guest_agent_enable="yes"
                        qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"

                        and run
                        service qemu-guest-agent start

                        This does indeed get Proxmox to see all the interface addresses (with QEMU Guest Agent enabled in the Proxmox VM settings). However, Qemu-ga does not start after a reboot.

                        So, I followed the instructions here:
                        https://docs.netgate.com/pfsense/en/latest/development/boot-commands.html

                        Installed ShellCMD, and then added "service qemu-guest-agent start" to it and the service starts on reboot now.

                        The only thing I don't care for is the debug logging being enabled when adding the lines to rc.conf. And for some odd reason, it logs with epoch time stamps. Uhg.

                        M 1 Reply Last reply Feb 22, 2022, 6:23 PM Reply Quote 1
                        • M
                          MrPete @ctminime
                          last edited by Feb 22, 2022, 6:23 PM

                          Best to add this to /etc/rc.conf.local -- that way it will not be overwritten ;)

                          @ctminime said in PfSense VM on ProxMox : Qemu-agent installation:

                          Modifiy your '/etc/rc.conf' file by adding these settings

                          qemu_guest_agent_enable="yes"
                          qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"

                          1 Reply Last reply Reply Quote 1
                          • T
                            tacioandrade @tlex
                            last edited by Feb 26, 2022, 10:14 PM

                            @tlex said in PfSense VM on ProxMox : Qemu-agent installation:

                            Update procedure for PfSense 2.6.0
                            (Shell) Install Qemu-agent package :

                            pkg install qemu-guest-agent
                            

                            (web gui): Install "Shellcmd" from the package manager "System/PackageManager"

                            (web gui): Create the following "earlyshellcmd" from "Service/Shellcmd":

                            service qemu-guest-agent start
                            

                            (Shell) Edit /etc/rc.conf.local:

                            qemu_guest_agent_enable="YES"
                            qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
                            

                            System: Settings / Advanced: Tunables -> Add

                            Tunable: virtio_console_load, Value: YES
                            

                            Reboot


                            troubleshooting
                            (Shell) Check if agent is running from pfsense shell :

                            service qemu-guest-agent status
                            

                            Check qemu logs for errors:

                            cat /var/log/qemu-ga.log
                            

                            *** Old procedure ***

                            Based on : https://www.truenas.com/community/threads/qemu-guest-agent.91764/

                            I was installing Qemu-Agent on my TrueNas vm and decided to give it a run on my PfSense vm. Works A1 for me ;)

                            download package :
                            https://www.truenas.com/community/resources/qemu-guest-agent.167/

                            Enable ssh from PfSense Gui:
                            (System -> Advanced -> Admin Access - > Enable Secure Shell)

                            Upload using sftp to /root or whatever
                            Decompress archive

                            cp virtio_console.ko /boot/modules
                            Run : kldload virtio_console.ko
                            chmod +x qemu-ga
                            cp qemu-ga /usr/local/bin
                            chmod +x qemu-guest-agent
                            cp qemu-guest-agent /usr/local/etc/rc.d/qemu-guest-agent.sh

                            (remark qemu-guest-agent.sh needs .sh file extension to work)

                            vi /etc/rc.conf.local

                            qemu_guest_agent_enable="YES"
                            qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
                            virtio_console_load="YES"
                            

                            Install Schellcmd package and create the following commands

                            COMMAND: service qemu-guest-agent       
                            SHELLCMD TYPE: shellcmd
                            
                            COMMAND: cp /root/qemu-guest-agent /usr/local/etc/rc.d      SHELLCMD TYPE: earlyshellcmd
                            

                            Reboot PfSense

                            Thank you very much! Your tip helped me a lot and encouraged me to try to automate this process!

                            I'm looking at ways to install the packages via script (I've already done this with zabbix), add System Tunables and then add the guest agent service to pfSense startup!

                            1 Reply Last reply Reply Quote 0
                            • T
                              tkriviradev
                              last edited by tkriviradev Feb 27, 2022, 1:16 PM Feb 27, 2022, 1:15 PM

                              This is totally awesome!!!

                              This is what I am doing.

                              pkg install -y qemu-guest-agent
                              
                              cat > /etc/rc.conf.local << EOF
                              qemu_guest_agent_enable="YES"
                              qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
                              #virtio_console_load="YES"
                              EOF
                              
                              cat /etc/rc.conf.local
                              
                              cat > /usr/local/etc/rc.d/qemu-agent.sh << EOF
                              #!/bin/sh
                              sleep 3
                              service qemu-guest-agent start
                              EOF
                              
                              cat /usr/local/etc/rc.d/qemu-agent.sh
                              
                              chmod +x /usr/local/etc/rc.d/qemu-agent.sh
                              
                              T 1 Reply Last reply Feb 27, 2022, 9:21 PM Reply Quote 3
                              • T
                                tacioandrade @tkriviradev
                                last edited by Feb 27, 2022, 9:21 PM

                                @tkriviradev said in PfSense VM on ProxMox : Qemu-agent installation:

                                This is totally awesome!!!

                                This is what I am doing.

                                pkg install -y qemu-guest-agent
                                
                                cat > /etc/rc.conf.local << EOF
                                qemu_guest_agent_enable="YES"
                                qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
                                #virtio_console_load="YES"
                                EOF
                                
                                cat /etc/rc.conf.local
                                
                                cat > /usr/local/etc/rc.d/qemu-agent.sh << EOF
                                #!/bin/sh
                                sleep 3
                                service qemu-guest-agent start
                                EOF
                                
                                cat /usr/local/etc/rc.d/qemu-agent.sh
                                
                                chmod +x /usr/local/etc/rc.d/qemu-agent.sh
                                

                                I'm using something very close to this, I was just looking for how to add System Tunables automatically, but there's no way. =(

                                I'm currently using this from here:

                                #!/bin/sh
                                
                                # Instala os pacotes do qemu
                                pkg install -y qemu-guest-agent
                                echo 'qemu_guest_agent_enable="yes"' >> /etc/rc.conf.local
                                echo 'qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"' >> /etc/rc.conf.local
                                
                                # Cria um script para iniciar no boot o serviço do qemu-guest-agent
                                echo 'service qemu-guest-agent start' > /usr/local/etc/rc.d/qemu-guest-agent.sh
                                chmod +x /usr/local/etc/rc.d/qemu-guest-agent.sh
                                
                                1 Reply Last reply Reply Quote 0
                                • gofaizenG gofaizen referenced this topic on Apr 22, 2022, 7:28 AM
                                • gofaizenG gofaizen referenced this topic on Apr 22, 2022, 7:28 AM
                                • gofaizenG gofaizen referenced this topic on Apr 28, 2022, 2:47 PM
                                • gofaizenG gofaizen referenced this topic on Apr 28, 2022, 2:47 PM
                                • gofaizenG gofaizen referenced this topic on Apr 28, 2022, 2:48 PM
                                • weehooeyW
                                  weehooey
                                  last edited by weehooey May 10, 2022, 1:09 PM May 10, 2022, 1:08 PM

                                  We have created an install script based on this post and instructions on use. Sharing it here to make setting up the QEMU guest agent a little easier :-)

                                  Thank you to everyone in this post who worked out the details for the installation.

                                  GitHub repo

                                  1 Reply Last reply Reply Quote 1
                                  • S
                                    stevenderycke244
                                    last edited by May 19, 2022, 1:32 PM

                                    regarding a proxmox install: after enabling qemu-guest-agent in the vm options, a simple reboot doesn't suffice! You really have to stop and start the vm to apply this change.

                                    weehooeyW 1 Reply Last reply May 19, 2022, 1:45 PM Reply Quote 1
                                    • weehooeyW
                                      weehooey @stevenderycke244
                                      last edited by May 19, 2022, 1:45 PM

                                      @stevenderycke244 That is correct. Powering it off is one of the steps we listed. There are a few things in Proxmox which require the VM to be powered off to apply a change.

                                      I have added a note to the instructions in the repo to hopefully be clearer.

                                      1 Reply Last reply Reply Quote 0
                                      • bearhntrB bearhntr referenced this topic on Sep 21, 2022, 5:24 PM
                                      • J
                                        janebond
                                        last edited by Dec 29, 2022, 8:01 PM

                                        Hi all!
                                        On my machine the service is installed as qemu_guest_agent not qemu-guest-agent.
                                        It's just a minor thing but nonetheless confusing.
                                        The rest works as described. 👍

                                        1 Reply Last reply Reply Quote 0
                                        • C
                                          colinstu
                                          last edited by Mar 23, 2023, 7:18 PM

                                          No idea what I am doing wrong but finally found a solution.
                                          https://codingpackets.com/blog/pfsense-qemu-guest-agent/
                                          The section about /usr/local/etc/rc.d/qemu-agent.sh being created had to be done.
                                          I'm kinda confused by your instructions as to how the service is supposed to autostart without this? I did the full shutdown of the guest and ran a command to ensure the virtio thing is started yet the qemu service never comes up by itself.
                                          I was confused by this other site's instructions (how does adding a file to that directory help) but later discovered that any executable .sh in there will be executed upon boot.

                                          weehooeyW 1 Reply Last reply Mar 23, 2023, 11:00 PM Reply Quote 0
                                          • First post
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.