Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old November 22nd, 2007   #1
bodhi.zazen
Ubuntu Guru
 
bodhi.zazen's Avatar
 
Join Date: Apr 2006
Location: Montana
My beans are hidden!
Xubuntu Development Release
Send a message via Yahoo to bodhi.zazen
Thumbs down How to Xephyr ~ AKA Multiple, nested X sessions

How to Xephyr



Click to enlarge

What is Xephyr ?

Xephyr is a X server that runs as a small window within your current X session.

What is it good for ?

There are multiple potential uses for Xephyr:
  • Development. You can ssh into a chroot and forward X sessions.
  • Forward X over ssh without VNC.

Example: Normally if you ssh -X you can forward x applications. This is not a problem if you are forwarding a single application from a single server. But if you forward multiple applications from multiple servers or a whole desktop, it gets messy (to say the least). You can start a new X session ( Virtual X ), but then you have to Ctl-Al-F7 and Ctrl-Alt-F8 between them.

1. Install Xephyr

Code:
sudo apt-get install xserver-xephyr
2. Start Xephyr

Code:
Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :1 &
  • The ":1" = your display (displays are numbered starting with 0)
  • -ac = disable access control restrictions= allow you to forward X
  • -screen 1280x1024 = screen size
  • -br = black background
  • -reset -terminate= Xephyr should automatically close when the last X client is killed, does not always work.
  • 2> /dev/null redirects error messages.

3. Set your display (for X)

Code:
DISPLAY=:1.0
  • Don't forget to set it back after you establish a ssh connection ( DISPLAY=0.0 )

=========================


4. Forward single apps / separate window for each server.

Start Xephyr

Code:
Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :1 &
Change your $Display

Code:
DISPLAY=:1.0
Forward a xterm:

Code:
ssh -XfC -c blowfish user@server xterm
  • -X = forward X
  • -f = puts your ssh session into the background
  • -C = use compression -c blowfish = use blowfish (I am told this is the fastest)


Click to enlarge

Any X apps for that server will start in that window.


=========================


5. Desktop:

Start Xephyr

Code:
Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :2 &
2. ssh into the chroot/server

Code:
ssh -XfC -c blowfish user@server xfce4-session
  • Substitute your window manager for "xfce4-session"


=========================


Enjoy,

bodhi.zazen
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999


Last edited by bodhi.zazen; November 24th, 2007 at 01:13 AM.. Reason: Added re-direct for error messages
bodhi.zazen is offline   Reply With Quote
Old November 22nd, 2007   #2
Dr Small
░▒▓»§«▓▒░
 
Dr Small's Avatar
 
Join Date: Nov 2006
Location: benkoda
My beans are hidden!
Send a message via ICQ to Dr Small Send a message via MSN to Dr Small
Re: How to Xephyr ~ AKA Multiple, nested X sessions

Works good so far. I can't test out ssh yet, since I don't have openssh-server installed on my sisters system yet, but I will try that out soon.

Also, a small fix:
Back where you said:
Quote:
Forward a xterm:

Code:
ssh -Xfc -c blowfish user@server xterm
That should be a capital C after -Xfc. Example:
Code:
ssh -XfC -c blowfish
Because I was getting an error with c because of unknown cipher type.
Good job, this really makes things simpler yet

Great howto!

Edit:
A screenshot of icewm-session running through Xephyr at 800x600.
http://ubuntuforums.org/attachment.p...1&d=1195779441

Dr Small
Attached Images
File Type: png Screenshot-16.png (630.2 KB, 383 views)
__________________
“It is a capital mistake to theorize before you have all the evidence. It biases the judgment." - Sherlock Holmes
Linux User #441960 | Beginners Team | Wiki: DrSmall

Last edited by Dr Small; November 22nd, 2007 at 08:58 PM..
Dr Small is offline   Reply With Quote
Old November 24th, 2007   #3
Dr Small
░▒▓»§«▓▒░
 
Dr Small's Avatar
 
Join Date: Nov 2006
Location: benkoda
My beans are hidden!
Send a message via ICQ to Dr Small Send a message via MSN to Dr Small
Re: How to Xephyr ~ AKA Multiple, nested X sessions

Gtk-Xephyr
Allows you to run Xephyr in a Gtk environment, eliminating the use of starting it all with terminals. You must first download the script below, and give it executable permissions, and copy it to your /usr/bin directory.

Download from here:
Dr Small's Blog
Or Ubuntu Forums (1)
Chmod it with executable permissions:
Code:
chmod +x gtk-xephyr
Copy it to /usr/bin:
Code:
sudo cp gtk-xephyr /usr/bin
Open it with the Run Dialog (ALT + F2):
Code:
gtk-xephyr
Or make a launcher that points to that command.


I originally wrote this script, after disliking the fact that I needed to open multiple terminals to get this to work, and then Bodhi.Zazen fixed my bugs and made it better

You can find the original source of this from here:
http://php.8ez.com/drsmall/blog/?p=175

(1: If you downloaded the file from the attachment that I uploaded to Ubuntu Forums, please rename it to "gtk-xephyr" instead of "gtk-xephyr.sh". Ubuntu Forums required that I have a file type within their allow list.)


