DNS resolution in chroot

View: New views
5 Messages — Rating Filter:   Alert me  

DNS resolution in chroot

by William Tracy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Stupid question.

I've built a T2 environment to chroot into. I've mounted the virtual
filesystems, and everything works great--until I try to connect to a
website, at which point DNS resolution fails. Even something as simple
as "wget www.google.com" does not work.

I've checked that /etc/resolve.conf has correct entries (copied from
host) and is readable, and that did not help. Are there any other
obvious things that I can try?

Thanks.

--
William Tracy
Work: wtracy@...
Play: afishionado@...
Cell phone: (805) 704-0917
Internet phone: (707) 206-6441



-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2

Re: DNS resolution in chroot

by Aldas Nabazas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey William,

I came myself into same problem some time ago but didn't care much.

Could you please try this and report if it works:
mount -o bind /proc /your_chroot_dir/proc
mount -o bind /dev /your_chroot_dir/dev

Cheers,
Aldas

On Thu, Oct 1, 2009 at 12:16 AM, William Tracy <afishionado@...> wrote:

Stupid question.

I've built a T2 environment to chroot into. I've mounted the virtual
filesystems, and everything works great--until I try to connect to a
website, at which point DNS resolution fails. Even something as simple
as "wget www.google.com" does not work.

I've checked that /etc/resolve.conf has correct entries (copied from
host) and is readable, and that did not help. Are there any other
obvious things that I can try?

Thanks.

--
William Tracy
Work: wtracy@...
Play: afishionado@...
Cell phone: (805) 704-0917
Internet phone: (707) 206-6441



-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2


-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2

Re: DNS resolution in chroot

by William Tracy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I *thought* I had mounted /dev, /dev/pts, /dev/shm, /proc, and /sys
already, following the template offered by LFS:
http://www.linuxfromscratch.org/lfs/view/stable/chapter06/kernfs.html

But, lo and behold, your suggestion works. I'll have to dig some more
and see why your command worked when LFS's didn't--they should have
the same effect.

Thanks!

On Thu, Oct 1, 2009 at 11:23 AM, Aldas Nabazas <baldzius@...> wrote:

> Hey William,
>
> I came myself into same problem some time ago but didn't care much.
>
> Could you please try this and report if it works:
>
> mount -o bind /proc /your_chroot_dir/proc
> mount -o bind /dev /your_chroot_dir/dev
>
>
> Cheers,
> Aldas
>
> On Thu, Oct 1, 2009 at 12:16 AM, William Tracy <afishionado@...>
> wrote:
>>
>> Stupid question.
>>
>> I've built a T2 environment to chroot into. I've mounted the virtual
>> filesystems, and everything works great--until I try to connect to a
>> website, at which point DNS resolution fails. Even something as simple
>> as "wget www.google.com" does not work.
>>
>> I've checked that /etc/resolve.conf has correct entries (copied from
>> host) and is readable, and that did not help. Are there any other
>> obvious things that I can try?
>>
>> Thanks.
>>
>> --
>> William Tracy
>> Work: wtracy@...
>> Play: afishionado@...
>> Cell phone: (805) 704-0917
>> Internet phone: (707) 206-6441
>>
>>
>>
>> -----------------------------------------------------------
>> If you wish to unsubscribe from this mailing, send mail to
>> lists@... with a subject of: unsubscribe t2
>
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> lists@... with a subject of: unsubscribe t2
>
>



--
William Tracy
Work: wtracy@...
Play: afishionado@...
Cell phone: (805) 704-0917
Internet phone: (707) 206-6441



-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2

Re: DNS resolution in chroot

by William Tracy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Just in case anyone cares:

I haven't figured out what was keeping the instructions from LFS from
working. However I have found that all I need to do to create a
working T2 chroot is:

1. Build a T2 target (I used the "Just create binary packages and
isofs.txt" option).
2. Mount /dev and /proc exactly as Aldas described.
3. Copy /etc/resolve.conf from the host.
4. Enter the chroot with:
chroot ${YOUR-CHROOT-DIR} env -i HOME=/root TERM="$TERM" /bin/bash --login +h

What I am hoping to accomplish is:
1. Build a minimal T2 environment on a third-party distro. Since I'm
not building anything exotic at this stage, there should be few
compatibility problems.
2. Use the minimal environment from stage 1 to bootstrap a bootable T2
system (that might include unusual packages or development releases
that haven't had all the compatibility bugs fixed).

I've been able to do this before as long as I did the Subversion
checkout and package downloads when I was not inside the chroot.
However, this time I am trying to create a simple process for others
to follow along with.

--
William Tracy
Work: wtracy@...
Play: afishionado@...
Cell phone: (805) 704-0917
Internet phone: (707) 206-6441



-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2

Re: DNS resolution in chroot

by René Rebe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear William,

On 06.10.2009, at 02:26, William Tracy wrote:


Just in case anyone cares:

I haven't figured out what was keeping the instructions from LFS from
working. However I have found that all I need to do to create a
working T2 chroot is:

1. Build a T2 target (I used the "Just create binary packages and
isofs.txt" option).
2. Mount /dev and /proc exactly as Aldas described.
3. Copy /etc/resolve.conf from the host.
4. Enter the chroot with:
chroot ${YOUR-CHROOT-DIR} env -i HOME=/root TERM="$TERM" /bin/bash --login +h

What I am hoping to accomplish is:
1. Build a minimal T2 environment on a third-party distro. Since I'm
not building anything exotic at this stage, there should be few
compatibility problems.
2. Use the minimal environment from stage 1 to bootstrap a bootable T2
system (that might include unusual packages or development releases
that haven't had all the compatibility bugs fixed).

I've been able to do this before as long as I did the Subversion
checkout and package downloads when I was not inside the chroot.
However, this time I am trying to create a simple process for others
to follow along with.

Thanks you for sharing!

I think this kind of notes, guides and discussions are a great help for others and newcomers.

Regards

-- 
  RenĂ© Rebe, ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin


-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
lists@... with a subject of: unsubscribe t2