• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Making X start at boot

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

MRD

Senior Member
Joined
Feb 14, 2003
I am finishing up a MythTV front end installation. I would like the computer to do a series of things automatically upon booting. There will be no keyboard attached, so no one will be logging in. It should be run automatically at boot time.

X needs to start
mtd (the Myth Transcoding Daemon) needs to be run in the background
mythfrontend neeeds to run (this is the gui for MythTV)

I tried adding them to /etc/cond.d/local.start, but the mtd can't start up correctly. X does start, but it doesn't seem to run .xinitrc. Are environment variables not set? After all, I'm not in a shell.

What is the proper way to do this?
 
to start X automatically on my machines I use KDM with the autologin feature. Then rc-update add xdm default. Note: KDM can load fluxbox and other WMs beside KDE. Mine loads fluxbox. As for starting mtd on boot, try putting the full path in the local.start file, also you'll have to redirect it's output to a log or /dev/null.
Code:
/path/to/mtd > /var/somelog
will work I think. I'm not really up on output redirects :/
 
All I need to do is installing any displaymanager and using update-rc.d for it (debian)
It then gets started automatically.
 
Do you run MythTV as root Kaltag? Supposedly, the author claims there are speed benefits to running as root. I may install a login manager and try to have it log in automatically as root, if that is possible.
 
Apparently, gdm will not allow the root user to automatically be logged in.

At the moment I'm trying to hack gdm to allow root to auto login. So annoying that they limit this. There should be a use flag to allow it.

It's a completely isolated system, not like I'm worried about security.
 
Last edited:
You could write an rc script to switch the user to root once logged in, then launch the application.

All you would need to do is at it to the defualt run level.

Take a look at some of the rc scripts that are on the machine to see the syntax to write your own.
 
Most linux distros need to be told to boot to runlevel 5 in order to start the X server. Most should have a file /etc/inittab, which the first uncommented line should be:

Code:
id:3:initdefault:

That is what I pulled off my server, and since it's a server, it doesn't run X and therefore boots into runlevel 3. Simply change that line to:

Code:
id:5:initdefault:

...and that should do it for you. As for automatically logging in and launching an app, that's a different story.
 
Stewie said:
Most linux distros need to be told to boot to runlevel 5 in order to start the X server. Most should have a file /etc/inittab, which the first uncommented line should be:

Code:
id:3:initdefault:

That is what I pulled off my server, and since it's a server, it doesn't run X and therefore boots into runlevel 3. Simply change that line to:

Code:
id:5:initdefault:

...and that should do it for you. As for automatically logging in and launching an app, that's a different story.

That will only boot you into a GUI login, not actually log you in and enter a password.
 
none of my boxes use root to run mythtv. I have a specific user called htpc with all the appropriate permissions for things to work. KDM will not allow root logins either by default.
 
I got gdm to log in, but I can't figure out how to make it run stuff on startup. Any idea how to do that?
 
Stewie said:
Hence my comment on the last line of my post. Maybe read my entire post next time? :)

Sorry, but he already was able to log in as user automatically.

You just stated how to change the run levels from text to GUI.
 
{PMS}fishy said:
You just stated how to change the run levels from text to GUI.

Exactly. As per his first post:

MRD said:
X needs to start


...if he was booting into runlevel 3 as I had presumed, it's obvious why X wasn't starting.


MRD:
To run stuff on startup, edit your /etc/rc.local file and place the /path/to/binary on a free line. Make sure you use the absolute path, and also that your user has suffcient permissions to run it. rc.local is WM independent. ).
 
Last edited:
What WM are you using?

Gnome/GDM, though I'm not totally attached to it if another is better for this. I'd sort of prefer to avoid KDE if possible because it's kind of a resource hog.
 
To run stuff on startup, edit your /etc/rc.local file and place the /path/to/binary on a free line. Make sure you use the absolute path, and also that your user has suffcient permissions to run it. rc.local is WM independent. ).

The applications try to launch before X has started when I put them there, and die because they can't find an X server.
 
MRD said:
The applications try to launch before X has started when I put them there, and die because they can't find an X server.

I wonder if there is a way to set a time dely before starting the application.
 
If you use the method I depicted above, I don't see why you couldn't put something like:

Code:
/bin/sleep 15; /path/to/binary      // change '15' to the approx. # of seconds your machine takes to start X

That file is exectued just like any other shell script so there's no reason why it shouldn't work, although I can't say I've tried it.
 
Seems to still not work. It doesn't give an X server error, but it gives weird errors about files not found. It seems the environment isn't set up, ie variables/path and such.

Also, stuff can't get to the network, even though its running and apps run from the command line before or after can see it fine.
 
Back