# [FreeNAS] Problem starting bareos-fd at boot



## guenterg (Sep 4, 2013)

Hi,

I'm new to FreeBSD and have troubles with starting bareos-fd at system startup. I'm using FreeNAS 9.1.1 which uses FreeBSD 9.1. I recently compiled Bareos on a FreeBSD 9.1 system and installed it in a jail on FreeNAS.

The problem now is that Bareos is not starting after a reboot. Here are the steps I did so far:

Add the following lines to /etc/rc.conf

```
bareos-fd_enable="YES"
bareos-sd_enable="YES"
```

Add the files bareos-fd and bareos-sd into /usr/local/etc/rc.d

```
#! /bin/sh
#
# bareos       This shell script takes care of starting and stopping
#              the bareos File daemon.
#
#  For Bareos release 12.4.4 (12 June 2013) -- freebsd
#
# PROVIDE: bareos-fd
#
. /etc/rc.subr
name="bareos-fd"
rcvar="bareos-fd_enable"
command="/opt/bareos/sbin/bareos-fd"
load_rc_config $name
run_rc_command "$1"
```

If I try to start it manually I get the following error:

```
# ./bareos-fd onestart
/etc/rc.conf: bareos-fd_enable=YES: not found
/etc/rc.conf: bareos-sd_enable=YES: not found
eval: bareos-fd_enable=YES: not found
./bareos-fd: WARNING: $bareos-fd_enable is not set properly - see rc.conf(5).
Cannot 'start' bareos-fd. Set bareos-fd_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'.
```
 
If I use the command to check rcvar I get the following error 


```
# service bareos-fd rcvar
/etc/rc.conf: bareos-fd_enable=YES: not found
/etc/rc.conf: bareos-sd_enable=YES: not found
/etc/rc.conf: bareos-fd_enable=YES: not found
/etc/rc.conf: bareos-sd_enable=YES: not found
# bareos-fd
#
bareos-fd_enable="-fd_enable"
# - -fd_enable_desc
#   (default: "-fd_enable_defval")
```
 
Any idea what I did wrong? Is it now allowed to user "-" in service names?

Regards*,*

GÃ¼nter


----------



## DutchDaemon (Sep 4, 2013)

Disclaimer: PC-BSD DesktopBSD *FreeNAS* NAS4Free m0N0WALL pfSense ArchBSD kFreeBSD JabirOS topics

Another FreeNAS topic? Is _anyone_ at the FreeNAS forums actually answering _any_ questions?


----------



## wblock@ (Sep 4, 2013)

(For those who are wondering: http://www.bareos.org/en/faq/items/why_fork.html.)


```
/etc/rc.conf: bareos-fd_enable=YES: not found
```

rc.conf is trying to execute that as a command rather than a variable assignment.  It does appear to be the use of the dash.


----------



## SirDice (Sep 4, 2013)

Yep, the rc(8) scripts do not like dashes in variables (it's a shell restriction actually). Change it to bareos_fd_enable and bareos_sd_enable and it should work.

Also note that you're not setting them to NO by default. 


```
: ${bareos_sd_enable:=NO}
: ${bareos_fd_enable:=NO}
```


----------



## Whattteva (Sep 4, 2013)

DutchDaemon said:
			
		

> Disclaimer: PC-BSD DesktopBSD *FreeNAS* NAS4Free m0N0WALL pfSense ArchBSD kFreeBSD JabirOS topics
> 
> Another FreeNAS topic? Is _anyone_ at the FreeNAS forums actually answering _any_ questions?


It doesn't look like he even created a question on the FreeNAS forums (I lurk on both forums). To be fair, this is a more general question not specific to FreeNAS. I don't think FreeNAS even comes with it.


----------



## guenterg (Sep 5, 2013)

Thanks for all your quick answers!

@DutchDaemon: As I said I'm new to FreeBSD. I didn't post it to the FreeNAS forum because I think it's not a FreeNAS problem. I think it's a problem of the shell which is implemented in FreeBSD. Or better I should say it's my problem of not knowing the shell very well. 

I'll try to replace "-" by "_".


----------



## guenterg (Sep 5, 2013)

Hi,

I replaced "-" with "_" and it's working now!

Thanks to @SirDice!


----------

