[Bug 1922976] Re: iscsid fails to log out from target on shutdown

Christian Ehrhardt  1922976 at bugs.launchpad.net
Tue Apr 13 14:05:46 UTC 2021


The package has some tests that are meant to do iscsi root but can't be executed fully automated.
With those one can try iscsi-root rather easy (not really easy, but better than from scratch).

$ pull-lp-source open-iscsi
$ cd open-iscsi-2.1.3/
$ PATH=$PWD/debian/tests:$PATH
$ get-image hirsute.d hirsute
$ sudo ./debian/tests/patch-image --kernel=hirsute.d/kernel --initrd=hirsute.d/initrd hirsute.d/disk.img
$ tgt-boot-test -v hirsute.d/disk.img hirsute.d/kernel hirsute.d/initrd
# At this point this boots off the iscsi root and one can log in with ubuntu/passw0rd

This is using overlayroot like:
sda       8:0    0  2.2G  1 disk 
├─sda1    8:1    0  2.1G  1 part /media/root-ro
├─sda14   8:14   0    4M  1 part 
└─sda15   8:15   0  106M  1 part 

Mounted like:
/dev/sda1 on /media/root-ro type ext4 (ro,relatime)
tmpfs-root on /media/root-rw type tmpfs (rw,relatime,inode64)
overlayroot on / type overlay (rw,relatime,lowerdir=/media/root-ro,upperdir=/media/root-rw/overlay,workdir=/media/root-rw/overlay-workdir/_)

$ sudo iscsiadm -m session -P 1
Target: tgt-boot-test-SKWNjP (non-flash)
	Current Portal: 10.0.12.2:3260,1
	Persistent Portal: 10.0.12.2:3260,1
		**********
		Interface:
		**********
		Iface Name: default
		Iface Transport: tcp
		Iface Initiatorname: maas-enlist
		Iface IPaddress: 10.0.12.15
		Iface HWaddress: default
		Iface Netdev: default
		SID: 1
		iSCSI Connection State: LOGGED IN
		iSCSI Session State: LOGGED_IN
		Internal iscsid Session State: NO CHANGE

This is a transient setup, but it should run the same hooks shouldn't it?
In any case it does not have the same hang, the guest shuts down even it failing.
To be fair the finalrd has issues, but not a full hang.

...
[  OK  ] Reached target Power-Off.
Unexpected iSCSI Connection State, forcing iSCSI logout.
Logging out of session [sid: 1, target: tgt-boot-test-reTuhW, portal: 10.0.12.2,3260]
[  250.977777] sd-execu[1727]: /usr/lib/systemd/system-shutdown/open-iscsi.finalrd failed with exit status 141.
[  251.000668] reboot: Power down
xkvm returned 0 in 252s
cleaning up tgt mount tgt-boot-test-reTuhW


@Michael - do you think we need a R/W iSCSI root to experience the full hang that you reported?
@Michael - I tested Hirsute (21.04), which version did you run on (maybe it differs between them)?

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to open-iscsi in Ubuntu.
https://bugs.launchpad.net/bugs/1922976

Title:
  iscsid fails to log out from target on shutdown

Status in open-iscsi package in Ubuntu:
  Triaged

Bug description:
  When using an iSCSI root filesystem, the /usr/share/finalrd/open-
  iscsi.finalrd script runs an instance of iscsid, waits for iscsid to
  find the existing logged-in sessions, and then logs out from the iSCSI
  target.

  This currently fails because iscsid happens to call getpwuid() on UID
  0.  Within the finalrd there are no libnss_*.so libraries and no
  /etc/passwd file, so the getpwuid() call returns NULL.  This causes
  iscsid to report an error "peeruser_unix: unknown local user with uid
  0", and prevents iscsid from recovering the existent session.  The end
  result is that the open-iscsi.finalrd script waits for its maximum 30
  seconds and then fails to log out from the iSCSI target.

  The error message is most easily observed by modifying
  /usr/share/finalrd/open-iscsi.finalrd to run iscsid as "iscsid -f -d
  8".

  An example of a minimal workaround may be seen at
  https://github.com/ipxe/sanbootable/commit/30bc58ce013a4db6b6d3480e42d4dc42d927fc5f

  (Ubuntu 20.04)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/open-iscsi/+bug/1922976/+subscriptions



More information about the foundations-bugs mailing list