Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How did I break my Internet access in chrooted Gentoo?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Logomachist
n00b
n00b


Joined: 02 Jun 2014
Posts: 32
Location: PA, USA

PostPosted: Mon Oct 20, 2014 12:15 am    Post subject: How did I break my Internet access in chrooted Gentoo? Reply with quote

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:

Code:
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:

Code:
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?
Back to top
View user's profile Send private message
freke
Guru
Guru


Joined: 23 Jan 2003
Posts: 402
Location: Somewhere in Denmark

PostPosted: Mon Oct 20, 2014 4:47 am    Post subject: Reply with quote

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
Code:
(The "-L" option is needed to make sure we don't copy a symbolic link)
# cp -L /etc/resolv.conf /mnt/gentoo/etc/
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Oct 20, 2014 9:35 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum