# How did I break my Internet access in chrooted Gentoo?

## Logomachist

Hey, 

I've been chrooting into my Gentoo OS from a USB drive while I've been trying to set KDE on Gentoo. Right now I only have the CLI on Gentoo.

At one point I accidentally hit a key combination that closed the terminal window. When I opened a new window I wasn't in the chrooted environment anymore so I tried to mount my partitions again and chroot back into the Gentoo OS:

```
sudo mount /dev/sda6 /mnt/gentoo

sudo mount /dev/sda5/ /mnt/gentoo/boot

sudo mount /dev/sda9 /mnt/gentoo/opt

sudo mount /dev/sda8 /mnt/gentoo/var 

sudo mount /dev/sda7 /mnt/gentoo/usr

sudo mount -t proc proc /mnt/gentoo/proc

sudo mount --rbind /sys /mnt/gentoo/sys

sudo mount --rbind /dev /mnt/gentoo/dev

sudo chroot /mnt/gentoo /bin/bash

source /etc/profile

export PS1="(chroot) $PS1"
```

However when I ran the above it said the partitions were already mounted and when I attempted the chroot part it switched from using "Microknoppix / #" as the prompt to using "(chroot) Microknoppix / #" as the prompt. It also knocked out my Internet access in the chrooted environment, which is the important part (I still had Internet access in the Microknoppix USB drive I was booting from). I rebooted the computer and entered Gentoo normally. I had Internet access there.

I rebooted into Microknoppix and entered the chrooted Gentoo environment again. I still no Internet access. I googled and found that I could get my Internet access back by running:

```
sudo mount --bind /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
```

and this has worked flawlessly since but I didn't need to do this before accidentally closing the terminal window and I'm kind of curious about what is going on. What did I do to break my Internet access in the chrooted Gentoo environment in the first place and what does "sudo mount --bind /etc/resolv.conf /mnt/gentoo/etc/resolv.conf" do to fix things? Is there a better, more permanent solution to the Internet access problem?

----------

## freke

The Handbook says to copy over over the DNS-info (resolv.conf) before chrooting, sounds like you didn't do that originally:

Chapter 6 - Code Listing 1.3

```
(The "-L" option is needed to make sure we don't copy a symbolic link)

# cp -L /etc/resolv.conf /mnt/gentoo/etc/
```

----------

## Roman_Gruber

Basically it is always the same

lspci / insmod / lsmod (you need the proper modules loaded for your network devices)

man ifconfig 

man dhcpcd

if you use wireless you may need wpa_supplicant with a correct /etc/wpa_supplicant.conf for your router

You may check the handbook on how to configure the network.

----------

