iSCSI modules for 3.1.9+?


21 posts
by majenko » Sat Jun 02, 2012 2:21 pm
Are there kernel modules for 3.1.9+ on the Pi available?

Specifically:

kernel/drivers/scsi/iscsi_tcp.ko
kernel/drivers/scsi/libiscsi.ko
kernel/drivers/scsi/libiscsi_tcp.ko
kernel/drivers/scsi/scsi_transport_iscsi.ko

I see the files available in various 2.6.32-5 kernels in apt, but I don't think downgrading is an option...?
Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies

They say computers only do what you tell them to. They're wrong. Mine still hasn't gone to hell.
Posts: 15
Joined: Fri Jun 01, 2012 9:53 am
by AndrewS » Sun Jun 03, 2012 3:34 pm
Doesn't look like it: https://github.com/raspberrypi/firmware ... ivers/scsi

So you'll need to configure and compile your own kernel http://elinux.org/Rpi_kernel_compilation
User avatar
Posts: 3105
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by nidO » Sun Jun 03, 2012 4:01 pm
The iscsi modules are not included by default - I've managed to get iscsi going (both initiator and target) on the pi and have subsequently managed to get the pi booting from an iscsi root using a custom initramfs, none of this currently appears to be documented anywhere as yet for the pi, I can put together a guide on it from start to finish if it'd be useful for you.
Posts: 22
Joined: Sun Jun 03, 2012 3:58 pm
by Scotty T » Tue Jun 05, 2012 4:36 am
Yes please do a guide. I've lost days of my life trying to get this to work. I don't have enough Linux experience to get this working. It's driving me nuts !
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by nidO » Tue Jun 05, 2012 2:02 pm
As requested i've started a writeup on this, i'll put this online to a wiki once it's complete and fully checked but the first half of it (dealing with at least getting iscsi going) is below.

This guide is split into two parts, part 1 deals with rebuilding the standard Debian image to include iscsi support so that the pi can access an iscsi target (and function as a target itself if needed, but this guide deals with setting up as an initiator), part 2 then extends on this to enable booting from an iscsi root.

This guide assumes at least a basic knowledge of iscsi and that you already have a suitable target setup on your SAN/NAS/wherever. For the sake of simplicity we will be performing on-device kernel recompiles, these take 4-6 hours, you can simply perform a cross-compile elsewhere to speed this up if you prefer.
Also assumed in this guide is that you're working as the root user - If you're using a non-root user, most commands will need to be prefixed with a sudo.

Part 1

First up, we need to get the iscsi initiator service installed, along with git, gcc, make, ncurses, ncurses-devel and python, which are needed for an on-device kernel recompile:

Code: Select all
apt-get install open-iscsi git gcc make python ncurses ncurses-devel


Lets create a folder in which to keep the various content we'll need for the kernel rebuild:

Code: Select all
mkdir /root/raspberrypi
cd /root/raspberrypi


We now need to fetch the kernel sources to build from, this will take a while:

Code: Select all
git clone https://github.com/raspberrypi/linux.git --depth 1


Now take a copy of your current running kernel configuration, which we can then alter:

Code: Select all
cd /root/raspberrypi/linux
zcat /proc/config.gz > .config


Now let's load the system's UI-based kernel configuration editor (these changes can be adjusted manually, but the UI is simple):

Code: Select all
make menuconfig


Once the UI has loaded, navigate to the "Device Drivers" section (enter to navigate between pages, space to change an option), then "SCSI device support", then "SCSI Transports". Change the "iSCSI Transport Attributes" option twice (so that it shows a *) to build it into the kernel. Go back a page, hit space for "SCSI low-level drivers" to enable this option, then enter to descend into it, then space twice for a * on "iSCSI Initiator over TCP/IP".
Once these options are enabled, exit the UI and save changes. To ensure these are set, run:

Code: Select all
grep ISCSI .config


This should return the following:

CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_ISCSI_TCP=y
# CONFIG_ISCSI_BOOT_SYSFS is not set

With this in place, compile your new kernel:

Code: Select all
make


This process will take in the region of 4-6 hours to complete.

Once done, we need to generate an image of this kernel for the Pi to boot from, then replace your existing kernel:

First up, we need the mkimage python tool:

Code: Select all
cd /root/raspberrypi
git clone https://github.com/raspberrypi/tools


