0

My interesting problem is that when running some rc.d scripts they do not actually drop back to the root shell, but leave me at an intermediate shell as the user they're supposed to be running as.

A side effect is that the desired service doesn't actually start until I exit from this inner shell. See below:

[root@zeb2 /usr/local/etc/rc.d]# ./mysql-server start Starting mysql. [mysql@zeb2 /usr/local/etc/rc.d]$ ps ax |grep mysql 3352 0 S 0:00.01 /bin/sh ./mysql-server start 3357 0 S 0:00.01 su -m mysql -c sh -c "/usr/sbin/daemon -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysq 3358 0 S 0:00.01 _su -m -c sh -c "/usr/sbin/daemon -c -f /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my. 3364 0 R+ 0:00.00 grep mysql [mysql@zeb2 /usr/local/etc/rc.d]$ exit exit [root@zeb2 /usr/local/etc/rc.d]# ps ax |grep mysql 3366 ?? Ss 0:00.02 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/d 3636 ?? S 0:00.13 [mysqld] 3639 0 S+ 0:00.00 grep mysql [root@zebes2 /usr/local/etc/rc.d]# 

It's almost like there is some wierdness with the su command that is the problem. This doesn't happen on every port I've installed, but happens for both MySQL and SABNzbd. This also causes a problem if the server needs to reboot and I've left the service enabled in rc.conf as it will enter the inner shell and hang the boot until I can login locally and type exit.

[root@zeb2 /usr/local/etc/rc.d]# uname -a FreeBSD xxx.xxx.xxx.net 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 01:47:53 UTC 2012 [email protected]:/usr/obj/usr/src/sys/GENERIC i386 

Updated with rc.conf output below

[root@zeb2 /usr/bin]# cat /etc/rc.conf |grep -v '#' syslogd_flags="-a dd-wrt.om.cox.net:* -vv" sshd_enable="YES" ifconfig_em0="inet 192.168.1.3 netmask 255.255.255.0" defaultrouter="192.168.1.1" hostname="zeb2.om.cox.net" webmin_enable="YES" samba_enable="YES" uuidd_enable="YES" denyhosts_enable="YES" inetd_enable="YES" mysql_enable="YES" 

Update 2 with outputs requested

Output of sh -x mysql-server start

Package List

Contents of mysql-server

Update 3 with answer!

@Steve Wills got me looking in the right direction. The ultimate cause was because I was invoking the bash shell from the end of .cshrc for the root account. This file must get parsed when running su through the rc.d scripts and the added reference to another shell explains why it would sit and wait for me to exit. After removing the reference, the rc.d scripts began working as expected.

Thanks!!

2 Answers 2

3

Can you share your /etc/rc.conf and/or /etc/rc.conf.local? Perhaps there's something in there that you've set that's causing this. Also, try running it as "service mysql-server start" and see if the same thing happens?

11
  • rc.conf added, no rc.conf.local on my system Commented Mar 3, 2013 at 7:19
  • running 'service mysql-server start' gave me the same exact behavior, I've got to quit the inner shell to get it to complete.. Commented Mar 3, 2013 at 7:21
  • I was asking that you share the contents of the rc.conf to check for anything odd there. Commented Mar 3, 2013 at 20:41
  • I already updated my question above with the rc.conf contents Commented Mar 4, 2013 at 0:04
  • 1
    And there's your problem. Don't do that. Don't change root's shell. Don't use root's shell. Use your own shell and sudo. Commented Mar 6, 2013 at 16:41
-1

The su(1) command changes into the user given or runs the command given as the given user. Without looking at the script, there is no way of knowing what is going on. Presumably the script just doesn't end, or keeps around waiting for something. Perhaps the script is broken, perhaps it is waiting fr something that just takes a long time (more than your patience). Is there some wrapper you are supposed to use to run those scripts? (My Fedora had system start some-service for this).

2
  • Init scripts on FreeBSD are completely different than on Fedora. Commented Mar 2, 2013 at 22:59
  • @SteveWills I know, I ran BSD systems for many years. That is why I asked if there is a wrapper of sorts. Other that that, I don't see where my answer is wrong. You answer essentially the same... Commented Mar 2, 2013 at 23:02

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.