You are not logged in.

#1 2010-08-10 10:00:36

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

[Solved] Start automatically X when logging into the shell

I followed the wiki http://wiki.archlinux.org/index.php/Start_X_at_Boot
But it doesn't work for me.

The wiki says to add this to .bash_profile:

if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  . startx
  logout
fi

But I think it's wrong and I added:

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

But when I login X doesn't start. I don't want login managers.
Where am I wrong?

Last edited by Garret (2010-08-10 11:46:07)

Offline

#2 2010-08-10 10:16:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Start automatically X when logging into the shell

Do you log into tty1?
Can you still startx by typing it in?

Last edited by karol (2010-08-10 10:20:44)

Offline

#3 2010-08-10 10:22:01

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [Solved] Start automatically X when logging into the shell

wiki history wrote:

(. startx instead of startx to avoid starting extra copy of bash)

Can you start the WM succeeesfully by manually running startx? Any error messages on login?

Offline

#4 2010-08-10 10:24:21

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

Re: [Solved] Start automatically X when logging into the shell

karol wrote:

Do you log into tty1? Yes
Can you still startx by typing it in? Yes

Offline

#5 2010-08-10 10:26:53

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Start automatically X when logging into the shell

Is your bash_profile sourced correctly? Insert some harmless echo command instead of startx and logout and see if it will work.

Offline

#6 2010-08-10 10:29:59

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

Re: [Solved] Start automatically X when logging into the shell

karol wrote:

Is your bash_profile sourced correctly? Insert some harmless echo command instead of startx and logout and see if it will work.

This is my .bash_profile:

. $HOME/.bashrc
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  . startx
  logout
fi

Offline

#7 2010-08-10 10:30:21

olvar
Member
Registered: 2009-11-13
Posts: 97

Re: [Solved] Start automatically X when logging into the shell

I have

if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  exec /usr/bin/startx >> $HOME/.xsession-errors 2>&1
fi

and works fine.

Offline

#8 2010-08-10 10:32:41

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [Solved] Start automatically X when logging into the shell

What karol meant was making a bash_profile like this:

. $HOME/.bashrc
echo test

then login a bash prompt and check if it echos "test"

Offline

#9 2010-08-10 10:38:47

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Start automatically X when logging into the shell

Are you using bash as your login shell? I use dash so of course it wouldn't work here.

Offline

#10 2010-08-10 10:40:40

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

Re: [Solved] Start automatically X when logging into the shell

olvar wrote:

I have

if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  exec /usr/bin/startx >> $HOME/.xsession-errors 2>&1
fi

and works fine.

Adding that source all worked fine.
Really thanks!

Offline

#11 2010-08-10 11:44:03

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [Solved] Start automatically X when logging into the shell

Please mark the thread as solved once your problem/issue has been resolved.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#12 2010-08-11 02:44:38

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: [Solved] Start automatically X when logging into the shell

This whole starting X after logging in at the standard terminal is interesting, But why would you want to do this anyways?

I use a login manager (GDM on virtual terminal 7). If I ever want to use one of the standard terminals (tty1-tty6) I simply use Ctrl+Alt+F1 (or F2, F3, etc).

Let me guess: is it because you want to save time by not loading the login manager?


joe@trusktr.io - joe at true skater dot io.

Offline

#13 2010-08-11 02:51:34

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [Solved] Start automatically X when logging into the shell

Some people just don't use a login manager to begin with.

Offline

#14 2010-08-11 06:20:54

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

Re: [Solved] Start automatically X when logging into the shell

trusktr wrote:

Let me guess: is it because you want to save time by not loading the login manager?

I wanted to try this thing for a more "geek" experience but consider I love Slim login manager too smile

Offline

#15 2010-08-11 08:49:14

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [Solved] Start automatically X when logging into the shell

the development of Slim has been discontinued. so if you get bugs, do not expect them to get fixed any time soon smile
graphical logins, IMO, are just not worth it.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#16 2010-08-11 14:36:05

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [Solved] Start automatically X when logging into the shell

