Ubuntu: iscsiadm: initiator reported error (24 – iSCSI login failed due to authorization failure)
i was trying to export one iscsi share from centOS server and my client is Ubuntu server.
well i know this will work on CentOS/Redhat without any changes and i was under impression that , on ubuntu also will get same behavior.
On CentOS, below are the commands to create Iscsi target
Server
Install and enable services:
yum -y install target*
systemctl start target && systemctl enable target
# targetcli /backstores/block create name=ubuntu-iscsi dev=/dev/cl_centos/lv_scsi
# targetcli /iscsi create iqn.2017-02.com.example.kw:centos
# targetcli /iscsi/iqn.2017-02.com.example.kw:centos/tpg1/acls create iqn.2017-02.com.example.kw:ubuntu-archive
# targetcli /iscsi/iqn.2017-02.com.example.kw:centos/tpg1/luns create /backstores/block/ubuntu-iscsi
# targetcli /iscsi/iqn.2017-02.com.example.kw:centos/tpg1/portals delete 0.0.0.0 3260
# targetcli /iscsi/iqn.2017-02.com.example.kw:centos/tpg1/portals create 192.168.1.66 3260
# targetcli saveconfig
Allow TCP port if firewalld is enabled.
# firewall-cmd –permanent –add-port=3260/tcp
All set from from target(server) side.
Client
On client side install iscsi packages
# apt-get -y install open-iscsi
edit /etc/iscsi/iscsid.conf and change like below
# To request that the iscsi initd scripts startup a session set to “automatic”.
# node.startup = automatic
node.startup = automatic
and i manually edited /etc/iscsi/initiatorname.iscsi , added iqn number taken from server.Which is
InitiatorName=iqn.2017-02.com.example.kw:centos
restart service
# service iscsid restart
Do the discovery
# iscsiadm -m discovery –type sendtargets –portal 192.168.1.66
And finally Login to target
# iscsiadm -m node –targetname iqn.2017-02.com.example.kw:centos –portal 192.168.1.66 –login
After this , the newly added disk will be displayed under fdisk. Below is the syslog
Feb 7 14:08:51 ubuntu kernel: [89946.433408] scsi host4: iSCSI Initiator over TCP/IP
Feb 7 14:08:51 ubuntu kernel: [89946.693040] scsi 4:0:0:0: Direct-Access LIO-ORG ubuntu-iscsi 4.0 PQ: 0 ANSI: 5
Feb 7 14:08:51 ubuntu kernel: [89946.745641] sd 4:0:0:0: Attached scsi generic sg4 type 0
Feb 7 14:08:51 ubuntu kernel: [89946.746061] sd 4:0:0:0: [sdb] 993222656 512-byte logical blocks: (509 GB/474 GiB)
Feb 7 14:08:51 ubuntu kernel: [89946.748472] sd 4:0:0:0: [sdb] Write Protect is off
Feb 7 14:08:51 ubuntu kernel: [89946.748475] sd 4:0:0:0: [sdb] Mode Sense: 43 00 00 08
Feb 7 14:08:51 ubuntu kernel: [89946.749300] sd 4:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn’t support DPO or FUA
Feb 7 14:08:51 ubuntu kernel: [89946.771007] sd 4:0:0:0: [sdb] Attached SCSI disk
Feb 7 14:08:52 ubuntu iscsid: Connection9:0 to [target: iqn.2017-02.com.example.kw:centos, portal: 192.168.1.66,3260] through [iface: default] is operational now
Ambrose Edgett
This was an excellent blog post. Thank you so much for creating it.