Solved ISCSI ctld service does not start at time jail start

I have a jail in FreeBSD I have set up to host iSCSI targets with the default daemon ctld(8).

In /etc/rc.conf I have the line
Code:
ctld_enable="YES"

When I start the jail or when the jail starts at boot with the Warden, this service does not start automatically.

I can ssh into the jail and it starts as expected manually however.

I suspect it's something I have missed doing and doubt additional services I would add in jails I may create would not start automatically either.

What I have I missed here?
 
Does it actually work? /etc/rc.d/ctld has the following lines at the top and the 'nojail' keyword would indicate that it doesn't or shouldn't work in a jail.
Code:
# PROVIDE: ctld
# REQUIRE: FILESYSTEMS
# BEFORE:  DAEMON
# KEYWORD: nojail
 
So on the host FreeBSD system, I load the kernel module.

Then in the jail, I set up and configure the CTL settings.

Then back at the host level again, I configure zfs datasets down in the jail, snapshots, etc.

It has been working fine, just not starting with the jail :(
 
Ah, I have solved it now, but your post gave me the idea.

In the file /etc/rc.d/ctld, I removed the nojail comment line, then it started with the jail.

Code:
root@rc-prod-infra-nas01.dresdencraft.com:/root
# service ctld status
ctld is running as pid 33983.

root@rc-prod-infra-nas01.dresdencraft.com:/root
# ps aux | grep ctl | grep -v grep
root  33983  0.0  0.0 27540 4636  -  IsJ  8:23PM 0:00.00 /usr/sbin/ctld

root@rc-prod-infra-nas01.dresdencraft.com:/root
# cat /etc/rc.d/ctld
#!/bin/sh
#
# $FreeBSD: releng/10.1/etc/rc.d/ctld 255570 2013-09-14 15:29:06Z trasz $
#

# PROVIDE: ctld
# REQUIRE: FILESYSTEMS
# BEFORE:  DAEMON

. /etc/rc.subr

name="ctld"
rcvar="ctld_enable"
pidfile="/var/run/${name}.pid"
command="/usr/sbin/${name}"
required_files="/etc/ctl.conf"
required_modules="ctl"
extra_commands="reload"

load_rc_config $name
run_rc_command "$1"

root@rc-prod-infra-nas01.dresdencraft.com:/root
#
 
The CTL iSCSI service is built into the kernel. As jails share a kernel, it probably doesn't go down well if you try and run the service in multiple jails at the same time, which is probably why it's flagged by default to not run in a jail. I'm not a kernel dev but I guess you'll probably be ok if it's working and you only plan to have one jail running it.
 
Consider sending out a request on freebsd-fs@FreeBSD.org for more information on if there are any unintended side effects. I won't argue that it works, but the "nojail" keyword was hopefully there for a good reason and a customization like this could cause trouble in the future.
 
Basically yes. If you aren't too familiar with mailing lists in general then you may want to check out some info on it before hand. For one, general etiquette rules:
https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/mailing-list-faq/etiquette.html

You'll likely want to search for if anyone else asked the question in the past either by looking at the archives or using your favorite search engine.
https://lists.FreeBSD.org/pipermail/freebsd-fs/

And if you have a vested interest in anything in the future, you may want to sign up for that list here.
https://lists.FreeBSD.org/mailman/listinfo

All the discussion on ISCSI along with most of the posts by it's developer in my mail box was in the file system lists so that is what I suggested. The -net mailing list may be appropriate as well.
 
Realize also that the FreeBSD mailing lists are public and do not hide email addresses. That surprises some people.
 
Back
Top