Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Description:

I'm using a Lubuntu 13.10 X86-64 livecd to chroot into another Lubuntu 13.10 X86-64 located on my hard drive in a folder called chroot. I've had no trouble using the terminal to chroot in, and I can launch gui applications on my current xserver from the chroot after using "xhost +" on the livecd, but I need provide the chroot it's own X output. I've googled, searched askubuntu, and typed every command under the sun and moon all to no avail. I would love a solution, but would even be happy for a guess if you've got one. I've backed up the chroot so I can restore if it gets messed up. I've also tried using Xnest but it doesn't want to work either. I would like to run the lxde desktop environment in the chroot, if possible logging in as a specific user.

Details:

Below are the commands I used to commence the chroot.

sudo mount --bind /dev /media/lubuntu/os/chroot/dev

sudo mount --bind /proc /media/lubuntu/os/chroot/proc

sudo mount --bind /sys /media/lubuntu/os/chroot/sys

sudo cp /etc/resolv.conf /media/lubuntu/os/chroot/etc/resolv.conf

xhost +

sudo chroot /media/lubuntu/os/chroot

I would also have typed "export DISPLAY=:0.0" in the chroot, but it worked without it.

Test Results:

Test #1:

Description:

I get a black screen on all outputs (control+alt+Fkeys), and I cannot type anything. I'm forced to kill the computer by hand.

Details:

In chroot terminal type

export DISPLAY=localhost:1

In chroot terminal type

startx -- :1

Test #2:

Description:

I get a black screen for F1, pressing "control + alt + F7" gets me back to my normal desktop. I cannot type anything on the black screen. When I enter "gksu leafpad" in the chroot terminal on F7 I get an error that it "cannot open display localhost:1". When I switch to F1 it now shows a terminal prompt for the livecd not the chroot.

Details:

In chroot terminal type

export DISPLAY=localhost:1

In livecd terminal type

sudo startx -- :1

Test #3: [Edited In]

Description:

I get a blank black window, just as I would for Xnest. When I try to launch xterm I get an error stating "could not resolve hostname lubuntu: Name or service not known". I've also tried installing "openssh-server" in the chroot, and on the livecd. When I use the same commands on the livecd only and attempt to launch xterm from the livecd I do not get the same error. Instead I get a password prompt. The livecd user "lubuntu" has no password. If I leave the password blank I get error "permission denied. If I create a user account a retry it I get error "permission denied, please try again" when entering the correct user password. The "could not resolve hostname lubuntu" error experienced with the chroot also occurs when using apt-get in the chroot, though I can and have installed things from apt.

Details:

In livecd terminal type

Xephyr -ac -screen 1024x768 -br -reset -terminate 2> /dev/null :1 &

In chroot terminal type

DISPLAY=:1.0

I also tried "DISPLAY=:1.0" in the livecd terminal.

In chroot terminal type

ssh -XfC -c blowfish root@lubuntu xterm

I also tried "user@server" and "root@localhost" in the chroot terminal.

Additional Information

Anything else you want to know? I'll try to add it here.

share|improve this question
    
Use Xephyr - ubuntuforums.org/showthread.php?t=620003 –  bodhi.zazen Mar 17 at 19:57
    
@bodhi.zazen Thanks for the info –  please delete me Mar 17 at 21:07

1 Answer 1

up vote 0 down vote accepted

Use Xephyr

sudo apt-get install xserver-xephyr

Start Xephyr

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.

Set your display (for X)

DISPLAY=:1.0

ssh into your chroot (you may need to install ssh server, you may also wish to look at LXC )

ssh -XfC -c blowfish user@server xterm

or use any other graphical tool you wish.

See also

http://ubuntuforums.org/showthread.php?t=620003

https://help.ubuntu.com/lts/serverguide/lxc.html

share|improve this answer
    
Ran into some errors. Added results to my posting as "Test 3". I get error unable to resolve the host. I've also tried without the chroot and am unable to get to work that way either because it doesn't like my password. –  please delete me Mar 17 at 21:06
    
You have to give your chroot an ip address and then use the ip address in your command. root@192.168.0.2 or whatever. If you do not know how to do that, I again suggest you use lxc ;) –  bodhi.zazen Mar 17 at 21:08
    
@user250271 Did you ever get this working ? –  bodhi.zazen Mar 18 at 15:30
    
Nope, but I think I need to learn a bit more first so I'm backburnering this for a bit. Thanks for the detailed answer. –  please delete me Mar 19 at 23:40
    
OK, well, as you work through chroot, if you get stuck, ask for help ;) –  bodhi.zazen Mar 20 at 0:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.