LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Start Fluxbox session automatically (https://www.linuxquestions.org/questions/linux-desktop-74/start-fluxbox-session-automatically-711460/)

kushalkoolwal 03-13-2009 05:37 PM

Start Fluxbox session automatically
 
I am using Debian Lenny (5.0) with X installed. I also have fluxbox was my Window manger. I would like to achieve this:

When my system boots it should start X and then start fluxbox session automatically without entering login and password. This is for the purpose of creating a LiveCD.

Right now, after my system boots I have to manually login and type in "startx" on tty1 which launches X and starts fluxbox thereafter. I would like to ***automate** this very step.

I would try to avoid using any login mangers like xdm, gdm, kdm ,etc.

Thanks

linuxdork 03-13-2009 07:25 PM

This might be 'like' what you're looking for.

http://ubuntuforums.org/showthread.php?t=727947

kushalkoolwal 03-13-2009 08:08 PM

Quote:

Originally Posted by linuxdork (Post 3474871)
This might be 'like' what you're looking for.

http://ubuntuforums.org/showthread.php?t=727947

Not quite. First of all I don't have:
Code:

/etc/event.d/tty1
even after installing rungetty package.

manwithaplan 03-13-2009 08:13 PM

Check in your ~/ folder for a file called ".xinitrc" and add the this to it. If not there create the file

Code:

# echo "exec startfluxbox" >> ~/.xinitrc
This is all that is needed... and also make sure "xdm" or any other is runtime default at boot... or just startx

mrclisdue 03-13-2009 09:17 PM

This thread:

http://www.linuxquestions.org/questi...ut-gui-374338/

will show you how to autologin into runlevel 3.

For whatever user you decide to autologin as, put this (or something similar/suitable) in its ~/.bash_profile:

Code:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/vc/3 ]; then
startx
fi

This particular code checks to verify that a display is available (ie, x hasn't already been started) and the user has logged into tty3, so you may have to change the result of $(tty) to reflect what you have chosen.

As previously indicated, you may have to edit .xinitrc so that fluxbox starts when your user issues the command $startx. Fluxbox can also be started from the cli with the command $startfluxbox (instead of $startx)

cheers,

kushalkoolwal 03-13-2009 09:20 PM

Quote:

Originally Posted by manwithaplan (Post 3474900)
Check in your ~/ folder for a file called ".xinitrc" and add the this to it. If not there create the file

Code:

# echo "exec startfluxbox" >> ~/.xinitrc
This is all that is needed... and also make sure "xdm" or any other is
runtime default at boot... or just startx

hi,

I get the part of .xinitrc to start fluxbox. However, I still need to start "startx" manually by typing in the command. And that's made me to post this question. I would like startx to be executed automatically towards the end of the boot process.

Quote:

Originally Posted by manwithaplan (Post 3474900)
and also make sure "xdm" or any other is
runtime default at boot

I don't want to use any login managers like XDM

Thanks

manwithaplan 03-13-2009 09:29 PM

Quote:

Originally Posted by kushalkoolwal (Post 3474932)
I don't want to use any login managers like XDM

I can think of 2 possibilities...

1) You add a login manager and set it too auto login your user account

2) You write a script that uses "startx" and add it to runtime default in your init.d or rc.d etc ... etc.. depending on distro.

These are they only ways I can think that it would work. Intrested myself if I could bypass using gdm...

kushalkoolwal 03-13-2009 09:36 PM

Quote:

Originally Posted by mrclisdue (Post 3474930)
Code:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/vc/3 ]; then
startx
fi

This particular code checks to verify that a display is available (ie, x hasn't already been started) and the user has logged into tty3,
cheers,

I think I am very close to finding the solution based on what you guys have told me. Although one of my major question still remains unanswered. How does the startx gets executed? I still think based on whatever everyone has suggested, I still need to login first (on a tty) and then only the startx would get executed. I wan't startx to get executed automatically without even logging in.

manwithaplan 03-13-2009 10:28 PM

Maybe find a way to echo the runlevels on startup. If you need a tty open before startx, then trace.log your startup and then startx. At least you can see how the tty is initiated. You'll need to take in account of adding username and pass. Seems like alot of code to me.. I'd just load xdm and autologin.

kushalkoolwal 03-13-2009 10:37 PM

Quote:

Originally Posted by manwithaplan (Post 3474974)
Maybe find a way to echo the runlevels on startup. If you need a tty open before startx, then trace.log your startup and then startx. At least you can see how the tty is initiated. You'll need to take in account of adding username and pass. Seems like alot of code to me.. I'd just load xdm and autologin.

Quote:

Originally Posted by manwithaplan (Post 3474974)
I'd just load xdm and autologin.

That was my initial guess too. But if you search over Internet, XDM does not have any auto-login feature. They say "If you need autologin, then why do you need xdm".

mrclisdue 03-13-2009 10:44 PM

Unless I've seriously misunderstood your intentions, the link referred to in my first post instructs you on how to get a user autolog'd-in, in runlevel3 (ie, no xdm...)

Once that is accomplished, the autolog'd-in user's .bash_profile is sourced - the quote-back you used essentially establishes whether X is running, if it isn't, then it checks whether the autologin condition is met (whether the user is logging in from tty3 (from the linked example)), and if so, then startx.

The suggested edit to .xinitrc ensures that fluxbox is started when the command startx is issued.

cheers,

manwithaplan 03-13-2009 10:44 PM

Well... it seems you got yourself a nice project... In fact if you can get it to work, share the source. I did overlook the XDM. I personally use GDM, and find it slow, and it doesn't work well with my kvm switch. Maybe a script that immediately initiates after login? Though that negates an autologin process, just an suggestion.

kushalkoolwal 03-13-2009 11:02 PM

Quote:

Originally Posted by mrclisdue (Post 3474981)
Unless I've seriously misunderstood your intentions, the link referred to in my first post instructs you on how to get a user autolog'd-in, in runlevel3 (ie, no xdm...)

I think you understood my question correctly. The link you suggested talks about the same but looks like a very crude method and also not very flexible. Also the question was based on Debian Sarge (3.1) which is at almost 4 years old now, however most of the people who answered were using some other distros like slackware. I am pretty sure since then system start-ups must have gone through a lot of change.

If I don't find anything I will use the method in that. Although I am very doubtful it will work.

Thank you for the link though.

kushalkoolwal 03-15-2009 04:43 AM

Quote:

Originally Posted by manwithaplan (Post 3474982)
Well... it seems you got yourself a nice project... In fact if you can get it to work, share the source.

Alright, I finally found out a very simple way to achieve the autologin without breaking my system. I even wrote a blog post regarding that.

Please let me know if there are drawbacks (I am sure every autologin method will have some) with this method. I have listed a few in the "Important Notes" section.


All times are GMT -5. The time now is 04:07 PM.