Alpine: How to Install ovirt-guest-agent on Alpine Linux

To the best of my knowledge, Alpine Linux does not have an official package for ovirt-guest-agent yet (as February 17th, 2019). It is possible to build them from source however. It will require that you go somewhat against the Alpine philosophy of having the smallest amount of installed packages possible, but most of the build dependencies can be removed afterwards.


I am starting this guide with a fresh install of Alpine on the 3.9 repos. First, you can install all the dependencies in one shot with the following:

apk add qemu-guest-agent git alpine-sdk autoconf m4 findutils \
automake python linux-pam-dev udev coreutils libtools



There might be some overlap between packages listed and those pulled in by alpine-sdk.

After the install finishes, we can git clone the source repo.

git clone https://github.com/ovirt/ovirt-guest-agent.git
cd ovirt-guest-agent
git fetch
git checkout ovirt-$version



Where $version is the most recent release. You can build off master if you desire, but that can be playing with fire. At the time of this article being written, 4.2 is the latest guest agent version available on Github.

With the sources now downloaded, the process becomes pretty similar to a standard autoconf/automake build:

autoreconf -fvi
PYTHON=/usr/bin/python2 ./configure \
--prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/bin \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=/usr/lib \
--datarootdir=/usr/share \
--datadir=/usr/share \
--infodir=/usr/share/info \
--includedir=/usr/include/security \
--enable-securedir=/usr/lib/security \
--with-pam-prefix=/etc \
--without-gdm \
--without-kdm
make
make install

chmod a+x /usr/share/ovirt-guest-agent/ovirt-guest-agent.py



That will handle most but not all of the install. It does not make the rc daemon file that we need, but don’t worry, it’s really basic to make this one.

/etc/init.d/ovirt-guest-agent:

#!/sbin/openrc-run

name="oVirt Guest Agent"
pidfile="/var/run/ovirt-guest-agent.pid"
command="/usr/share/ovirt-guest-agent/ovirt-guest-agent.py"
command_args="-d"



To successfully start the service now, you will need to have udev acknowledge the rule file that was installed:

udevadm trigger --subsystem-match="virtio-ports"



And finally, the run levels that need to be set for the service to successfully start after we reboot:

rc-update add qemu-guest-agent default
rc-update add udev boot
chmod +x /etc/init.d/ovirt-guest-agent
rc-update add ovirt-guest-agent default



ovirt-guest-agent will now start on reboot, and can be stopped and started using the service file in /etc/init.d.

To get rid of the now unneeded packages, you can run:

apk del alpine-sdk automake autoconf m4 git



Hope this helped!



About: Bailey Kasin

I build virtual environments and challenges for Cybersecurity students to complete as a way to gain experience before graduating and entering the workforce.


Leave a Reply

Your email address will not be published. Required fields are marked *