This is a follow up of the problem described in Troubleshooting iSCSI shutdown in OL 7.6. As it turns out however, or so it appears, the problem that there is no iSCSI session logout at system shutdown isn't because of a failure unmounting /u01. Even with a successful unmount, which is a problem of oracle-ohasd and afd driver locking the filesystem, the iSCSI logout issue still persists.
PID 1 is replaced by the /usr/lib/systemd/systemd-shutdown tool which is then responsible for the actual shutdown. Before shutting down, this binary will try to unmount all remaining file systems, disable all remaining swap devices, detach all remaining storage devices and kill all remaining processes.
You can actually drop in at a pre-shutdown shell to examine the situation:
My guess is that the OS performed a switch_root during shutdown using initramfs (?).
Anyway, there are no external filesystems mounted except the previous root filesystem in /oldroot. It is however read-only. Interesting also, the /u01 filesystem was unmounted despite a previous unmount failure. So how did the OS get rid of it? Killing the mount, regardless?
The iSCSI session for the root volume (/oldroot) is still running. I can however log out the iSCSI session after executing "iscid":
Reading the following in the dracut man page:
Immediately before executing the actual system halt/poweroff/reboot/kexec systemd-shutdown will run all executables in /usr/lib/systemd/system-shutdown/
This however needs to be a binary with an exec header, not a script:
The above message appears right before dropping in the pre-shutdown console. From what I can gather however, this is only telling about a format error, but not executing anything.
So I did the following:
I can't tell if this is the right solution, but it works.