Bug#581355: qemu-kvm: Fails to start with Cannot boot from non-existent NIC error

2010-05-12 Thread Örjan Persson
Package: qemu-kvm
Version: 0.12.3+dfsg-4
Severity: important
Tags: squeeze sid


After upgrading kvm and using the version in lenny-backports, KVM fails
to start and giving a Cannot boot from non-existent NIC error.

I found this problem reported here[1] and after applying upstream
commits 4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736 ...
4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736 the problem went away.

[1] http://lists.gnu.org/archive/html/qemu-devel/2010-04/msg00378.html

I'm attaching a working patch. Feel free to do whatever with it. As
mentioned in qemu-devel, it's only the patch #2 which fixes the problem.

-- System Information:
Debian Release: squeeze/sid
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/changelog b/debian/changelog
index ee44c7a..ddb6ebe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+qemu-kvm (0.12.3+dfsg-4~bpo50+2.1) unstable; urgency=low
+
+  * added patch from upstream, 4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736,
+07_remove_nicinfo_bootable_field.patch
+  * added patch from upstream, da1fcfda59a6bcbdf58d49243fbced455f2bf78a,
+08_remove_broken_set_boot_mask.patch, fixes an issue with PXE booting
+and more where kvm would say Cannot boot from non-existent NIC
+  * added patch from upstream, c2564608a149555d748390e446990324802586e7,
+09_remove_unused_boot_devices_bitmap_variable.patch
+
+ -- Örjan Persson or...@spotify.com  Tue, 11 May 2010 15:45:19 +0200
+
 qemu-kvm (0.12.3+dfsg-4~bpo50+2) lenny-backports; urgency=low
 
   * Re-add 99_lenny_bpo_ksm.patch: define MADV_MERGEABLE to enable KSM
diff --git a/debian/patches/07_remove_nicinfo_bootable_field.patch b/debian/patches/07_remove_nicinfo_bootable_field.patch
new file mode 100644
index 000..0233abb
--- /dev/null
+++ b/debian/patches/07_remove_nicinfo_bootable_field.patch
@@ -0,0 +1,24 @@
+Index: qemu-kvm-0.12.3+dfsg/net.c
+===
+--- qemu-kvm-0.12.3+dfsg.orig/net.c	2010-05-11 15:32:51.0 +0200
 qemu-kvm-0.12.3+dfsg/net.c	2010-05-11 15:33:06.0 +0200
+@@ -1196,7 +1196,6 @@
+ 
+ for (i = 0; i  nb_nics; i++) {
+ if (net_boot_mask  (1  i)) {
+-nd_table[i].bootable = 1;
+ net_boot_mask = ~(1  i);
+ }
+ }
+Index: qemu-kvm-0.12.3+dfsg/net.h
+===
+--- qemu-kvm-0.12.3+dfsg.orig/net.h	2010-05-11 15:32:58.0 +0200
 qemu-kvm-0.12.3+dfsg/net.h	2010-05-11 15:33:06.0 +0200
+@@ -132,7 +132,6 @@
+ VLANState *vlan;
+ VLANClientState *netdev;
+ int used;
+-int bootable;
+ int nvectors;
+ };
+ 
diff --git a/debian/patches/08_remove_broken_set_boot_mask.patch b/debian/patches/08_remove_broken_set_boot_mask.patch
new file mode 100644
index 000..b7231bf
--- /dev/null
+++ b/debian/patches/08_remove_broken_set_boot_mask.patch
@@ -0,0 +1,65 @@
+Index: qemu-kvm-0.12.3+dfsg/net.c
+===
+--- qemu-kvm-0.12.3+dfsg.orig/net.c	2010-05-11 15:33:55.0 +0200
 qemu-kvm-0.12.3+dfsg/net.c	2010-05-11 15:34:15.0 +0200
+@@ -1187,25 +1187,6 @@
+ qemu_del_vlan_client(vc);
+ }
+ 
+-void net_set_boot_mask(int net_boot_mask)
+-{
+-int i;
+-
+-/* Only the first four NICs may be bootable */
+-net_boot_mask = net_boot_mask  0xF;
+-
+-for (i = 0; i  nb_nics; i++) {
+-if (net_boot_mask  (1  i)) {
+-net_boot_mask = ~(1  i);
+-}
+-}
+-
+-if (net_boot_mask) {
+-fprintf(stderr, Cannot boot from non-existent NIC\n);
+-exit(1);
+-}
+-}
+-
+ void do_info_network(Monitor *mon)
+ {
+ VLANState *vlan;
+Index: qemu-kvm-0.12.3+dfsg/net.h
+===
+--- qemu-kvm-0.12.3+dfsg.orig/net.h	2010-05-11 15:34:00.0 +0200
 qemu-kvm-0.12.3+dfsg/net.h	2010-05-11 15:34:15.0 +0200
+@@ -162,7 +162,6 @@
+ int net_init_clients(void);
+ void net_check_clients(void);
+ void net_cleanup(void);
+-void net_set_boot_mask(int boot_mask);
+ void net_host_device_add(Monitor *mon, const QDict *qdict);
+ void net_host_device_remove(Monitor *mon, const QDict *qdict);
+ 
+Index: qemu-kvm-0.12.3+dfsg/vl.c
+===
+--- qemu-kvm-0.12.3+dfsg.orig/vl.c	2010-05-11 15:34:06.0 +0200
 qemu-kvm-0.12.3+dfsg/vl.c	2010-05-11 15:35:20.0 +0200
+@@ -4919,7 +4919,7 @@
+ const char *gdbstub_dev = NULL;
+ uint32_t boot_devices_bitmap = 0;
+ int i;
+-int snapshot, linux_boot, net_boot;
++int snapshot, linux_boot;
+ const char *initrd_filename;
+ const char *kernel_filename, *kernel_cmdline;
+ char boot_devices[33] = cad; /* default 

Bug#581355: qemu-kvm: Fails to start with Cannot boot from non-existent NIC error

2010-05-12 Thread Michael Tokarev
tags 581355 + pending
thanks

Örjan Persson wrote:
 Package: qemu-kvm
 Version: 0.12.3+dfsg-4
 Severity: important
 Tags: squeeze sid
 
 
 After upgrading kvm and using the version in lenny-backports, KVM fails
 to start and giving a Cannot boot from non-existent NIC error.
 
 I found this problem reported here[1] and after applying upstream
 commits 4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736 ...
 4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736 the problem went away.
 
 [1] http://lists.gnu.org/archive/html/qemu-devel/2010-04/msg00378.html

It's in qemu-kvm debian package git tree for quite some time already,
pending upload:

http://git.debian.org/?p=collab-maint/qemu-kvm.git;a=commit;h=8737e37ee07e1ac66db44a4d0908356ebd6b48b3

 I'm attaching a working patch. Feel free to do whatever with it. As
 mentioned in qemu-devel, it's only the patch #2 which fixes the problem.

Yeah.  I'm about to release a new qemu-kvm package.

Thank you!

/mjt



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org