LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is it possible to startX on boot without logging in? (https://www.linuxquestions.org/questions/linux-software-2/is-it-possible-to-startx-on-boot-without-logging-in-139598/)

mattkat 01-28-2004 10:03 AM

Is it possible to startX on boot without logging in?
 
I am playing around with an old laptop. It is more of a toy than anything at this point. What I am trying to do is get it to start X windows after booting. Easy enough - the tricky part is I don't want to have to login. I want it to start X, then run a script. I set my script to start on runlevel 4 and then changed the init runlevel to 4, but it can't start X. Or at least it can't the way I started it.

Does anyone know if this is possible or where some references that might help are? I've done a bit of reading about the xdm process, but it isn't clear that there is a way to either autologin or to make logins unnecessary.

Thanks.

superbondbond 01-28-2004 11:02 AM

I've not heard of that specific situation. However, technically speaking, X is running when you reach the graphical login screen.

Also, I know that there are ways to automatically log in a certain user, without having to enter said user's password. you might want to look into that to see if it would meet your needs.

mattkat 01-29-2004 08:40 AM

Right, X is running if the init runlevel is 5. I had assumed, maybe incorrectly, that it would be easier to use a runlevel 3 or 4 and then start the x server manually. One possibility that I am loathe to try is just installing gdm and booting to runlevel 5. I understand built into gdm is the ability to autologin a particular user. I'm loathe to do it because there is a fair amount of bloat with gdm that will never be used on this toy of a pc and since it is currently pretty bare-bones, it will probably be a pain to install. But I guess it is an option if nothing else works out.

One suggestion was to create a dummy user ("idiot") and run the following command from the rc.local script:
su - idiot -c "startx > /dev/console 2>&1" &

an alternate suggestion was to edit rc.local and idiot's .bash_profile.
rc.local:
echo "Autologin of user idiot."
cd /home/idiot
su - idiot

.bash_profile:
if [ "`tty`" = "/dev/console" -o "`tty`" = "/dev/tty0" ]
then
startx
fi

Unfortunately, both fail. Even executing either command from the command line fails. For example, as root, running 'su - idiot -c "startx"' will fail with the following error:

Fatal Server Error:
PAM authentication failed, cannot start X server,
Perhaps you do not have console ownership

....

That error is the same if either method (which are virtually the same) is run from rc.local . If run at startup, the error is proceeded by "-bash: no job control in this shell".

I have had some success from the command line with:
su - idiot -c "xinit /usr/bin/<program I want to autostart>"

However when I put it into the rc.local script, the same PAM error occurs. I'm going to read up on PAM and 'su'. Does anyone have any insight?

Thanks.

coontie 01-29-2004 01:23 PM

I bet it has NOTHING to do with PAM.

check that idiot can write to /tmp, check idiot's home directory, make sure he can write there.

make sure there's enough free space on /tmp and ~idiot.

mattkat 02-02-2004 06:42 AM

I did check on the /tmp var as well as the free space, everything looked normal. In fact startx always worked for 'idiot' from the command line on runlevel three.

It seems I was mistaken about gdm. I was able to install it without install all of the bloat of the Gnome window manager. So I installed gdm to start up X in runlevel 5, then I set the autologin gdm feature to login to the user 'idiot'. Alls working now.


All times are GMT -5. The time now is 08:23 AM.