How to start a second X session?

I tried to do it with the command startx 1. It seemed to flicker to a different screen momentarily, but then exited. Got the following error:

/usr/bin/xterm: No absolute path found for shell: :1

Any ideas?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I think you can do it with this:

$ startx -- :1

Note that you need to be on a text console. If you do this from an X session, you may not be authorized. First Ctrl+Alt+F1 to switch to a text console and log in there.

Press Ctrl+Alt+F7 and Ctrl+Alt+F8 to switch between the X sessions (the F key numbers may vary depending on your distribution).

If you want more control you can add more options to the command like so:

$ startx gnome-session -- :1 vt8

This will start up gnome-session on display :1 and run it on virtual console 8 (Ctrl+Alt+F8).

Method 2

I have found that the following way works for me:

sudo xinit /usr/bin/xterm  -e "su $(whoami) -c pekwm"  $* -- :1

What happening here?
First I start xinit with an xterm, as a parameter to that xterm I su to become myself. From there I start the window manager.
Only thing you need to do is minimize (not close) the xterm.
Probably you could tell the xterm to start minimized—but I have not care enough to find that out.

Also:
Replace pekwm with the session you want to login to. Look in the .dewsktop-file in /usr/share/xsessions

Edited code. Changed from my real username as in example to the output from whoami

Method 3

When I start another Xorg env I switch to tty2 (Ctrl+Alt+F2), then login as root and run those commands:

Xorg vt8 :1 &
su - user
export DISPLAY=:1
fluxbox &

You might have to change back to tty2 right after Xorg has started.
And I’ve seen Xorg with setuid bit set so you can start Xorg without root, so check it out 🙂


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x