我有一个pyTargetiSCSI 目标。我可以使用 iPXE 连接到目标并安装 Ubuntu。但是,安装后,我无法启动映像。
pyTarget配置.xml:
<root>
<!-- configure target console -->
<console ip="" port="3260" debug_level="6" />
<!-- configure the first target -->
<target name="iscsi" ip="192.168.1.10" port="3260" portal="1">
<!-- the first iqn of this target configured for disk array -->
<host name="iqn.2006-11.1" target_pwd="" initiator_pwd="">
<lun id="0" type="0" path="E:\pyTarget\ubuntu16.ima" capacity="81943040" />
</host>
</target>
</root>
启动时 pyTarget 控制台:
INFO: pyTarget 1.5.7.1 2010-12-26
INFO: start iSCSI Service ...
INFO: start iSNS Service ...
INFO: initialize virtual device, please wait...
INFO: start Http Service ...
DEBUG: create target iscsi 192.168.1.10 3260 1
DEBUG: create host iqn.2006-11.1
DEBUG: target iscsi add host iqn.2006-11.1
DEBUG: Disk(E:\pyTarget\ubuntu16.ima) : initialize finish!
DEBUG: host iqn.2006-11.1 add lun 0.
DEBUG: configure target done
INFO: initialize finish, start to run ...
安装开始时:
DEBUG: create connect
INFO: initiator 192.168.1.15:38822 connect.
NEGOTIATION: SessionType = Discovery
NEGOTIATION: TargetName = iscsi
NEGOTIATION: InitiatorName = iqn.2006-11.1
DEBUG: create session 00023d000000-0001.
DEBUG: host iqn.2006-11.1 add session 00023d000000-0001.
INFO: SessionID: 00023d000000-0001
DEBUG: session 00023d000000-0001 add connect 0.
INFO: ConnectID: 0
NEGOTIATION: TargetPortalGroupTag = 1
NEGOTIATION: HeaderDigest = None
NEGOTIATION: DataDigest = None
NEGOTIATION: MaxRecvDataSegmentLength = 32768
NEGOTIATION: TargetMaxRecvdataLength = 65536
NEGOTIATION: ErrorRecoveryLevel = 0
NEGOTIATION: DefaultTime2Retain = 0
NEGOTIATION: DefaultTime2Wait = 2
NEGOTIATION: OFMarker = No
NEGOTIATION: IFMarker = No
DEBUG: connect 0 login finish
COMMAND: Text Request
DEBUG: session 00023d000000-0001 add connect 0.
DEBUG: host iqn.2006-11.1 remove session 00023d000000-0001.
DEBUG: destroy session 00023d000000-0001.
DEBUG: connect 0 finish.
DEBUG: create connect
DEBUG: destroy connect 0
INFO: initiator 192.168.1.15:38824 connect.
NEGOTIATION: SessionType = Discovery
NEGOTIATION: TargetName = iscsi
NEGOTIATION: InitiatorName = iqn.2006-11.1
DEBUG: create session 00023d000000-0002.
DEBUG: host iqn.2006-11.1 add session 00023d000000-0002.
INFO: SessionID: 00023d000000-0002
DEBUG: session 00023d000000-0002 add connect 0.
INFO: ConnectID: 0
NEGOTIATION: TargetPortalGroupTag = 1
NEGOTIATION: HeaderDigest = None
NEGOTIATION: DataDigest = None
NEGOTIATION: MaxRecvDataSegmentLength = 32768
NEGOTIATION: TargetMaxRecvdataLength = 65536
NEGOTIATION: ErrorRecoveryLevel = 0
NEGOTIATION: DefaultTime2Retain = 0
NEGOTIATION: DefaultTime2Wait = 2
NEGOTIATION: OFMarker = No
NEGOTIATION: IFMarker = No
DEBUG: connect 0 login finish
COMMAND: Text Request
DEBUG: session 00023d000000-0002 add connect 0.
DEBUG: host iqn.2006-11.1 remove session 00023d000000-0002.
DEBUG: destroy session 00023d000000-0002.
DEBUG: connect 0 finish.
DEBUG: create connect
DEBUG: destroy connect 0
INFO: initiator 192.168.1.15:38826 connect.
NEGOTIATION: SessionType = Normal
NEGOTIATION: TargetName = iscsi
NEGOTIATION: InitiatorName = iqn.2006-11.1
DEBUG: create session 00023d010000-0003.
DEBUG: host iqn.2006-11.1 add session 00023d010000-0003.
INFO: SessionID: 00023d010000-0003
DEBUG: session 00023d010000-0003 add connect 0.
INFO: ConnectID: 0
NEGOTIATION: TargetPortalGroupTag = 1
NEGOTIATION: TargetAlias = DESKTOP-54T1C9D
NEGOTIATION: HeaderDigest = None
NEGOTIATION: DataDigest = None
NEGOTIATION: MaxRecvDataSegmentLength = 65536
NEGOTIATION: TargetMaxRecvdataLength = 65536
NEGOTIATION: ErrorRecoveryLevel = 0
NEGOTIATION: DefaultTime2Retain = 0
NEGOTIATION: DefaultTime2Wait = 2
NEGOTIATION: OFMarker = No
NEGOTIATION: IFMarker = No
NEGOTIATION: MaxConnections = 1
NEGOTIATION: InitialR2T = Yes
NEGOTIATION: ImmediateData = Yes
NEGOTIATION: DataPDUInOrder = Yes
NEGOTIATION: DataSequenceInOrder = Yes
NEGOTIATION: MaxOutstandingR2T = 1
NEGOTIATION: MaxBurstLength = 262144
NEGOTIATION: FirstBurstLength = 65536
DEBUG: connect 0 login finish
COMMAND: SCSI Request
COMMAND: Inquiry LUN:0
COMMAND: SCSI Request
COMMAND: Inquiry LUN:0
COMMAND: SCSI Request
安装完成后我尝试启动映像:
COMMAND: SCSI Request
COMMAND: Write(10) LBA:0x1c40800 LEN:0x8 LUN:0
COMMAND: SCSI Request
COMMAND: Write(10) LBA:0x1c40800 LEN:0x8 LUN:0
COMMAND: SCSI Request
COMMAND: Write(10) LBA:0x1c40800 LEN:0x8 LUN:0
COMMAND: SCSI Request
COMMAND: Write(10) LBA:0x1c40800 LEN:0x8 LUN:0
COMMAND: SCSI Request
COMMAND: Write(10) LBA:0x800 LEN:0x8 LUN:0
COMMAND: SCSI Request
COMMAND: Test Unit Ready LUN:0
COMMAND: SCSI Request
COMMAND: Test Unit Ready LUN:0
# Install ends here
# Client restarts, attempts to boot to the new install:
DEBUG: create connect
INFO: initiator 192.168.1.15:30733 connect.
NEGOTIATION: SessionType = Normal
WARNING: initiator name or target name is INVAILD iqn.2006-11.1
DEBUG: connect 0 finish.
进入 iPXE shell 并尝试手动操作sanboot
,它会吐出更多信息 -这个错误:
(Error code 3c0d61)
This error originated from one of the following locations within the iPXE source code:
net/tcp/iscsi.c (line 1226)
This error indicates an unexpected status received from the iSCSI target.
Wireshark 具有以下功能:
客户端向主机发送iSCSI LOGIN
命令,主要内容如下:
Key/Value Pairs
KeyValue: InitiatorName=iqn.2006-11.1
KeyValue: TargetName=iqn.2006-11.1
KeyValue: SessionType=Normal
KeyValue: AuthMethod=CHAP,None
主机返回iSCSI LOGIN
响应,值得注意的内容:
Status: Missing parameter (0x0207)
简要讨论一下这个错误代码在此邮件列表中但我不够聪明,无法理解它的意义。
我不明白目标或启动器名称怎么会突然无效?也不明白缺少什么参数。连接实际上只是在使用中,安装过程中没有任何投诉......我甚至可以复制这一点 - 重新启动安装没有问题,并且再次顺利完成。重新安装后,当我尝试启动时出现同样的问题!
我注意到的一件事是,iSCSI 或 PXE 中的空密码有些奇怪。在 ubuntu 安装期间,为了完成 iSCSI 卷登录,我必须按一次空格键 - 它不接受 NULL 长度的密码,即使密码在配置中本质上为 NULL。
但是,在 iPXE 中无法输入 SPACE 作为密码 - 唯一的空白似乎被视为 NULL。initiator_pwd
但是,设置为非 NULL 似乎没有帮助。
我已经在这一点上卡了好几个小时了。我该如何进行更多故障排除?
编辑:忘记添加:
iPXE 配置:
#!ipxe
set iscsi-target iscsi:192.168.1.10::::iqn.2006-11.1
set gateway 0.0.0.0
set initiator-iqn iqn.2007-11.1
set keep-san 1
sanboot ${iscsi-target}
boot
新的 config.xml
<!-- configure the first target -->
<target name="iscsi" ip="192.168.1.10" port="3260" portal="1">
<!-- the first iqn of this target configured for disk array -->
<host name="iqn.2006-11.1" target_pwd="1" initiator_pwd="1"> # <-- Set passwords to avoid NULL problem, this comment was not part of the actual config
<lun id="0" type="0" path="E:\pyTarget\ubuntu16.ima" capacity="81943040" />
</host>
</target>
脚本失败后删除 iPXE shell:
1. dhcp
2. login
username: iscsi
password: 1
3. sanboot iscsi:192.168.1.10::::iqn.2006-11.1
新的数据包捕获:
iSCSI (Login Command)
Opcode: Login Command (0x03)
1... .... = T: Transit to next login stage
.0.. .... = C: Text is complete
.... 00.. = CSG: Security negotiation (0x0)
.... ..01 = NSG: Operational negotiation (0x1)
VersionMax: 0x00
VersionMin: 0x00
TotalAHSLength: 0x00
DataSegmentLength: 93 (0x0000005d)
ISID: 40002723b2f3
TSIH: 0x0000
InitiatorTaskTag: 0x18ae0002
CID: 0x0000
CmdSN: 0x00000000
ExpStatSN: 0x00000001
Key/Value Pairs
KeyValue: InitiatorName=iqn.2007-11.1
KeyValue: TargetName=iqn.2006-11.1
KeyValue: SessionType=Normal
KeyValue: AuthMethod=CHAP,None
Padding: 000000
iSCSI (Login Response)
Opcode: Login Response (0x23)
0... .... = T: Stay in current login stage
.0.. .... = C: Text is complete
.... 00.. = CSG: Security negotiation (0x0)
VersionMax: 0x00
VersionActive: 0x00
TotalAHSLength: 0x00
DataSegmentLength: 0 (0x00000000)
ISID: 40002723b2f3
TSIH: 0x0000
InitiatorTaskTag: 0x18ae0002
StatSN: 0x00000001
ExpCmdSN: 0x00000000
MaxCmdSN: 0x00000000
Status: Missing parameter (0x0207)
sanboot iscsi:192.168.1.10::::iscsi
在 wireshark 中返回Status: Authentication failed (0x0201)
并对应操作不允许 410d61在客户端控制台中。
pyTarget控制台:
DEBUG: create connect
DEBUG: destroy connect 0
INFO: initiator 192.168.1.15:1552 connect.
NEGOTIATION: SessionType = Normal
NEGOTIATION: TargetName = iscsi
WARNING: InitiatorName %s do not exist. iqn.2007-11.1
DEBUG: connect 0 finish.
答案1
最后一条错误消息让我大吃一惊。令人尴尬的是,我把名字弄反了:
在 iPXE shell 中:
set initiator-iqn iqn.2006-11.1
sanboot iscsi:192.168.1.10::::iscsi
现在我已经启动...
需要澄清的是,iPXE 配置如下所示:
#!ipxe
set iscsi-target iscsi:192.168.1.10::::iscsi
set gateway 0.0.0.0
set initiator-iqn iqn.2006-11.1
set keep-san 1
sanboot ${iscsi-target}
boot