# Samba AD DC on FreeBSD-12.1p4 in iocage jail



## byrnejb (May 4, 2020)

FreeBSD-12.1p4 root on zfs.  Iocage thick jail also at 12.1p4.  Samba-4.10.15

I am trying to provision a samba dc inside a jail.  I am aware of and have referenced https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239105.  Specifically, I have applied this patch and rebuilt samba410-4.10.15 from the ports tree.  My provisioning command is:


```
samba-tool domain provision \
  --adminpass=INstall66 \
  --dns-backend=BIND9_DLZ \
  --dnspass=INstall66 \
  --domain=BROCKLEY-2016 \
  --host-name=SAMBA-02.BROCKLEY-2016.HARTE-LYNE.CA \
  --host-ip=192.168.8.66 \
  --option="bind interfaces only=yes" \
  --option="interfaces=lo eth0" \
  --option="vfs objects"="dfs_samba4 zfsacl" \
  --realm=BROCKLEY-2016.HARTE-LYNE.CA \
  --server-role=dc   --use-rfc2307
```
_I have also tried this with --option="vfs objects"="freebsd"_

The result is always the same:

```
INFO 2020-05-04 14:13:41,196 pid:59770 /usr/local/lib/python3.7/site-packages/samba/provision/__init__.py 
  #1571: Setting up self join

  set_nt_acl_no_snum: fset_nt_acl returned NT_STATUS_INVALID_PARAMETER.
ERROR(runtime): uncaught exception - (3221225485, 'An invalid parameter was passed to a service or function.')

  File "/usr/local/lib/python3.7/site-packages/samba/netcmd/__init__.py", line 185, in _run
    return self.run(*args, **kwargs)
```

Is it possible to get samba-4.10 to provision a DC inside a FreeBSD jail?  Others seem to have reported that this can be done.  But, I cannot seem to manage it.


----------



## byrnejb (May 5, 2020)

I am confused.   I rebuilt the package putting a tracer in make.conf to ensure that the right pkg was ultimately installed. I moved to the jail, removed the existing samba4120, added the custom package, cleaned out smb4.conf, and re-provisioned. And it worked.  There  were only two changes made from all the previous trials, adding the tracer (added misc to the list of categories) and removed smb4.conf before provisioning (which I did in most of the other trials, but not all).

However, when writing this up I discovered a typo in make.conf:

```
# cat /usr/local/etc/poudriere.d/make.conf
.if ${.CURDIR:M*/net/samba410}
CATEGORIES?=                    net misc
EXTRA_PATCHES+= /distfiles/local-patchs/net/samba410/patch-bfs-provisioning:-p1
.endif
```

as shown in the log:


```
# grep bfs /usr/local/poudriere/data/logs/bulk/freebsd_12-1x64-PORTS-12-1/2020-05-05_09h37m30s/logs/samba410-4.10.15.log
EXTRA_PATCHES+= /distfiles/local-patchs/net/samba410/patch-bfs-provisioning:-p1
===>  Applying extra patch /distfiles/local-patchs/net/samba410/patch-bfs-provisioning with -p1
cat: /distfiles/local-patchs/net/samba410/patch-bfs-provisioning: No such file or directory
```

Which means that the pkg was rebuilt without the patch being applied.  However, it appears that the source file in the ports tree is not the same version as the pkg (.13 v. .15) so I infer that the patch is no longer needed for the present version of the port.


----------

