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

    PfSense VM on ProxMox : Qemu-agent installation

    Scheduled Pinned Locked Moved Virtualization
    42 Posts 24 Posters 77.0k Views
    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
      tkriviradev
      last edited by tkriviradev

      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 Reply Quote 3
      • T
        tacioandrade @tkriviradev
        last edited by

        @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
        • gofaizenG gofaizen referenced this topic on
        • gofaizenG gofaizen referenced this topic on
        • gofaizenG gofaizen referenced this topic on
        • gofaizenG gofaizen referenced this topic on
        • weehooeyW
          weehooey
          last edited by weehooey

          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

            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 Reply Quote 1
            • weehooeyW
              weehooey @stevenderycke244
              last edited by

              @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
              • J
                janebond
                last edited by

                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

                  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 Reply Quote 0
                  • weehooeyW
                    weehooey @colinstu
                    last edited by

                    @colinstu We are not sure which instructions you are referring to. The website you linked to, the posts here or our GitHub repo.

                    However, we took the opportunity to look closer at our code. We did not find any issues, but we did improve the script it:

                    • We are now starting the agent from the script. No need to do that manually.
                    • We suppressed the confusing output.
                    • Updated the documentation to reflect the changes (e.g. do not need to power off/on if the guest agent was already enabled in Proxmox).

                    Our GitHub repo:

                    https://github.com/Weehooey/pfSense-scripts

                    C 1 Reply Last reply Reply Quote 0
                    • C
                      colinstu @weehooey
                      last edited by

                      @weehooey was referring to OP's post: https://forum.netgate.com/post/972378

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        tlex @colinstu
                        last edited by

                        Guys, these steps are so old... this post should be closed and disabled !

                        weehooeyW C 2 Replies Last reply Reply Quote 0
                        • weehooeyW
                          weehooey @tlex
                          last edited by

                          @tlex what steps do you use?

                          T 1 Reply Last reply Reply Quote 0
                          • C
                            colinstu @tlex
                            last edited by

                            @tlex what should be used? it's not in the pfsense docs (or hell, even proxmox or qemu docs either)

                            1 Reply Last reply Reply Quote 0
                            • T
                              tlex @weehooey
                              last edited by

                              @weehooey the one from my original post ;)
                              If you made anything new or better, create a new post and let this one die chief ;)

                              1 Reply Last reply Reply Quote 0
                              • C
                                Carsonix
                                last edited by

                                Proxmox 7.3-3 and pfSense 2.6.0

                                /etc/rc.conf.local doesn't exit. I created it and added

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

                                but qemu-guest-agent doesn't startup on boot.

                                Is there another way of doing this.

                                P 1 Reply Last reply Reply Quote 0
                                • P
                                  Patch @Carsonix
                                  last edited by

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

                                  Is there another way of doing this.

                                  2. Manual installation
                                      (a) Create the following 2 files
                                          i. Navigate to pfsense → Diagnostic → Edit file. 
                                              A. Enter text file path & browse → confirm doesn’t exist. 
                                              B. Enter text file content & full name including path then click Save to create file. 
                                              C. Leave only path & click Browse to confirm file created as expected. 
                                          ii. File name: /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"
                                          iii. File name: /usr/local/etc/rc.d/qemu-agent.sh
                                             #!/bin/sh
                                             sleep 3
                                             service qemu-guest-agent start
                                      (b) Login to console as root (VM console in Proxmox)
                                          i. pkg install -y qemu-guest-agent
                                          ii. cd /usr/local/etc/rc.d/
                                          iii. chmod +x qemu-agent.sh
                                      (c) Change Proxmox settins
                                          i. Shutdown pfsense
                                          ii. Proxmox VM → Options → QEMU Guest Agent → Enable
                                          iii. Restart VM
                                  
                                  S 1 Reply Last reply Reply Quote 1
                                  • NollipfSenseN NollipfSense referenced this topic on
                                  • S
                                    shadeless @Patch
                                    last edited by shadeless

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

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

                                    Is there another way of doing this.

                                    2. Manual installation
                                        (a) Create the following 2 files
                                            i. Navigate to pfsense → Diagnostic → Edit file. 
                                                A. Enter text file path & browse → confirm doesn’t exist. 
                                                B. Enter text file content & full name including path then click Save to create file. 
                                                C. Leave only path & click Browse to confirm file created as expected. 
                                            ii. File name: /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"
                                            iii. File name: /usr/local/etc/rc.d/qemu-agent.sh
                                               #!/bin/sh
                                               sleep 3
                                               service qemu-guest-agent start
                                        (b) Login to console as root (VM console in Proxmox)
                                            i. pkg install -y qemu-guest-agent
                                            ii. cd /usr/local/etc/rc.d/
                                            iii. chmod +x qemu-agent.sh
                                        (c) Change Proxmox settins
                                            i. Shutdown pfsense
                                            ii. Proxmox VM → Options → QEMU Guest Agent → Enable
                                            iii. Restart VM
                                    

                                    does this work on 2.7.0?
                                    Just tried it and when trying to start the service, i get the message that i have to set qemu_guest_agent_enable to YES in rc.conf.
                                    Seems like rc.conf.local isnt read properly?

                                    weehooeyW P 2 Replies Last reply Reply Quote 0
                                    • weehooeyW
                                      weehooey @shadeless
                                      last edited by

                                      @shadeless We have confirmed that this script works on 2.7.0 and have updated the notes to reflect this.

                                      https://github.com/Weehooey/pfSense-scripts

                                      S Bob.DigB T 3 Replies Last reply Reply Quote 1
                                      • S
                                        shadeless @weehooey
                                        last edited by

                                        @weehooey thanks for checking - found the error on my side, there was a whitespace at the end of the rc.conf.local filename.... 🤦

                                        1 Reply Last reply Reply Quote 0
                                        • Bob.DigB
                                          Bob.Dig LAYER 8 @weehooey
                                          last edited by

                                          @weehooey I have a VPS with runs on KVM. Will I profit from using this even if it is not Proxmox? Any hint what it actually is, it doesn't say, other than being KVM.

                                          weehooeyW 1 Reply Last reply Reply Quote 0
                                          • weehooeyW
                                            weehooey @Bob.Dig
                                            last edited by

                                            Hey @Bob-Dig I think it should. Of course, you will want to test to confirm.

                                            Proxmox is KVM/QEMU under the hood. We have used this successfully with OpenStack (in OVHcloud), which is also KVM.

                                            Although, if you have a VPS that is hosted by a third party, there may be things which prevent it from working correctly.

                                            The QEMU guest agent gives insight into the VM and provides some communication. In Proxmox, with the guest agent, you get an accurate reading of the RAM the VM is actually using and the VM responds to the power off/reboot commands.

                                            I would not want to run a VM without a guest agent for the platform it is running on.

                                            Bob.DigB 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.