Dr Small
Attached Files
File Type: sh gtk-xephyr.sh (844 Bytes, 228 views)
__________________
“It is a capital mistake to theorize before you have all the evidence. It biases the judgment." - Sherlock Holmes
Linux User #441960 | Beginners Team | Wiki: DrSmall

Last edited by Dr Small; November 24th, 2007 at 07:22 PM..
Dr Small is offline   Reply With Quote
Old December 8th, 2007   #4
nikoPSK
Chocolate-Covered Ubuntu Beans
 
nikoPSK's Avatar
 
Join Date: Sep 2007
Location: Victoria, BC
Beans: 2,265
Ubuntu 8.04 Hardy Heron
Send a message via AIM to nikoPSK Send a message via MSN to nikoPSK Send a message via Yahoo to nikoPSK Send a message via Skype™ to nikoPSK
Re: How to Xephyr ~ AKA Multiple, nested X sessions

I will have to try this tomorrow. thanks bodhi!
__________________
That is not me . Starcraft(2)!!! and Lifehacker!
I am now known as Deep Blue and you may contact me from that account.
Quote:
"You Call down the thunder and I'll reap the whirlwind!" ~Terran Ghost
nikoPSK is offline   Reply With Quote
Old December 8th, 2007   #5
adamorjames
Ubuntu Extra Shot
 
adamorjames's Avatar
 
Join Date: Jun 2007
Location: U.S.
My beans are hidden!
Talking Re: How to Xephyr ~ AKA Multiple, nested X sessions

Looks awesome! Thanks.
__________________
iteam - A, soon to be, revolutionary Linux game.
Go->Site Go->Thread

Linux user number 455707 http://counter.li.org/
adamorjames is offline   Reply With Quote
Old February 29th, 2008   #6
jimcooncat
Way Too Much Ubuntu
 
jimcooncat's Avatar
 
Join Date: Apr 2005
Beans: 247
Re: How to Xephyr ~ AKA Multiple, nested X sessions

I had to add this to the beginning of the script:
Code:
unset SESSION_MANAGER
in order to avoid this error:
Code:
Another session manager is already running
jimcooncat is offline   Reply With Quote
Old July 25th, 2008   #7
smartboyathome
Not much coffee nor Ubuntu
 
smartboyathome's Avatar
 
Join Date: Mar 2007
Location: $HOME (Washington State)
Beans: 4,583
Ubuntu 8.10 Intrepid Ibex
Re: How to Xephyr ~ AKA Multiple, nested X sessions

Dr Small, I have modified your script a bit to make it so you can enter your own screen resolution (instead of clicking on pre-defined ones). Here is the new script, in case anyone else wants it.
Attached Files
File Type: sh gtk-xephyr.sh (779 Bytes, 116 views)
__________________
See my themes here! | Dont preach Linux, mention it | Make GNOME Themes
I'm no longer on here. If you want to talk to me, go to noost.org.
My DeviantArt | Linux user #461096 | Ubuntu user #15753
smartboyathome is offline   Reply With Quote
Old July 25th, 2008   #8
scorp123
Chocolate-Covered Ubuntu Beans
 
scorp123's Avatar
 
Join Date: May 2006
Location: Switzerland
Beans: 2,216
Ubuntu 9.10 Karmic Koala
Re: How to Xephyr ~ AKA Multiple, nested X sessions

Quote:
Originally Posted by Dr Small View Post
Gtk-Xephyr ... Allows you to run Xephyr in a Gtk environment, eliminating the use of starting it all with terminals. I originally wrote this script, after disliking the fact that I needed to open multiple terminals to get this to work, and then Bodhi.Zazen fixed my bugs and made it better
Niiiiice!!
scorp123 is offline   Reply With Quote
Old September 22nd, 2008   #9
Dratop
First Cup of Ubuntu
 
Join Date: Sep 2008
Location: Lyon, France
Beans: 1
Ubuntu 8.04 Hardy Heron
Re: How to Xephyr ~ AKA Multiple, nested X sessions

Thanks for this great script for Xephyr. I still have a (noob?) question though : how do I specify in my xorg.conf file that I want the display associated to Xephyr to be outputted on a outer screen or video projector plugged to my laptop ? I both tried to configure this editing xorg.conf manually and using Nvidia X server settings but did not manage to find a solution.

Thanks in advance for your help.
Dratop is offline   Reply With Quote
Old September 23rd, 2008   #10
bodhi.zazen
Ubuntu Guru
 
bodhi.zazen's Avatar
 
Join Date: Apr 2006
Location: Montana
My beans are hidden!
Xubuntu Development Release
Send a message via Yahoo to bodhi.zazen
Re: How to Xephyr ~ AKA Multiple, nested X sessions

Quote:
Originally Posted by Dratop View Post
Thanks for this great script for Xephyr. I still have a (noob?) question though : how do I specify in my xorg.conf file that I want the display associated to Xephyr to be outputted on a outer screen or video projector plugged to my laptop ? I both tried to configure this editing xorg.conf manually and using Nvidia X server settings but did not manage to find a solution.

Thanks in advance for your help.
I am not sure what you are trying to do exactly, but Xephyr does not run the way you envision. It runs within an existing X session and is not configured through xorg.conf or nvidia-settings.

So you run xephyr on the same screen / x session that is already outputting to your video projector.
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999

bodhi.zazen is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:20 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry