启动时启动 open-iscsi (systemd)

启动时启动 open-iscsi (systemd)

我在使用 Debian 8,我对 Linux 了解不多,而且我上次使用它是在很久以前(当时 systemd 还不存在)。

当我手动启动 open-iscsi 服务时,iSCSI 驱动器可以毫无问题地连接到机器(在 /dev/sdb 上)

现在我正尝试将其添加到启动周期。

因此,我确保已启用 open-iscsi 服务systemctl enable open-iscsi.service。当我启动时,我没有看到有关该服务的任何日志。 service open-iscsi status返回我Active: inactive (dead),经过一番搜索,这可能意味着没有人需要它,所以它没有启动。

所以现在我尝试编辑 /etc/fstab 来添加挂载并让 systemd-fstab-generator 生成单元。

我尝试了几种组合,在日志中得到的最佳情况是

mar 17 13:57:45 vm-sdbox5 systemd[1]: Reached target Network is Online.
.... (removed) ....
mar 17 13:59:03 vm-sdbox5 systemd[1]: Job dev-sdb1.device/start timed out.
mar 17 13:59:03 vm-sdbox5 systemd[1]: Timed out waiting for device dev-sdb1.device.
mar 17 13:59:03 vm-sdbox5 systemd[1]: Dependency failed for /mnt/iscsi/zvol.
mar 17 13:59:03 vm-sdbox5 systemd[1]: Dependency failed for Remote File Systems.
mar 17 13:59:03 vm-sdbox5 systemd[1]: Dependency failed for File System Check on /dev/sdb1.

仍然没有 open-iscsi 的踪迹。

我尝试过的 fstab 示例我记得:

/dev/sdb1       /mnt/iscsi/zvol        ext4    defaults,x-systemd.requires=open-iscsi.service,x-systemd.wants=open-iscsi.service,_netdev 0 3
/dev/sdb1       /mnt/iscsi/zvol        ext4    defaults,x-systemd.requires=open-iscsi.service,_netdev 0 3
/dev/sdb1       /mnt/iscsi/zvol        ext4    defaults,x-systemd.requires=open-iscsi.service,x-systemd.after=network-online.target 0 3
/dev/sdb1       /mnt/iscsi/zvol        ext4    defaults,noauto,x-systemd.requires=open-iscsi.service,x-systemd.wants=open-iscsi.service,_netdev 0 3

并通过删除一些参数来实现其他一些不同的组合

我有问题要找到单元生成的位置(仔细检查systemd-fstab-generator)以确保我的参数确实被使用,并在其中找到它们systemctl list-dependencies

谢谢

编辑:

返回者systemctl show open-iscsi

Restart=no
NotifyAccess=none
RestartUSec=100ms
TimeoutStartUSec=0
TimeoutStopUSec=0
WatchdogUSec=0
WatchdogTimestampMonotonic=0
StartLimitInterval=10000000
StartLimitBurst=5
StartLimitAction=none
FailureAction=none
PermissionsStartOnly=no
RootDirectoryStartOnly=no
RemainAfterExit=yes
GuessMainPID=no
MainPID=0
ControlPID=0
Result=success
ExecMainStartTimestampMonotonic=0
ExecMainExitTimestampMonotonic=0
ExecMainPID=0
ExecMainCode=0
ExecMainStatus=0
ExecStart={ path=/etc/init.d/open-iscsi ; argv[]=/etc/init.d/open-iscsi start ;$
ExecStop={ path=/etc/init.d/umountiscsi.sh ; argv[]=/etc/init.d/umountiscsi.sh $
ExecStop={ path=/etc/init.d/open-iscsi ; argv[]=/etc/init.d/open-iscsi stop ; i$
Slice=system.slice
CPUAccounting=no
CPUShares=18446744073709551615
StartupCPUShares=18446744073709551615
CPUQuotaPerSecUSec=(null)
BlockIOAccounting=no
BlockIOWeight=18446744073709551615
StartupBlockIOWeight=18446744073709551615
MemoryAccounting=no
MemoryLimit=18446744073709551615
DevicePolicy=auto
UMask=0022
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=4096
LimitAS=18446744073709551615
LimitNPROC=5792
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=5792
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=journal
StandardError=inherit
TTYReset=no
TTYVHangup=no
TTYVTDisallocate=no
SyslogPriority=30
SyslogLevelPrefix=yes
SecureBits=0
CapabilityBoundingSet=18446744073709551615
MountFlags=0
PrivateTmp=no
PrivateNetwork=no
PrivateDevices=no
ProtectHome=no
ProtectSystem=no
SameProcessGroup=no
IgnoreSIGPIPE=no
NoNewPrivileges=no
SystemCallErrorNumber=0
RuntimeDirectoryMode=0755
KillMode=process
KillSignal=15
SendSIGKILL=yes
SendSIGHUP=no
Id=open-iscsi.service
Names=open-iscsi.service
Wants=network-online.target remote-fs-pre.target system.slice
WantedBy=sysinit.target
Conflicts=shutdown.target
Before=sysinit.target shutdown.target remote-fs-pre.target
After=network-online.target local-fs.target mountnfs-bootclean.service systemd-journald.sock$
Description=LSB: Starts and stops the iSCSI initiator services and logs in to default targets
LoadState=loaded
ActiveState=inactive
SubState=dead
FragmentPath=/run/systemd/generator.late/open-iscsi.service
SourcePath=/etc/init.d/open-iscsi
DropInPaths=/lib/systemd/system/open-iscsi.service.d/fix-systemd-deps.conf
InactiveExitTimestampMonotonic=0
ActiveEnterTimestampMonotonic=0
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=no
OnFailureJobMode=replace
IgnoreOnIsolate=no
IgnoreOnSnapshot=no
NeedDaemonReload=yes
JobTimeoutUSec=0
ConditionResult=no
ConditionTimestampMonotonic=0
Transient=no

find /etc/ -name *open-iscsi*(使用 ls -al)

lrwxrwxrwx 1 root root 20 mar 16 22:12 /etc/rcS.d/S17open-iscsi -> ../init.d/open-iscsi
-rwxr-xr-x 1 root root 6494 mar 16 23:28 /etc/init.d/open-iscsi
lrwxrwxrwx 1 root root 20 mar 16 22:12 /etc/rc6.d/K02open-iscsi -> ../init.d/open-iscsi
lrwxrwxrwx 1 root root 20 mar 16 22:12 /etc/rc0.d/K02open-iscsi -> ../init.d/open-iscsi
lrwxrwxrwx 1 root root 20 mar 16 22:12 /etc/rc1.d/K02open-iscsi -> ../init.d/open-iscsi

答案1

检查是否node.startup = automatic存在/etc/iscsi/iscsid.conf

相关内容