1

I'm using startx in my .bashrc file to start X when I login at tty1 instead of using a display manager like KDM (I'm using KDE 4.3.4). The actual code in my .bashrc:

if [ -z "$DISPLAY" ] && [ "`tty`" = /dev/tty1 ]
then
    startx
    logout
fi

Now the problem is since KDM is not running I'm not able to use the shut down button from the KDE menu (because it needs root privileges to do so) and some other features are gone as well.

Is there a way to start KDM when I run startx in my .bashrc, like just running KDM in the background? The point is that I want no login display, so I'm sure there must be a way to just start KDM silently.

watain
  • 731

3 Answers3

1

Putting startx in .bashrc is a bad idea. It will prevent you from being able to log in normally to a console. Unless you have a really, really good reason to do so (and I suspect that you, like pretty much everyone else, do not), use a display manager instead.

0

It is not really clear what you want to achieve, but like Ignacio wrote putting startx into your .bashrc is a really bad idea. If your problem were only that you cannot call shutdown -h from within that session, CTRLALTdel is usually mapped to shutdown -r now in /etc/inittab. You can change it to shutdown -h now in there as well.

If your problem is only that you really, really badly want to have X running on tty1, you can of course start kdm on tty1. Then you would also only have to give your login once (was that the issue?). To do that you need to modify a few files.

  • /etc/inittab:

    Remove/comment the line that spawns the getty on tty1. It looks something like

    ## c1:12345:respawn:/sbin/agetty 38400 tty1 linux
    
  • /etc/conf.d/xdm

    Tell the xdm scripts that they are working on tty1; change the entry in there to

    CHECKVT=1
    

To have X start automatically you of course need it in your default runlevel (added via rc-update add xdm).

0

you can set kdm to auto-login, so you'll see no login form displayed. would it help? if it does help, you need to run systemsettings as root (alt+f2 => kdesu systemsettings) then in "login manager" under the "advanced tab" choose "enable auto login" in "convenience" tab.