^ not quite true. Slim 1.3.2 was released close to a month ago.

Offline

#17 2010-08-11 15:06:19

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [Solved] Start automatically X when logging into the shell

I stand corrected then. IIRC, the development had stalled for about 2 years. I guess someone stepped up and took over.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#18 2010-08-11 16:47:01

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: [Solved] Start automatically X when logging into the shell

I use this in my .zshrc:

if [ ! "$(pidof X)" ] 
then
        startx
fi

smile

Offline

#19 2010-08-11 17:07:36

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

Re: [Solved] Start automatically X when logging into the shell

Now I notice a strange behaviour:
I encrypted my $home folder with ecrypts following this guide -> http://sysphere.org/~anrxc/j/articles/e … index.html

At startup when I login into my shell I have to write the "startx" command to start the X server.
But if I exit from my shell and relogin the X server starts automatically (as it should do due to the .bash_profile script). So only when I type in for the second time my username and password the script works.

A similar behaviour I observed with slim:
When I login with slim it shows again the login page and when I insert for the 2nd time my login informations the X server starts.

I don't understand why... hmm

Offline

#20 2010-08-11 18:38:16

olvar
Member
Registered: 2009-11-13
Posts: 97

Re: [Solved] Start automatically X when logging into the shell

try putting the X server execution in your /etc/profile, that way you can tell if the problem arises from the encryption of your $HOME or if there is something else.
I would say that your shell sources the .bash_profile before the "un-encryption" (sorry, i don't know the right word), but I have never encrypted my $HOME, so I could be wrong.

Offline

#21 2010-08-12 07:20:57

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

Re: [Solved] Start automatically X when logging into the shell

olvar wrote:

try putting the X server execution in your /etc/profile, that way you can tell if the problem arises from the encryption of your $HOME or if there is something else.

What do I have to do exactly to putting the X server execution in my /etc/profile?

olvar wrote:

I would say that your shell sources the .bash_profile before the "un-encryption".

I think you're right and it's the most logical conclusion about the issue.

Offline

#22 2010-08-12 09:24:35

olvar
Member
Registered: 2009-11-13
Posts: 97

Re: [Solved] Start automatically X when logging into the shell

/etc/profile is like $HOME/.bash_profile but system wide (man bash), so writing the same snippet you have in your .bash_profile should do it.

if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  exec /usr/bin/startx
fi

remove the logging part in case it produces some problems.

Offline

#23 2010-08-12 12:06:00

Garret
Member
From: Palermo, Italy
Registered: 2006-07-09
Posts: 172

Re: [Solved] Start automatically X when logging into the shell

olvar wrote:

/etc/profile is like $HOME/.bash_profile but system wide (man bash), so writing the same snippet you have in your .bash_profile should do it.

if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  exec /usr/bin/startx
fi

remove the logging part in case it produces some problems.

Adding that source after I login the shell shows a xauth error that I didn't copy.
To stop the error I have to press CTRL+C. After that the X server starts but in the root session.

Offline

#24 2010-08-12 14:38:08

olvar
Member
Registered: 2009-11-13
Posts: 97

Re: [Solved] Start automatically X when logging into the shell

Garret wrote:

Adding that source after I login the shell shows a xauth error that I didn't copy.
To stop the error I have to press CTRL+C. After that the X server starts but in the root session.

Ok, I didn't expected that, but I've been reading the guide you posted, and it seems that if you write the "... exec startx..." right after the automount part, everything should work fine. I guess what's happening is you are changing your encrypted .profile instead of the unencrypted one.

While you are logged off your /home/user directory should have a link to /home/.ecryptfs/user/.Private/.profile which is read on login. Once the encrypted partition is mounted the original contents in /home/user are hidden. Maybe you are editing only the file inside the encrypted folder, which shadows the original one, and not doing anithing to the unencrypted one, which sits in your home by default. In other words you have to edit your  /home/.ecryptfs/user/.Private/.profile, adding in the end of the file, the "if... exec startx..." part.

hope it works this time.

Offline

Board footer

Powered by FluxBB