Welcome to the Linux Car Project page. This page is intended to be a
source of information for those people who, for various reasons, would
like to have a computer running in their car.|
The biggest reason for this these days is a mobile MP3 player, however, why stop there? There are many practical applications for having a full-fledged computer in you car besides the afore mentioned MP3 player. Some good reasons that occured to me were entertainment via music cdroms, dvd video. mpeg video, computer games (for those long rides with the kids), Mobile office applications, computerized navigation and the like.
Again, in order to compensate for all the above applications and more, we really need to have a fully functional computer to work with and not just a component system (unless you really only want mp3's). And, since this *IS* a Linux user group, I intend to do all this using Linux of course...
One of the first questions I fielded about this is how to get Linux to start up without requiring a login.
This is an important question, because most people don't want to have to wait for a login prompt and login to their computer just to hear some music on the way to the supermarket....
Let me first preface the response by saying that I am currently running RedHat 6.2, and all my "fixes" will be tested on that system, however, I see no reason they wouldn't work on *ANY* Linux distribution.
The solution to this problem is actually quite simple providing you are running with a console start-up as opposed to a gui (xdm) login. Although I expect it would work with the GUI, I haven't tested it...
You need to modify the /etc/inittab file and change the getty startup on tty1 from:
The "linuxcar" in the above line is a file that we will create, so don't worry too much about that just yet.
The next thing you would want to do is to create a user account for your car-computer to start up. The account I will create will be called "caruser" for the rest of my examples, but you could call it anything you'd like to suit your own preferences...
So, login to root on your Linux box and create your account thusly:
# useradd -m caruser
You do not need to change or add a password to this account.
Next, we'll change to the /sbin directory and get things ready to work!
# cd /sbin
Now we need to create that "linuxcar" file so that our login will work..
Use whatever editor you are comfortable with and put the following in that file:
exec su --login caruser
This is really simple... You are telling the computer to execute the su command and login the caruser (using the caruser's own environment variables). The trick here is that you can do this without a password because the computer thinks it's running this command as the root user. Also, this file is automatically respawned (restarted) in the inittab everytime the user is logged out, so there are no pesky login prompts to play with on the inittial syatem startup or any time thereafter.
Once this is complete, you can restart the computer and you will notice that the caruser account will be happily waiting for you after boot-up with a familiar $ prompt.
Now, how do we do anything with this? How do we actually run any programs (our favorite mp3 player) automatically instead of some dumb bash prompt?
Easy! Make use of your .bashrc file! This file is executed immediately after a users logon and you will find it in that user's home directory. If you happen to be using a different shell than bash, each shell has it's own corresponding file (ex. cshrc, and so on).. Consult the man page for your specific shell.
Basically, you can just add the program you want to run at the end of the .bashrc file and as soon as that user loggs in, that file will be run....
So, if you were looking to start the MPG123 program up immediately, you would add:
to the end of your .bashrc file, or you could start X that same way by adding a 'startx' to the bottom of that file.