libguestfs can't communicate over network while creating VM
Hello guys, we use libguests for dynamic creation of our VM and we do various modifications of those VMs in the process. One with I am struggling with is to signing keys of our custom repository - " vm.sh("wget -O - " + key_address + " | apt-key add -")" where "vm" is a GuestFS object. So I have set "vm.set_network(True)" and I have installed "dhcpcd5" package (that's whats on Debian Jessie) on both Host OS with KVM running and VM template (because we always copy Debian template we have in order to create new VM). However according to the log libvirt is still complaining that dhcpcd is missing (line 371 in the log). I ran dhcpcd command on both machines and I've even restarted networking service - unfortunately nothing helps. So I'd like to ask you for help or at least any hints. Thanks a lot. http://pastebin.com/d6zZG1BK P.S. I already wrote to the #libvirt channel on IRC but nobody replied so I am trying my luck here :) Best regards Petr Mensík
Hi, On Thursday 16 June 2016 11:17:16 Mensik, Petr wrote:
we use libguests for dynamic creation of our VM and we do various modifications of those VMs in the process. One with I am struggling with is to signing keys of our custom repository - " vm.sh("wget -O - " + key_address + " | apt-key add -")" where "vm" is a GuestFS object. So I have set "vm.set_network(True)" and I have installed "dhcpcd5" package (that's whats on Debian Jessie) on both Host OS with KVM running and VM template (because we always copy Debian template we have in order to create new VM). However according to the log libvirt is still complaining that dhcpcd is missing (line 371 in the log). I ran dhcpcd command on both machines and I've even restarted networking service - unfortunately nothing helps. So I'd like to ask you for help or at least any hints. Thanks a lot.
This is not really a libvirt issue, but a libguestfs one. When setting up the network, libguestfs tries to use first dhclient if available, then dhcpcd otherwise. I see that libguestfs0 currently in Stretch has a dependency on isc-dhcp-client, but it looks like the version in Jessie does not. Do you have isc-dhcp-client installed on the machine where you run the Python script? If not, install it and then run `libguestfs-test-tool` to update the libguestfs appliance (it will be done anyway later, but this way your script doesn't take more than needed). Once you have done that, does the network work? -- Pino Toscano
Hello Pino, I tried installing the package and running the command, however nothing has changed :-/ This package should be installed as an addition to the dhcpcd5 or is a replacement? Thanks Best regards, Petr ________________________________________ From: Pino Toscano <ptoscano@redhat.com> Sent: Thursday, June 16, 2016 1:45 PM To: libguestfs@redhat.com; Mensik, Petr Subject: Re: [Libguestfs] libguestfs can't communicate over network while creating VM Hi, On Thursday 16 June 2016 11:17:16 Mensik, Petr wrote:
we use libguests for dynamic creation of our VM and we do various modifications of those VMs in the process. One with I am struggling with is to signing keys of our custom repository - " vm.sh("wget -O - " + key_address + " | apt-key add -")" where "vm" is a GuestFS object. So I have set "vm.set_network(True)" and I have installed "dhcpcd5" package (that's whats on Debian Jessie) on both Host OS with KVM running and VM template (because we always copy Debian template we have in order to create new VM). However according to the log libvirt is still complaining that dhcpcd is missing (line 371 in the log). I ran dhcpcd command on both machines and I've even restarted networking service - unfortunately nothing helps. So I'd like to ask you for help or at least any hints. Thanks a lot.
This is not really a libvirt issue, but a libguestfs one. When setting up the network, libguestfs tries to use first dhclient if available, then dhcpcd otherwise. I see that libguestfs0 currently in Stretch has a dependency on isc-dhcp-client, but it looks like the version in Jessie does not. Do you have isc-dhcp-client installed on the machine where you run the Python script? If not, install it and then run `libguestfs-test-tool` to update the libguestfs appliance (it will be done anyway later, but this way your script doesn't take more than needed). Once you have done that, does the network work? -- Pino Toscano
Hi, On Thursday 16 June 2016 15:12:39 Mensik, Petr wrote:
I tried installing the package and running the command, however nothing has changed :-/ This package should be installed as an addition to the dhcpcd5 or is a replacement?
Curiously enough, another user asked about this on our IRC channel (#libguestfs on freenode) a couple of hours ago, and what came out is that there is a bug in the Debian packaging, where the lack of a build dependency made the appliance not use the right dhcp package. To workaround locally, on the host where you are running the libguestfs commands you can do: 1) install isc-dhcp-client 2) as root, `echo isc-dhcp-client > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp` 3) as the user who runs your Python script, run libguestfs-test-tool to update the appliance -- you should see the line: supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp type uncompressed packages in its output -- meaning that file was picked correctly (and thus isc-dhcp-client hopefully copied) 4) now the network should work There is a Debian bug about it: https://bugs.debian.org/775514 -- fixed only in Stretch though. Just left a comment there, should be an easy fix for Jessie. Thanks, -- Pino Toscano
Hello Pino, I am still getting the same error however from libguestfs log (when creating VM) seems that DHCP has been found - no 'DHCP can't be found' or whatever error it was. So there is some progress but the issue persists :-/ This is what I have done apt-get purge dhcpcd5* apt-get install isc-dhcp-client echo isc-dhcp-client > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp libguestfs-test-tool (and the message was indeed in the log) So I am wondering what could be the issue. I am enclosing libguestfs log from VM creation http://pastebin.com/A3We5f1F . Thanks a lot for your help Best regards Petr Menšík ________________________________________ From: Pino Toscano <ptoscano@redhat.com> Sent: Thursday, June 16, 2016 6:03 PM To: libguestfs@redhat.com; Mensik, Petr Subject: Re: [Libguestfs] libguestfs can't communicate over network while creating VM Hi, On Thursday 16 June 2016 15:12:39 Mensik, Petr wrote:
I tried installing the package and running the command, however nothing has changed :-/ This package should be installed as an addition to the dhcpcd5 or is a replacement?
Curiously enough, another user asked about this on our IRC channel (#libguestfs on freenode) a couple of hours ago, and what came out is that there is a bug in the Debian packaging, where the lack of a build dependency made the appliance not use the right dhcp package. To workaround locally, on the host where you are running the libguestfs commands you can do: 1) install isc-dhcp-client 2) as root, `echo isc-dhcp-client > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp` 3) as the user who runs your Python script, run libguestfs-test-tool to update the appliance -- you should see the line: supermin: build: visiting /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp type uncompressed packages in its output -- meaning that file was picked correctly (and thus isc-dhcp-client hopefully copied) 4) now the network should work There is a Debian bug about it: https://bugs.debian.org/775514 -- fixed only in Stretch though. Just left a comment there, should be an easy fix for Jessie. Thanks, -- Pino Toscano
On Thursday 16 June 2016 16:28:47 Mensik, Petr wrote:
I am still getting the same error however from libguestfs log (when creating VM) seems that DHCP has been found - no 'DHCP can't be found' or whatever error it was. So there is some progress but the issue persists :-/
This is what I have done
apt-get purge dhcpcd5* apt-get install isc-dhcp-client echo isc-dhcp-client > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp libguestfs-test-tool (and the message was indeed in the log)
So I am wondering what could be the issue. I am enclosing libguestfs log from VM creation http://pastebin.com/A3We5f1F . Thanks a lot for your help
In addition to the dependency issue, dhclient needs the interface as parameter; this has been fixed upstream already, and I left an additional comment in the Debian bug with the patch needed to backport: https://bugs.debian.org/775514#68 You can workaround locally with the following instructions as root: 1) # cd /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/ 2) # tar xzf init.tar.gz 3) patch the 'init' file with the changes in https://github.com/libguestfs/libguestfs/commit/2d2a65504dca732a398d237565b9... 4) # tar czf init.tar.gz init 5) # rm init Now the network should be working. Thanks, -- Pino Toscano
Hello Pino, thanks for pointing me to the patched file, it's really working now with this change. Thanks a lot :) Best regards Petr Menšík ________________________________________ From: Pino Toscano <ptoscano@redhat.com> Sent: Friday, June 17, 2016 2:23 PM To: libguestfs@redhat.com; Mensik, Petr Subject: Re: [Libguestfs] libguestfs can't communicate over network while creating VM On Thursday 16 June 2016 16:28:47 Mensik, Petr wrote:
I am still getting the same error however from libguestfs log (when creating VM) seems that DHCP has been found - no 'DHCP can't be found' or whatever error it was. So there is some progress but the issue persists :-/
This is what I have done
apt-get purge dhcpcd5* apt-get install isc-dhcp-client echo isc-dhcp-client > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp libguestfs-test-tool (and the message was indeed in the log)
So I am wondering what could be the issue. I am enclosing libguestfs log from VM creation http://pastebin.com/A3We5f1F . Thanks a lot for your help
In addition to the dependency issue, dhclient needs the interface as parameter; this has been fixed upstream already, and I left an additional comment in the Debian bug with the patch needed to backport: https://bugs.debian.org/775514#68 You can workaround locally with the following instructions as root: 1) # cd /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/ 2) # tar xzf init.tar.gz 3) patch the 'init' file with the changes in https://github.com/libguestfs/libguestfs/commit/2d2a65504dca732a398d237565b9... 4) # tar czf init.tar.gz init 5) # rm init Now the network should be working. Thanks, -- Pino Toscano
On Thu, Jun 16, 2016 at 11:17:16AM +0000, Mensik, Petr wrote:
Hello guys,
we use libguests for dynamic creation of our VM and we do various modifications of those VMs in the process. One with I am struggling with is to signing keys of our custom repository - " vm.sh("wget -O - " + key_address + " | apt-key add -")" where "vm" is a GuestFS object. So I have set "vm.set_network(True)" and I have installed "dhcpcd5" package (that's whats on Debian Jessie) on both Host OS with KVM running and VM template (because we always copy Debian template we have in order to create new VM). However according to the log libvirt is still complaining that dhcpcd is missing (line 371 in the log). I ran dhcpcd command on both machines and I've even restarted networking service - unfortunately nothing helps. So I'd like to ask you for help or at least any hints. Thanks a lot.
P.S. I already wrote to the #libvirt channel on IRC but nobody replied so I am trying my luck here :)
Most likely dhcpcd is not being copied into the appliance. Try doing: echo dhcpcd > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Hello Richard, I tried what you have adviced (however zzz-dhcp should be replaced by something else or is that right?) and still nothing changes. Btw dhcpcd should be running on the background or is it fine to have just installed (I tried running script with both options - same result unfortunately). Thanks again. S pozdravem | Best regards Petr Menšík Senior Java Developer ________________________________________ From: Richard W.M. Jones <rjones@redhat.com> Sent: Thursday, June 16, 2016 3:48 PM To: Mensik, Petr Cc: libguestfs@redhat.com Subject: Re: [Libguestfs] libguestfs can't communicate over network while creating VM On Thu, Jun 16, 2016 at 11:17:16AM +0000, Mensik, Petr wrote:
Hello guys,
we use libguests for dynamic creation of our VM and we do various modifications of those VMs in the process. One with I am struggling with is to signing keys of our custom repository - " vm.sh("wget -O - " + key_address + " | apt-key add -")" where "vm" is a GuestFS object. So I have set "vm.set_network(True)" and I have installed "dhcpcd5" package (that's whats on Debian Jessie) on both Host OS with KVM running and VM template (because we always copy Debian template we have in order to create new VM). However according to the log libvirt is still complaining that dhcpcd is missing (line 371 in the log). I ran dhcpcd command on both machines and I've even restarted networking service - unfortunately nothing helps. So I'd like to ask you for help or at least any hints. Thanks a lot.
P.S. I already wrote to the #libvirt channel on IRC but nobody replied so I am trying my luck here :)
Most likely dhcpcd is not being copied into the appliance. Try doing: echo dhcpcd > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zzz-dhcp Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
participants (3)
-
Mensik, Petr -
Pino Toscano -
Richard W.M. Jones