# rc.subr weirdness post 8.1R-8.2R upgrade



## quillo (Jun 10, 2011)

Hi all,

I'm having the following error appear whenever I try to interact with any services:


```
/etc/rc.d/<anything>: WARNING: $XXX is not set properly - see rc.conf(5).
Cannot 'status' <anything>. Set XXX to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
```

Replace <anything> with any service. It returns the same error and fails to start the service. Using 'onestart/onestop/onestatus/etc' works fine, so I am able to work around the problem to an extent although startup and shutdown is also affected, so I'm worried services won't be shutdown gracefully (and they all have to be started manually at boot).

I've looked around for a solution to this problem but I'm not having much luck. The only mention of this error is an old DragonFlyBSD mailing list post.

Looking at /etc/rc.subr, I'm going to assume that ${OSTYPE} is either undefined or invalid however I am unsure as to how I can test this theory further, as my shell script knowledge is pretty poor. I haven't tried changing the default condition of that particular case as I'm pretty confident something else is decently broken.

The problem itself has only occurred after I upgraded from 8.1-RELEASE to 8.2-RELEASE and freebsd-update required me to manually merge quite a few changes. It's possible that I have left a typo or weird characters in a configuration file somewhere, but I'm not really sure where to start looking (I did to some grep's for some of the lines that I saw in the merged files when manually updating them without and results).

Any assistance on this would be greatly appreciated.


----------



## mix_room (Jun 14, 2011)

What does you /etc/rc.conf look like? The error message tells you that you have to add something to this file. Perhaps it got destroyed in the upgrade process. 

Mine looks something like 



```
sshd_enable="YES"
hald_enable="YES"
dbus_enable="YES"
ntpd_enable="YES"
```

Edit: Actually READING the error messages is usually a good place to start. In this case it explicitly tells you how to solve your problem.


----------



## quillo (Jun 20, 2011)

Worked a treat, thanks 

I didn't think to try just adding 
	
	



```
XXX_enable="true"
```
 as it just seemed like a generic error.


----------



## Victor (Jul 13, 2011)

I added XXX="YES" to my rc.conf as you did, but that only compounded my problems tenfold - it caused *every service* to start. Which is not something I want.


----------



## quillo (Jul 13, 2011)

Victor said:
			
		

> I added XXX="YES" to my rc.conf as you did, but that only compounded my problems tenfold - it caused *every service* to start. Which is not something I want.



I ended up having the same issue, so I reverted to XXX="NO" and just manually start everything with onestart.

Not sure exactly what got hosed during the upgrade but I'm considering just waiting it out and doing a fresh install once 9-STABLE is released.


----------



## wblock@ (Jul 13, 2011)

Vague language isn't helping here.  What does "interact with" mean, exactly?  Show the exact command used.  Rather than a generic message, post the exact one seen.

It could be a misunderstanding of how the rc scripts work, or user error starting a service, or a mismerge of /etc/rc.d.


----------



## quillo (Jul 15, 2011)

wblock said:
			
		

> Vague language isn't helping here.  What does "interact with" mean, exactly?  Show the exact command used.  Rather than a generic message, post the exact one seen.
> 
> It could be a misunderstanding of how the rc scripts work, or user error starting a service, or a mismerge of /etc/rc.d.



Hi wblock,

I was simply trying to perform service start/stop/restart/status. I have since resolved the issue by copying rc.subr from an 8.2R jail that was working fine, so it was likely just a bad merge during the upgrade.

MD5 of good rc.subr = a2bcbfda00906bf821350ec89ce1df60
MD5 of bad rc.subr = fcca89dae38d64143fc0356d9e2ddf26


Below are some examples for anyone else that might have this issue:

```
[root@blah ~]# service nrpe2 stop  
/usr/local/etc/rc.d/nrpe2: WARNING: $XXX is not set properly - see rc.conf(5).
Cannot 'stop' nrpe2. Set XXX to YES in /etc/rc.conf or use 'onestop' instead of 'stop'.
[root@blah ~]# service nrpe2 start
/usr/local/etc/rc.d/nrpe2: WARNING: $XXX is not set properly - see rc.conf(5).
Cannot 'start' nrpe2. Set XXX to YES in /etc/rc.conf or use 'onestart' instead of 'start'.
[root@blah ~]# service ntpd restart
/etc/rc.d/ntpd: WARNING: $XXX is not set properly - see rc.conf(5).
Cannot 'restart' ntpd. Set XXX to YES in /etc/rc.conf or use 'onerestart' instead of 'restart'.
[root@blah ~]# service sshd status
/etc/rc.d/sshd: WARNING: $XXX is not set properly - see rc.conf(5).
Cannot 'status' sshd. Set XXX to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
```

Using one{status,start,stop,restart} works fine:

```
[root@blah ~]# service nrpe2 onerestart
Stopping nrpe2.
Waiting for PIDS: 2256.
Starting nrpe2.
[root@blah ~]#
```

Weirdly it seems to work for Samba:

```
[root@blah ~]# service samba stop
Stopping winbindd.
Waiting for PIDS: 1935.
Stopping smbd.
Waiting for PIDS: 1931.
Stopping nmbd.
Waiting for PIDS: 1927.
[root@blah ~]# service samba start
Removing stale Samba tdb files: ......... done
Starting nmbd.
Starting smbd.
Starting winbindd.
[root@blah ~]#
```


----------