Now build the image:

Code: Select all
cd /root/raspberrypi/tools/mkimage
python imagetool-uncompressed.py /root/raspberrypi/linux/arch/arm/boot/Image


Now create a backup of your existing kernel, then replace the running kernel with the newly-generated one:

Code: Select all
cp /boot/kernel.img /boot/kernel.img-backup
cp kernel.img /boot/kernel.img


With this done, reboot your pi into your new iscsi-enabled kernel:

Code: Select all
reboot


If you have any problems with booting at this point, you can always revert to your old kernel by mounting your SD card into a card reader on another system, then revert kernel.img-backup to kernel.img.

Assuming all has gone well, you can now use iscsiadm to discover then login to your iscsi target (though hopefully youll already be familiar with configuring an initiator to access a target), for example:

iscsiadm --mode discovery --type sendtargets --portal XXX.XXX.XXX.XXX

where the IP address in the above should be the address of your iscsi target, then once it has been discovered, login to the target with:

iscsiadm --mode node --loginall=all

Part 2 dealing with generating a custom initramfs to boot directly from an iscsi root coming soon, after i've helped the other half with some gardening :<
Posts: 22
Joined: Sun Jun 03, 2012 3:58 pm
by Scotty T » Tue Jun 05, 2012 2:35 pm
Thank you for this post but I can't get past step 1

Package ncurses is not available, but is referred to by another pakage. This may mean ....... I'm sure you know the rest

E: Package 'ncurses' has no installation candidate
E: Unable to locate package ncurses-devel

Thoughts?
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by Scotty T » Tue Jun 05, 2012 3:21 pm
OK, under debain I did "sudo apt-get install ncurses5-dev"

