Home > iSCSI, NAS, Tech > iSCSI initiator (netbsd-iscsi-initiator) for OS X Mountain Lion (10.8.2)

iSCSI initiator (netbsd-iscsi-initiator) for OS X Mountain Lion (10.8.2)

January 13th, 2013 Leave a comment Go to comments

I am playing around with iSCSI for my macbook pro. Looked around and the used to be free SNS globalSAN iSCSI is no longer free. ATO is too expensive to play with. Saw that macport has a netbsd-iscsi, so went that route.


$ sudo port install netbsd-iscsi-initiator
---> Computing dependencies for netbsd-iscsi-initiator
---> Dependencies to be installed: netbsd-iscsi-lib
---> Building netbsd-iscsi-lib
Error: org.macports.build for port netbsd-iscsi-lib returned: command execution failed
Error: Failed to install netbsd-iscsi-lib
Please see the log file for port netbsd-iscsi-lib for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_netbsd-iscsi-lib/netbsd-iscsi-lib/main.log
Error: The following dependencies were not installed: netbsd-iscsi-lib
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: Processing of port netbsd-iscsi-initiator failed

Poking in main.log show the error at compiling disk.c.


:info:build /bin/sh ../../libtool --tag=CC --mode=compile /usr/bin/clang -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/opt/local/include -pipe -O2 -arch x86_64 -MT libiscsi_la-disk.lo -MD -MP -MF .deps/libiscsi_la-disk.Tpo -c -o libiscsi_la-disk.lo `test -f 'disk.c' || echo './'`disk.c
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/opt/local/include -pipe -O2 -arch x86_64 -MT libiscsi_la-disk.lo -MD -MP -MF .deps/libiscsi_la-disk.Tpo -c disk.c -fno-common -DPIC -o .libs/libiscsi_la-disk.o
:info:build disk.c:811:40: error: assignment to cast is illegal, lvalue casts are not supported
:info:build *((uint64_t *) ((void *)data + 8)) = (uint64_t) ISCSI_HTONLL(key);
:info:build ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build 1 error generated.
:info:build make: *** [libiscsi_la-disk.lo] Error 1

So I patched that line.


- *((uint64_t *) (void *)data + 8) = (uint64_t) ISCSI_HTONLL(key);
+ *((uint64_t *) ((void *)data + 8)) = (uint64_t) (ISCSI_HTONLL(key));

and now it builds. I just got to play with this to see if it works. More to report later.

