Premise: This is a cross-post from serverfault where this question has
non received any answer.
https://serverfault.com/questions/1168219/debian-as-iscsi-initiator-on-boot
I have a Debian GNU/Linux 12 virtual machine (amd64) that should mount
this iSCSI volume on boot.
Following this guide [1] the iscsiadm command did everything it was
supposed to do and I was able to manually mount the volume. However the
iscsiadm --mode node --targetname "..." --portal "...:3260"
command placed the initiator configuration files under
/var/lib/iscsi/...
and not under /etc/iscsi. I'm not sure that's the problem, but on reboot
the server did not initiate the iSCSI connection and it did not mount
the volume.
I then copied /var/lib/iscsi/* to /etc/iscsi/ and it started working on
boot too. For a while. Today it stopped after a reboot without any
obvious reason (not obvious to me at least).
Using apt I noticed there was an open-iscsi update available from sid
(version 2.1.10-2 while I had 2.1.10-1 installed) and I tried to install
that, which resumed my iSCSI connection without editing anything.
However the changelog for that new version states it only adds support
for the riscv64 arch, which I do not have.
Upon inspecting the situation, I see that the /var/lib/iscsi/nodes
directory was touched during the package upgrade (I don't understand
why), while the /etc/iscsi/nodes directory was not (I do understand
why). However the contents of both directories were still the same
(rsync -rcnv /var/lib/iscsi/nodes/ /etc/iscsi/nodes/ showed nothing to
sync).
Rebooting the server once again, the iSCSI connection did resume
correctly, but I'm not sure I can trust this situation. Looking for
errors around the time it failed before, using journalctl | grep -i
iscsi, does not bring up any error messages except:
nov 27 10:46:32 adh systemd[1]: iscsid.service: Failed to parse PID from
file /run/iscsid.pid: Invalid argument
which is followed by a correct initiator startup anyway (at least from
the logs point of view, but in reality it was not working).
Is manually copying the contents of /var/lib/iscsi directory under
/etc/iscsi/ the correct, though undocumented, way to go? Or is there
anything else/different to do in order to make the system reliably
create the iSCSI device on boot?
[1] https://wiki.debian.org/SAN/iSCSI/open-iscsi