That did the trick, compiling now, I'll let you know of my success or failures.
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by AndrewS » Tue Jun 05, 2012 4:11 pm
IIRC Fedora-and-derivatives use "-devel" packages, and Debian-and-derivatives use "-dev" packages. The reasons for which are probably lost in the sands of time ;)
(haven't used Arch myself yet, so dunno what conventions that uses!)

I think http://elinux.org/RPi_Guides#Advanced would be a great place for nidO to add this information to :)
User avatar
Posts: 3105
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by Scotty T » Tue Jun 05, 2012 4:15 pm
This is going to make for a great wiki. I use my iSCSI nas all the time and whether or not it be CIFS or iSCSI many people are going to be using some form of it mixed in with cloud computing. It's already happening.
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by nidO » Tue Jun 05, 2012 4:49 pm
Heya,

Well spotted sorry (I didnt properly verify the package names), so to recap the install in step 1 should in full be:

Code: Select all
apt-get install open-iscsi git gcc make python libncurses5-dev


Just to also point out, another assumption made with this guide is that you have already expanded the default partition size on your SD card (GordonDragon has a good guide on doing so directly on the pi at https://projects.drogon.net/raspberry-p ... al-setup1/) as the relevant packagages and kernel source will not fit on the default 1.6GB partition (about 2GB is required on / in total for the debian install + kernel sources).
Posts: 22
Joined: Sun Jun 03, 2012 3:58 pm
by nidO » Tue Jun 05, 2012 5:23 pm
I've now added a draft of this to the list of elinux RPi guides, at:

http://elinux.org/RPi_iSCSI_Initiator

I'll hopefully be getting part 2 on setting up a custom initramfs to boot directly from iscsi written this evening.
Posts: 22
Joined: Sun Jun 03, 2012 3:58 pm
by Scotty T » Tue Jun 05, 2012 6:56 pm
How about a part 3 iSCSI target?
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by nidO » Tue Jun 05, 2012 8:09 pm
Sure, I can do that as well - once part 1 has been followed to get an iscsi-capable kernel though, setting up an iscsi target is just a case of installing tgt and configuring the target as needed.
Posts: 22
Joined: Sun Jun 03, 2012 3:58 pm
by Scotty T » Tue Jun 05, 2012 9:12 pm
I'm still compiling , it's been almost 6 hrs. UGH!
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by nidO » Wed Jun 06, 2012 1:16 am
Part 2 is now up at:

http://elinux.org/RPi_iSCSI_Initiator#P ... iSCSI_root

Parts 1 and 2 combined now provide a start to finish walkthrough from taking a raw debian image to booting your pi over the network via iSCSI. The whole process as written has been tested by me over this evening, though I havent thoroughly proof-read part 2 for grammar or speeling mastooks so sorry if there are any!
Posts: 22
Joined: Sun Jun 03, 2012 3:58 pm
by Scotty T » Wed Jun 06, 2012 11:41 am
Ok, I can be the first to say this wiki works great. My iscis is working.
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by zero10 » Mon Oct 22, 2012 2:06 pm
I found this thread from a google search and am hoping it isn't too old to still get some help with...

I am trying to get iscsi target working on my raspberry pi, but I am running into a small problem. I have built the kernel as described above and booted from it (and verified that I am running my new custom build kernel) however I still get this error when trying to start iscsitarget:

Code: Select all
/etc/init.d/iscsitarget start
[....] Starting iSCSI enterprise target service:FATAL: Module iscsi_trgt not found.
 failed!


Is there anything additional I should be selecting from within the kernel's menuconfig beyond what is listed above?
Posts: 2
Joined: Sun Aug 12, 2012 1:52 pm
by dmknob » Tue Nov 13, 2012 11:55 am
zero10 wrote:I found this thread from a google search and am hoping it isn't too old to still get some help with...

I am trying to get iscsi target working on my raspberry pi, but I am running into a small problem. I have built the kernel as described above and booted from it (and verified that I am running my new custom build kernel) however I still get this error when trying to start iscsitarget:

Code: Select all
/etc/init.d/iscsitarget start
[....] Starting iSCSI enterprise target service:FATAL: Module iscsi_trgt not found.
 failed!


Is there anything additional I should be selecting from within the kernel's menuconfig beyond what is listed above?


Same problem here. I'm using the tuto with kernel 3.2.27+
Ideas?
Posts: 13
Joined: Tue Jul 31, 2012 3:19 am
by nidO » Tue Nov 13, 2012 12:19 pm
zero10 & dmknob, the issue you're both running into is essentially that iSCSI Enterprise Target (iscsitarget) requires a separate kernel module be installed (which isn't explicitly covered in the guide as this primarily deals with setting up the pi as an initiator rather than target).
This module can be downloaded from the repos as iscsitarget-module, however an easier option might be to simply use tgt instead of iscsitarget (an alternative iSCSI target daemon) which does not need any separate kernel module installed, and so will work out of the box after iSCSI support has been enabled (ie part 1 of the guide), its available as tgt in the repos.
Posts: 22
Joined: Sun Jun 03, 2012 3:58 pm
by dmknob » Tue Nov 13, 2012 12:56 pm
Very thanks for reply man, the iscsitarget has putting a lot of complications with install/configure (i can't install the iscsitarget-source and the iscsitarget-module, appears not be in the repos).

And trying to compile the module with module-assistant and debhelper (http://sys-admin.wikidot.com/install-iscsi-target) cause issues too.

I'm away from my Pi and can access then now, but when i'm at home a try it again with tgt.

Question: i messed up my system today, after recompile the kernel. Can i copy the functional recompilled kernel and put up inside a fresh install of Raspbian? Like follow the tuto but skip the 'make' part and then put the recompiled and backuped kernel on /boot.

My final goal is use the Pi with a dual HDD USB case sharing files over my network. Actually i using Samba and EXT4, but i can't plug the USB case on Windows if needed.. I hope that NTFS over iSCSI will have a good speed instead of NTFS with Samba.

Many thanks again!
Posts: 13
Joined: Tue Jul 31, 2012 3:19 am
by n1ko » Wed Nov 14, 2012 6:39 am
dmknob wrote:My final goal is use the Pi with a dual HDD USB case sharing files over my network. Actually i using Samba and EXT4, but i can't plug the USB case on Windows if needed.. I hope that NTFS over iSCSI will have a good speed instead of NTFS with Samba.

Many thanks again!


Actually, you can read EXT4 on Windows ( for example http://www.ext2fsd.com/ ). The problem you are having most likely has to do with NTFS (and Samba isn't that lightweight alternative). iSCSI is not really made same thing as Samba. What you most likely would have was NFS (yes, you can use it with windows). Although this becomes majorily off topic I suggest that you look in to ext4+nfs :)
Posts: 10
Joined: Mon Nov 12, 2012 5:17 am