GithubHelp home page GithubHelp logo

Comments (4)

gonzoleeman avatar gonzoleeman commented on July 30, 2024

I know the automatic login stuff works, so let's figure out why it's not working here.

First of all, which distribution is this? Where did you get the open-iscsi package you are using?

Next, it seems like you are mixing old-school and new-school methods for starting your service. Newer open-iscsi packages use systemd, which means (1) they do not use /etc/init.d scripts, and (2) you should never set the "iscsid.startup = /some/path/to/iscsid". That is because systemd does all the starting/stopping/restarting for you.

Assuming you are using systemd, what systemd services to you have for iscsi? I see you have ran "systemctl start open-iscsi.service". Are there any others? (Run "ls /usr/lib/systemd/system/iscsi" as root.) I'm trying to understand if your open-iscsi is socket-activated or not.

Lastly, just as a guess, I never say that you ran "systemctl enable open-iscsi.service". This tells sytemd to start your service at boot time, whereas "systemctl start open-iscsi.service" just starts it up right now.

from open-iscsi.

myghacc avatar myghacc commented on July 30, 2024

Distribution is Mageia 6 64-bit with open-iscsi from their repositories.

I deleted everything in /var/lib/iscsi and uninstalled open-iscsi. After that I created a new interface with iscsiadm (iscsiadm -m iface -I icebox --op=new) and re-installed open-iscsi. Then I did a discovery with iscsiadm (iscsiadm --mode discovery --type sendtargets --portal 192.168.10.10 --discover) and checked that the portal I want to use is set to automatic (cat nodes/iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1/192.168.10.10,3260,0/icebox | grep automatic). Finally I rebooted the system. The following output I get after the reboot:

[root@thalamus_nfs iscsi]# systemctl status open-iscsi.service
● open-iscsi.service - Open iSCSI Daemon
Loaded: loaded (/usr/lib/systemd/system/open-iscsi.service; enabled; vendor preset: enabled)
Active: active (running) since Di 2017-12-19 08:25:06 CET; 5min ago
Process: 2868 ExecStart=/sbin/iscsid (code=exited, status=0/SUCCESS)
Process: 2808 ExecStartPre=/usr/sbin/modprobe -q iscsi_tcp (code=exited, status=0/SUCCESS)
CGroup: /system.slice/open-iscsi.service
├─2872 /sbin/iscsid
└─2873 /sbin/iscsid

Dez 19 08:25:06 thalamus_nfs systemd[1]: Starting Open iSCSI Daemon...
Dez 19 08:25:06 thalamus_nfs systemd[1]: Started Open iSCSI Daemon.
Dez 19 08:25:07 thalamus_nfs iscsid[2872]: transport class version 2.0-870. iscsid version 2.0-872
Dez 19 08:25:07 thalamus_nfs iscsid[2872]: iSCSI daemon with pid=2873 started!
[root@thalamus_nfs iscsi]# pwd
/var/lib/iscsi
[root@thalamus_nfs iscsi]# tree
.
├── ifaces
│   └── icebox
├── nodes
│   └── iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1
│   ├── 192.168.10.10,3260,0
│   │   └── icebox
│   ├── 192.168.20.10,3260,0
│   │   └── icebox
│   ├── 192.168.3.1,3260,1
│   │   └── icebox
│   └── 192.168.4.1,3260,1
│   └── icebox
└── send_targets
└── icebox_iscsi_1,3260
├── iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1,192.168.10.10,3260,0,icebox -> /var/lib/iscsi/nodes/iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1/192.168.10.10,3260,0
├── iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1,192.168.20.10,3260,0,icebox -> /var/lib/iscsi/nodes/iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1/192.168.20.10,3260,0
├── iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1,192.168.3.1,3260,1,icebox -> /var/lib/iscsi/nodes/iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1/192.168.3.1,3260,1
├── iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1,192.168.4.1,3260,1,icebox -> /var/lib/iscsi/nodes/iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1/192.168.4.1,3260,1
└── st_config

13 directories, 6 files
[root@thalamus_nfs iscsi]# ls /usr/lib/systemd/system/iscsi
ls: Zugriff auf '/usr/lib/systemd/system/iscsi' nicht möglich: Datei oder Verzeichnis nicht gefunden
[root@thalamus_nfs iscsi]#

I can somehow solve this problem with a self-written systemd service. But still I am wondering why the missing step is not done automatically although open-iscsi daemon is running.

login-iscsi.service:

[Unit]
Description=Login into ISCSI portal
Requires=network.target open-iscsi.service
After=network.target open-iscsi.service

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/usr/sbin/iscsiadm --mode node --targetname iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1 --portal 192.168.10.10:3260 --login
ExecStartPost=/usr/sbin/vgchange -a y

ExecStop=/usr/sbin/iscsiadm --mode node --targetname iqn.2010-08.eu.n-tec:icebox-rix6r-000905600:dev0.ctr1 --portal 192.168.10.10:3260 --logout

[Install]
WantedBy=multi-user.target

from open-iscsi.

gonzoleeman avatar gonzoleeman commented on July 30, 2024

I think I understand your issue. You need an "iscsi login/logout" service. In the distributions that I've looked at, there are generally 3 systemd unit files for iscsi:

  1. a "socket" file (e.g. "iscsid.socket"), which allows "socket activation" of the next service if somebody tries to talk to it
  2. an "iscsid service" file (e.g. "iscsid.service"), which controls the starting and stopping of the iscsid daemon, and
  3. an "iscsi login" file (e.g. "iscsi.service"), which controls starting and stopping "sessions" (i.e. logging into and out of targets)

The example names I gave are from openSUSE.

It is unfortunate that these files are not part of the open-iscsi distribution, but the problem is that these sets of services are implemented differently for each distribution, so their only value to others is as an example. And there's not much motivation to keep examples up to date.

Here is the "iscsi.service" file for openSUSE Leap 42.2:

[Unit]
Description=Login and scanning of iSCSI devices
Documentation=man:iscsiadm(8) man:iscsid(8)
After=network.target network-online.target iscsid.service
ConditionPathExists=/etc/iscsi/initiatorname.iscsi

[Service]
Type=oneshot
ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
ExecStop=/sbin/iscsiadm -m node --logoutall=manual
SuccessExitStatus=21
RemainAfterExit=true

[Install]
WantedBy=remote-fs.target

from open-iscsi.

myghacc avatar myghacc commented on July 30, 2024

Thank you. I informed the Mageia bug team about this issue. Since it is working for me now I will close this issue.

from open-iscsi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.