Page 1 of 1

All the iSCSI solutions for Raspbian

Posted: Thu Oct 31, 2019 3:42 pm
by Thinkcat

I'm running a Pi4 and wanted to mount an iSCSI share to it from a FreeNAS server. Problem is, no discovery produces any results from iSCSI shares that clearly are there and work with other systems and solutions.

So I figured out that I should study the issue by setting up my Pi3 as an iSCSI server. Problem is, there seems to be two solutions to do that. One is tgt, another is iscsitarget.

With the latter one, the kernel modules fail to compile:

Code: Select all

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 71.0 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 stretch/main armhf iscsitarget-dkms all [71.0 kB]
Fetched 71.0 kB in 0s (76.9 kB/s)     
(Reading database ... 88326 files and directories currently installed.)
Preparing to unpack .../iscsitarget-dkms_1.4.20.3+svn502-2_all.deb ...

Deleting module version:
completely from the DKMS tree.
Unpacking iscsitarget-dkms ( over ( ...
Setting up iscsitarget-dkms ( ...

Creating symlink /var/lib/dkms/iscsitarget/ ->

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make -j4 KERNELRELEASE=4.19.66-v7+ -C /lib/modules/4.19.66-v7+/build M=/var/lib/dkms/iscsitarget/ exit status: 2)
Error! Bad return status for module build on kernel: 4.19.66-v7+ (armv7l)
Consult /var/lib/dkms/iscsitarget/ for more information.
Removing old iscsitarget- DKMS files...

Deleting module version:
completely from the DKMS tree.
Loading new iscsitarget- DKMS files...
It is likely that 4.19.66-v7+ belongs to a chroot's host
Building for 4.19.66+ and 4.19.66-v7+
Building initial module for 4.19.66+
Error! Bad return status for module build on kernel: 4.19.66+ (armv7l)
Consult /var/lib/dkms/iscsitarget/ for more information.
I've been unable to figure out if I really have two kernels installed or just one. What is the difference between 4.19.66+ and 4.19.66-v7+, or are they somehow versions of the same? Their headers are from the same package. And in /boot there's kernel.img and kernel7.img, both about 5 MB in size. uname -r gives 4.19.66-v7+.

I will try tgt next.

Re: All the iSCSI solutions for Raspbian

Posted: Fri Nov 01, 2019 1:49 pm
by epoch1970
Tgt was replaced by iscsi/LIO about 10 years ago.

Re: All the iSCSI solutions for Raspbian

Posted: Sat Nov 02, 2019 9:12 pm
by Thinkcat
My adventure with setting up tgt on a Pi3 (without the plus) has gone like this:

For testing, I created a sparse file of a few gigabytes into my home directory:

Code: Select all

dd if=/dev/zero of=/home/pi/.abigsparsefile bs=1 count=0 seek=32G
Then I continued setting up the service:

Code: Select all

sudo tgtadm --lld iscsi --mode target --op new --tid 1 --targetname myiscsitarget
sudo tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-name
sudo tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address
sudo tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 --backing-store /home/pi/.abigsparsefile
sudo tgtadm --lld iscsi --mode account --op new --user carrot --password cabbage
sudo tgtadm --lld iscsi --mode account --op bind --tid 1 --user carrot
sudo tgtadm --lld iscsi --mode lld --op start
The settings are read by the service from /etc/tgt/targets.conf and /etc/tgt/conf.d/ but are not written there automatically. To write a configuration file, run tgt-admin --dump (notice the different binary) and either append the result to targets.conf or create a new file inside the conf.d directory. Also reinsert the password if one was used.

This way I had a working iSCSI target once I fixed a few stupid mistakes I made the first time round.

Re: All the iSCSI solutions for Raspbian

Posted: Wed Dec 11, 2019 5:49 pm
by tommylovell
Simple answer to your kernels question.

Google: kernel types in Raspbian 10 - Buster (or see: ... -10-buster). One answer is:

kernel.img is 32-bit for BCM2835 (RPi1 & Zero)
kernel7.img is 32-bit for BCM2836 (RPi2) and BCM2837 (RPi3)
kernel7l.img is 32-bit for BCM2711 (RPi4)
kernel8.img is 64-bit for BCM2837 (RPi3) or BCM2711 (RPi4)

All of the kernels, for various processors, are in /boot. At boot time the correct one is loaded.

'ls -l /lib/modules' shows the module directories, one of which should match up with your 'uname -r'.

I've used iscsi/LIO on x86 Fedora systems and it works flawlessly (even from a Mac using an iSCSI package). I haven't used it yet on the Pi. No need to yet. Sorry.