Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have a C program I wrote for debian on the raspberry pi that asks the user to enter a number, 1-4 which it then stores in a configuration file. This only happens if the configuration file is missing. I'd like to run this program on boot. Problem is, I can get it to run on boot, but haven't had any luck getting the terminal window to show up so I can see it. I've tried editing /etc/rc.local and adding commands there. I've tried editing crontab. I've tried all the tricks with "export display=:0 && command". Any suggestions?


Here is the command I am actually running in /etc/rc.local:

x-terminal-emulator --command=/opt/vc/src/hello_pi/initialConfig/./initialConfig.bin --display=:0

The program uses scanf() to capture keyboard input and display feedback.

share|improve this question
Have you disabled X server authentication with xhost + ? (You probably don't want to just do this and leave it like this, but it's a quick and dirty trick to see if this is your issue) – Darth Android Aug 12 '13 at 14:42
No luck with your suggestion. I added my actual command in my question. – Davido Aug 12 '13 at 14:48

You aren't talking about "on boot" but rather about "on X startup", and this is a complicated thing because in a typical setup what's started by X is a login manager, i.e. there's no user session yet even after X is started; only after a user logs in, a session is initiated.

So, my take on this:

  • If you have a kiosk-style setup, where there are no user sessions at all, just something is to be started along with X, don't reinvent the wheel an go with nodm which allows to run arbitrary script after setting up a graphical interactive session for a pre-configured user.
  • If you have a "normal" (i.e. typical) setup then the even you're trying to hook onto is misplaced: you have to somehow hook into a graphical interactive user's session.

    Here things start to get complicated:

    • If you have some display manager (*DM, typically GDM, KDM, XDM, slime etc) then first study which hooks they provide — some of them are capable to execute certain scripts after a user logs in.
    • If you have a "modern" d-bus-enabled session setup (GNOME etc), then consider if you're able to listen to a certain an-interactive-user-session-created event on the system d-bus instance — you could supposedly hook onto it at boot time after the system d-bus instance starts.
share|improve this answer
up vote 0 down vote accepted

I finally figured it out. In your users home directory you have to create a file called autostart at the path /.config/lxsession/LXDE/ and just add whatever command you want to execute after login to the autostart file.

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.