Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to build a FreeBSD + XBMC based media box. Everything is all working fine except for one point.

I need to boot XBMC as an RCNG startup script, which is all fine, except:

If the command to start X and XBMC is run in the foreground all works fine. If it is pushed to the background (with &) it starts to work then is kicked out (I think) by getty starting.

Is there some way of stopping getty from killing X, or am I barking up completely the wrong tree?

rcng script:

# $FreeBSD$
# PROVIDE: xbmc
# REQUIRE: sshd
# KEYWORD: shutdown
# Add the following line to /etc/rc.conf to enable xbmc:
# xbmc_enable="YES"
# You will also need to fill in the xbmc_flags="" variable to suit your configuration.


. /etc/rc.subr


xbmc_start() {
        /usr/local/bin/xinit /usr/local/bin/xbmc       # adding & makes it all fail



load_rc_config $name
run_rc_command "$1"

One more note - when it does kick it out the screen is screwed. It shows me the first bit of the X.Org startup messages and that's all. No login, no control over it, no ability to start X again even remotely.

I have now turned off ttyv2 and upwards in the /etc/ttys - it has stopped the screen from locking up when it kicks out Xorg (gives me a normal getty prompt), but it still kicks it out. So it's deffinately getty / init related.

Ok, I am 100% convinced it's to do with getty starting up. If I put the commands to start the x session in a script with a sleep 5 in it so the X session doesn't actually start until after getty has started running it all works fine.

While I can live with this for now, it would be nice to understand why it behaves like this and maybe get it to start up more friendly.

share|improve this question
  • I think you are missing a REQUIRE line, so that it is started at the right point. I would try something like
 # REQUIRE: LOGIN syscons
  • In your /etc/ttys did you configure something like xdm/gdm/kdm ? You might even try to start your program from /etc/ttys
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.