Categories: iSCSI, NAS, Tech Tags: ,
  1. nsexpo
    April 20th, 2015 at 20:47 | #1

    @tin

    I’ve started an open-source project to bring an iSCSI initiator to OS X. It uses native OS X/Darwin libraries in its implementation so it’s optimized specifically for OS X (as opposed to the BSD families).

    It is largely functional at this point. If you would like to help test, debug or contribute additional features please see:

    http://www.github.com/iscsi-osx/iscsiinitiator

    • June 19th, 2015 at 15:35 | #2

      Thanks. I’ve been too busy with work and other projects to do much with this. Appreciate you letting me know though.

  2. nareg
    April 20th, 2015 at 06:42 | #3

    daniel :
    Hi tin,
    check out
    https://github.com/sakuro/macports/tree/master/net/netbsd-iscsi-initiator
    Not sure if that was the latest one, but better than nothing for a start maybe
    Would be awesome if someone took on iSCSI for Mac. It is a shame that there is no free and open implementation right now, would be terribly if this technology was left to ATO, GlobalSAN and others with crazy pricing ideas.
    Many thanks for any effort
    daniel

    I have started a new open-source project to bring an iSCSI initiator to OS X. At the moment, it functions reasonably well but it is still a work in progress. Please see:

    https://github.com/iscsi-osx/iSCSIInitiator

    Any help contributing in the form of development or testing is welcomed.

  3. October 22nd, 2014 at 04:58 | #4

    newborn :
    @tin
    I’ve compiled initiator but not working(on yosemite)
    iscsi-initiator -v -D -h 192.168.100.200
    pid 15026:initiator.c:788: ***ERROR*** Target is not allowing access
    pid 15026:initiator.c:1301: ***ERROR*** enqueue_worker: discovery_phase() failed (ignoring command)
    no matter what parameters are the initiator ouput errors above.

    as i figured the problem may causes by fuse4x which is replaced by osxfuse

    • October 29th, 2014 at 16:13 | #5

      I recently updated to Yosemite. Still having lock up issues with it though. There seem to be bad interaction with OpenLDAP and AD environment. I’ll take a look at iscsi-initiator when I have some time.

  4. October 22nd, 2014 at 04:15 | #6

    @tin
    I’ve compiled initiator but not working(on yosemite)

    iscsi-initiator -v -D -h 192.168.100.200
    pid 15026:initiator.c:788: ***ERROR*** Target is not allowing access
    pid 15026:initiator.c:1301: ***ERROR*** enqueue_worker: discovery_phase() failed (ignoring command)

    no matter what parameters are the initiator ouput errors above.

  5. February 18th, 2014 at 23:55 | #7

    Was looking for an open source iscsi initiator for Mac and your blog popped up. I’m at a lose as to why Apple has not included one in their OS.

    Can you direct me to instruction or resources so I can try wrapping my head around installing this
    out?

    • March 19th, 2014 at 21:18 | #8

      This is all source code based, so you will need to install Xcode and compile it yourself. It’s not the easy plug-n-play stuffs. Although if you have Mac port stuffs install, it should be straight forward to do. I’ll try to find some time to write up documentation for this package.

  6. daniel
    November 10th, 2013 at 09:11 | #9

    Hi tin,

    check out

    https://github.com/sakuro/macports/tree/master/net/netbsd-iscsi-initiator

    Not sure if that was the latest one, but better than nothing for a start maybe 🙂

    Would be awesome if someone took on iSCSI for Mac. It is a shame that there is no free and open implementation right now, would be terribly if this technology was left to ATO, GlobalSAN and others with crazy pricing ideas.

    Many thanks for any effort

    daniel

    • November 23rd, 2013 at 22:59 | #10

      Cool. Thank you. I’ll check it out in a few days. I am in the middle of a project, just started a new job. But I will definitely look into it.

      • December 7th, 2013 at 11:19 | #11

        I’ve got macports installed, working, and back to where I was before with netbsd-iscsi-initiator. It’s compiled, and this time I’ve created the correct patch and updated Portfile for devel/netbsd-iscsi-lib, which is a prereq for the initiator.

        I’ll play with it and see if I can get further this time.

        I’ve pushed the compile patch fix to https://github.com:TinLe/macports.git

  7. James
    November 4th, 2013 at 05:43 | #12

    Got all excited for a moment there 🙁 Anyone going to continue dev for this? PS. End user with some tinkering abilities (sysadmin)

    • November 8th, 2013 at 09:39 | #13

      If I can find the source for the last working version, I am willing to work on the driver.

      So if you know where it is, let me know.

  8. October 20th, 2013 at 14:39 | #14

    I now have a macbook pro and it seem macports has removed support for this package. Anyone know what happened to it? Even the last non-working source is fine. I was going to restart working on porting/fixing it.

    Let me know if anyone know where I can find it.

  9. June 15th, 2013 at 12:59 | #15

    I no longer have access to an OSX machine to work on. So no development for a while.

    +philby I tried both X-code and gcc from macports. Same results.

  10. philby
    May 6th, 2013 at 16:29 | #16

    I was wondering if you got this to work?

    Did you compile on the mac using x-code?

  11. filthy
    May 6th, 2013 at 05:20 | #17

    I was wondering if you got this to work. Did you compile on the mac using x-code?

  12. ppp dagger
    March 31st, 2013 at 05:59 | #18

    Hamm, chances to getting this working aren’t too high:
    https://trac.macports.org/ticket/32662

    Ppp.

  13. February 5th, 2013 at 08:25 | #19

    Thanks for documenting your patch. I’ve built it as well and am also looking into resolving the other bugs. Just curious if you ever got any further before I put too much work into this.

    • February 5th, 2013 at 23:15 | #20

      Sorry, I’ve been so busy that I have not had time to work on this. Feel free to jump in.

  14. January 14th, 2013 at 14:28 | #21

    I run into some other issues in getting it to work with my ReadyNAS NV+. I need to put sometime into debugging this. Then I’ll put together a HOW-TO using this initiator.

    tinmbp:~ tin $ sudo iscsi-initiator -v 5 -h 192.168.2.60 -D
    pid 1397:initiator.c:2222: ***ERROR*** Bad Status-Class: got 2, expected 0
    pid 1397:initiator.c:2018: ***ERROR*** initiator_cmd_t failed
    pid 1397:initiator.c:716: ***ERROR*** login_phase_i() failed
    pid 1397:initiator.c:1301: ***ERROR*** enqueue_worker: discovery_phase() failed (ignoring command)
    
  15. Dennis Juhler Aagaard
    January 14th, 2013 at 14:15 | #22

    Please keep us posted about this development. If you like i would like to test the binary if you pack it. 🙂
    -Dennis

  1. No trackbacks yet.
You must be logged in to post a comment.