# ntp missing a rc.d file



## Alain De Vos (Nov 28, 2021)

Comparing the port ntp versus the port postgresql.

pkg info -l postgresql13-server | grep rc.d  returns :
/usr/local/etc/rc.d/postgresql
So you can start this service in the location /usr/local/etc/rc.d

pkg info -l net/ntp | grep rc.d returns nothing.
There is no rc.d file located in /usr/local/etc/rc.d or service you can start there

This is strange ?


----------



## covacat (Nov 28, 2021)

can't you use ntpd_program in /etc/rc.conf and use system rc.d/ntpd?


----------



## mark_j (Nov 28, 2021)

Re-view the pkg information it will tell you what to do. Ie pkg info -D:
For install:
Please add   
ntpd_program="/usr/local/sbin/ntpd"    
ntpdate_program="/usr/local/sbin/ntpdate" to your /etc/rc.conf 
or run    
sysrc ntpd_program="/usr/local/sbin/ntpd"   
sysrc ntpdate_program="/usr/local/sbin/ntpdate" 
to enable ntp from ports/packages instead of base ntp.


----------



## mer (Nov 28, 2021)

Keep in mind that at least in FreeBSD-13 ntpd is in base (ntpd lives in /usr/sbin), so there is a default init file in /etc/rc.d.
A side effect of it being in base is that it does not show up in pkg info commands.

Now if you look in /usr/ports/net there are a few different variations of ntp (I like openntpd when you are needing a client);  if you install one of those, then it'll show up in pkg info.

As for the rc.d file if you install a port?  Perhaps the port does not install in /usr/local, maybe it installs over base in /usr.  If so then the base rc.d works.


----------



## Alain De Vos (Nov 28, 2021)

I finally did this

```
sysrc ntpd_program="/usr/local/sbin/ntpd"
sysrc ntpdate_program="/usr/local/sbin/ntpdate"
rm /etc/ntp.conf
ln -s /etc/ntp.conf /usr/local/etc/ntp.conf
```
And as ntp was continously crashing i had to use sysctl

```
kern.elf64.aslr.stack_gap=0
```


----------



## grahamperrin@ (Nov 28, 2021)

mer said:


> … a default init file in /etc/rc.d. …




```
% service -e | grep ntp
/etc/rc.d/ntpd
% uname -KU
1400041 1400041
%
```


----------



## mer (Nov 28, 2021)

Thanks grahamperrin I haven't been following 14 and pkg base stuff so was simply hedging my bets 
Alain De Vos 
crashing/sysctl looks like there is an interaction between aslr and the ntp code.
The "ln -s"  you should not need to nor want to do that.  If you do the following you can undo that symlink:
sysrc ntpd_config="/usr/local/etc/ntp.conf"

You can find out possible variables by doing 
grep -i ntp /etc/defaults/rc.conf


----------

