Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ok, so I am moving up from a newbie to a beginner.
When I first installed my distros, I chose to automatically startx when booting. Now I don't want to anymore, but I don't want to backup and reinstall everything. I also want to continue auto login but in console, not in X.
Can anyone tell me an easy way to stop starting X at boot, and to continue with the autologin? Thanks!
1)to stop starting X at boot:
edit /etc/inittab
you will see someline like this "id:3:initdefault:"
may in your case it's 5,change it to 3
2)to autologin:
edit /etc/passwd
i will assume that masterc who needs to autologin..
you will see something like that:
masterc:x:1000:100:masterc:/home/masterc:/bin/bash
just erase the "x" in the second field,save the file and stay
you must be the root to do all these stuff.
The second option won't automatically log you in. All it will do is remove the password. But why do you want to automatically login? If it's just a certain program you want to have running on startup then you should modify your /etc/inittab.
In my /etc/inittab I have the following lines:
1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
Those lines tell it to start 4 instances of agetty which wait for a login. Depending on what distribution you have you should have something similar. You can run man inittab to find out what they all mean. But if you want to have an extra program running on a terminal when you log in you could change the first line to something like:
1:2345:respawn:/usr/bin/consolemp3player < /dev/tty1 > /dev/tty1
Instead of having the login program running on the first tty1 you'll have an mp3player program running instead.
Yeah, it's so I can have mp3blaster running. I don't want to login or anything. I just want to be able to turn the power on, wait like 20 seconds (for everything to boot up and get started) and then press 1 or 2 keys to start playing music. I don't want to type whole commands or anything. Just "P" or whatever for Play, and "N" or whatever for next song. I am thinkin along the lines of the following:
When it boots (assuming an autoloin) all I press is the up arrow. This will invoke the last command executed. That command will be, "mp3blaster;shutdown -h now" That way once I end the mp3player program Linux will automatically power down. I have no monitor, that's why I want such simplicity. 1 key to start the player, 1 key to make it play, 1 key to go to next song, 1 key to shutdown the whole system.
Each time I boot the last command executed will be the same since I don't ever give it another command. So each time the arrow up key will invoke "mp3blaster;shutdown -h now" And then I can press F1 key to load my playlist, and "P" to play it.
The whole autologin thing and then pressing the up key sounds like a bit of a weird workaround. Why don't you make a simple script something like:
Code:
#!/bin/bash
/usr/local/bin/mp3blaster
shutdown -h now
Then edit the /etc/inittab file and make an entry like:
1:2345:once:/usr/local/bin/mp3script </dev/tty1 >/dev/tty1
Make sure it replaces the other entry of what's running on tty1. I don't know exactly how mp3blaster works but I assume it's able to start playing songs when it starts up. That way you won't have to do anything except turn on the power and it will start playing by itself. No need to press up and then enter hoping that was the last command. The script you run makes sure that it calls the shutdown command after you close the mp3 player program.
Sounds like a great idea, but it would be just as useful to me if it were written in Japanese. I really don't understand very much at all about scripts or anything command-line related. I am just moving into that part of the Linux thing.
Would I just open an editor, type that "code" and save the file? And then how do I execute the "code"?
it's not like that.... by changing the inittab to run a mp3 player there IS not login to use in the first place. the applicatino will run instantly as root, and you will not have logged into use it. that file is loaded automatically on boot, and that is the file that creates the 6 login consoles. yeah? SO... if you change that first line the the default console will be REPLACED by an mp3 player. you would then still be able to use the other 5 terminals (Ctrl + Alt + F[ 2 to 6 ]
Ok I'll see if I can explain it a bit better. tty's are virtual consoles usually in console mode you can use the ALT F1-F12 keys to switch between the virtual consoles. On a default setup the first 4 virtual terminals start a getty process which usually shows a little welcome screen and then waits for you to give your name and password so you can login. You don't want to be logging in all you want to do is have it start up the mp3 program right away. When you boot up it always starts on tty1 so you'll want to replace the entry for tty1 with the one for your mp3program. Since you want it to run several commands it's easiest to get it to run a script. A script is just a list of several commands in a row. You can create a script by just opening the file in a text editor. To get the script to run you will have to set the executable bit. Running 'chmod +x scriptfile' will set the executable bit.
By editing the /etc/inittab file you are telling the init process to start your script instead of waiting for a login on the first virtual terminal. So on bootup instead of asking for you to login it will just start the mp3 program. And because you told it to shutdown after calling the mp3 program, it will shutdown your computer after you close the mp3 program. I hope that explains it a little more clearly. I don't know about any advanced console tutorials. Maybe reading the howto's on www.linuxdoc.org will help you. I think there is one from bootup to bash prompt which might help.
Ahh(realizing), now it's in english, and I can see the translation. Thank you both. When I get home on Thur I will try it out and see how it goes and will let you know. thanks!
Ok sorry for bringing up a semi-old post, but I have another very related question...
So this is going great for me, with that script and stuff. But in order to load the songs I have to press F1 to switch to file mode. Then I have to select all the songs, so I press F2 Then I have to press F1 again to get to file play mode.
So I turn on my truck, turn on the MP3LinuxBox once it boots I press F1,F2,F1 and then the play button (the 5 key).
Is there a script or anything like that (say a macro or something) that I could run so that after I start the Box all I have to do is listen (meaning everything - F1,F2,F1,5 is already "entered")? And then I can just press the next key (6) to switch songs.
Thanks for any ideas, and again, I am sorry for bringing up an old post, as I know how much some of you hate it when I do that, not to mention any names (acid something). huh huh
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.