[SOLVED] iSCSI target stopped working when upgrading to 3.0

martin67

Renowned Member
Jun 4, 2013
2
0
66
Hi,

I'm running my Proxmox host as a iSCSI target for some backup purposes. This worked fine in 2.3. But not now when upgrading to 3.0 :(

I use the iscsitarget and iscsitarget-dkms packages. The DKMS packages fails to compile because of missing definitions in linux/blkdev.h:

Code:
  CC [M]  /var/lib/dkms/iscsitarget/1.4.20.2/build/kernel/block-io.o                                                        
/var/lib/dkms/iscsitarget/1.4.20.2/build/kernel/block-io.c: In function ‘blockio_make_request’:                             
/var/lib/dkms/iscsitarget/1.4.20.2/build/kernel/block-io.c:59:18: error: storage size of ‘plug’ isn’t known

Apparently the definition of struct blk_plug is missing from the header files. Digging some more I found that /usr/src/linux-headers-2.6.32-20-pve/include/linux/blkdev.h does not define this. But it was there in the new wheezy kernel that came with 3.0 upgrade (/usr/src/linux-headers-3.2.0-4-common/include/linux/blkdev.h).

More checking found that the problem is really in the iscsitarget-dkms package. There is a patch that fixes the problem above, but the patch is for ver 2.6.38 and not applied. But the patch seems to fix the problems so what I did was to modify the /var/lib/dkms/iscsitarget/1.4.20.2/source/dkms.conf file so that the patch is applied.

Code:
--- dkms.conf.org       2013-06-04 14:49:28.000000000 +0200
+++ dkms.conf   2013-06-04 14:50:26.000000000 +0200
@@ -37,3 +37,5 @@
 PATCH_MATCH[13]="2\.6\.16\.60-.*"
 PATCH[14]="compat-rhel4.patch"
 PATCH_MATCH[14]="2\.6\.9-.*\.(el|plus\.c4)"
+PATCH[15]="compat-2.6.38.patch"
+PATCH_MATCH[15]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38)"

So it works now; can't understand how I got it working for Proxmox 2.3 :D


Maybe this will help someone

//Martin
 
iscsitarget module 1.4.20.2 is included in our kernel, so why do you want to compile yourself?

Code:
modinfo iscsi_trgt

filename:       /lib/modules/2.6.32-20-pve/kernel/drivers/scsi/iscsi_trgt.ko
author:         IET development team <iscsitarget-devel@lists.sourceforge.net>
description:    iSCSI Enterprise Target
license:        GPL
version:        1.4.20.2
...
 
Last edited by a moderator:
iscsitarget module 1.4.20.2 is included in our kernel, so why do you want to compile yourself?

Code:
modinfo iscsi_trgt

filename:       /lib/modules/2.6.32-20-pve/kernel/drivers/scsi/iscsi_trgt.ko
author:         IET development team <iscsitarget-devel@lists.sourceforge.net>
description:    iSCSI Enterprise Target
license:        GPL
version:        1.4.20.2
...

I'm guessing Martin had the same problem as I did.

When you try to start ietd with the module included in your kernel, you would get a

Code:
root@pvebak02:# ietd -d 8 -f
1370711794.050896: kernel module version mismatch!

and then ietd wouldn't start at all.

To clarify, first apply the patch Martin suggested and then rebuild the module with dkms:

Code:
root@pvebak02:# dkms autoinstall


So thank you Martin! Your post saved me some gray hairs...


--
Olle Gustafsson
 
This problem exists in a clean install of 3.1 also. What I did, edited /var/lib/dkms/iscsitarget/1.4.20.2/source/dkms.conf in the above instead of running the patch file

deleted the last three lines, added these (don't add the plusses above, these are if run in a patch file);

PATCH_MATCH[13]="2\.6\.16\.60-.*"
PATCH[14]="compat-rhel4.patch"
PATCH_MATCH[14]="2\.6\.9-.*\.(el|plus\.c4)"
PATCH[15]="compat-2.6.38.patch"
PATCH_MATCH[15]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38)"
 
Last edited:
Which, seems to work for block devices, but if you want to export something like a tape drive this seems to require rawio.

Rawio was written as a patch http://sourceforge.net/p/iscsitarget/patches/14/ but only for iscsitarget-0.4.17

Which, only supports up to 2.6.23 kernels. Yay.

So, looks like right now that since scsi passthrough doesn't work, tape drives are a no go for clients and a drive connected to a proxmox host (unless it seems you run version 1.x lol)
 
Thank you so very much. I just upgraded to 3.1 and immediately my iSCSI wasn't working. This solved is.
Thanks again.
 
Code:
apt-get install iscsitarget-dkms

cat<EOF>>/var/lib/dkms/iscsitarget/1.4.20.2/source/dkms.conf
PATCH[15]="compat-2.6.38.patch"
PATCH_MATCH[15]="2\.6\.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38)"
EOF

dkms autoinstall


Works magically, thanks