You are not logged in.

#1 2008-08-27 14:45:27

deltaecho
Member
From: Seattle, Washington (USA)
Registered: 2008-08-06
Posts: 182

[SOLVED] No internet connection in chroot

For some reason, I can't connect to the internet in my Arch32 chroot environment, even though I'm connected to the wireless network at school.  I set it up last night via the Arch Wiki's instruction, and it worked great!  At least until now...

I can surf the net and ping Google all I want outside the chroot - any ideas?

Last edited by deltaecho (2008-09-10 14:32:57)


Dylon

Offline

#2 2008-08-27 19:48:34

deltaecho
Member
From: Seattle, Washington (USA)
Registered: 2008-08-06
Posts: 182

Re: [SOLVED] No internet connection in chroot

Pretty weird . . . I'm home now and have no problem surfing the web from my chroot jail tongue

Could the network I was on earlier be set up in some funky way?


Dylon

Offline

#3 2008-08-27 19:53:24

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: [SOLVED] No internet connection in chroot

Have you copied all the config files into the chroot as the wiki says?  Are you sure that your chroot user is in all the necessary groups?

Offline

#4 2008-08-27 20:14:18

deltaecho
Member
From: Seattle, Washington (USA)
Registered: 2008-08-06
Posts: 182

Re: [SOLVED] No internet connection in chroot

Yes, I put the arch32 script in my rc.d directory and added it to the list of daemons in my rc.conf, and linked/copied all the files mentioned in the wiki.  Since I've been home, I haven't had any issues with it - in fact, I'm writing this from my chroot'd Firefox.  Do you know of any setting the network admin may have put in place that would have kept me from connecting to their network via chroot ???


Dylon

Offline

#5 2008-08-27 21:35:17

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: [SOLVED] No internet connection in chroot

Sorry, no idea.

Offline

#6 2008-09-10 14:32:25

deltaecho
Member
From: Seattle, Washington (USA)
Registered: 2008-08-06
Posts: 182

Re: [SOLVED] No internet connection in chroot

Got it big_smile

The problem lied in my resolv.conf - adding 'mount --bind /etc/resolv.conf /opt/arch32/etc/resolv.conf' to my arch32 script did the trick!  Apparently, when I connected to the network from my 64-bit environment, my /etc/resolv.conf was updated, however, my /opt/arch32/etc/resolv.conf was not...

The above fixed my problem; marking this one as [SOLVED].

Edit 9/12/2008:

In short, what I did was add the following 2 lines to my /etc/rc.d/arch32 script:

#!/bin/bash                                                                                                                         

. /etc/rc.conf
. /etc/rc.d/functions

case $1 in
    start)
        stat_busy "Starting Arch32 chroot"
        ...           
        mount --bind /etc/resolv.conf /opt/arch32/etc/resolv.conf
        ...
        add_daemon arch32                                                                     
        stat_done                                                                             
        ;;                                                                                     
    stop)                                                                                     
        stat_busy "Stopping Arch32 chroot"                                                     
        ...
        umount /opt/arch32/etc/resolv.conf
        ...
        rm_daemon arch32
        stat_done
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
esac
exit 0

Then, whenever I establish a new network connection - say I go from my home network to my school's - I just restart the arch32 daemon:

sudo /etc/rc.d/arch32 restart

It seems to me the "mount --bind ..." command should automatically update my /opt/arch32/etc/resolv.conf file whenever my /etc/resolv.conf is changed, but it doesn't.  Restarting the daemon mounts the new resolv.conf on top of the old one, so all's well (please tell me if you know of a way to do this automatically - symlinking the file doesn't work in a chroot environment).

09/15/2008 - Solved yet another issue!  Upgrading dchroot to schroot via the community repo fixed my resolv.conf problem; pretty cool!

Last edited by deltaecho (2008-09-15 14:14:57)


Dylon

Offline

Board footer

Powered by FluxBB