after chroot: apt-get update (Err and Failed to fetch - BootableFlashFromHarddiskInstall)
Within a chroot, it is likely that resolv.conf
is not properly set up (it could be a symlink to a non-existent file, or it could be empty and so on). Therefore a common bit of advice when setting up chroots is to copy the host's resolv.conf
:
mv chroot/etc/resolv.conf{,.bak}
cp /etc/resolv.conf chroot/etc/resolv.conf
Then you can restore the original, if it was a proper file.
On many modern systems, resolv.conf
is a symlink to a file /run
, since it is dynamically managed by resolvconf
. On a Debian based system, you can always recreate the link using:
sudo dpkg-reconfigure resolvconf
Related videos on Youtube
mertyildiran
I'm a Computer Engineer who specialized in computational linguistics and Linux. Later on my focus is shifted into lexers, parsers and compilers. I'm the creator of Chaos Programming Language and Dragonfire Open-source Virtual Assistant projects. Besides Stack Overflow, you can take a look at my GitHub profile. I'm also the Turkish translation maintainer of Moodle (Credits). For more information check out my website: mertyildiran.com
Updated on September 18, 2022Comments
-
mertyildiran over 1 year
I'm following BootableFlashFromHarddiskInstall tutorial for making a live CD from my current Ubuntu installation.
Ubuntu 14.04 on VirtualBox. I checked internet connection of virtual machine as normal user(How can I check internet connection of chroot?).
After this step problems started:
sudo chroot ${WORK}/rootfs /bin/bash
Nothing happened or changed no output after this command($LANG environment variable? What is the purpose?):
LANG=
After apt-get update
apt-get update
I'm getting these errors:
Here is history of my normal acccount:
So what is the actual problem?
Is Chroot not connected to internet? - or - tr.archive.ubuntu.com could be a problem?
I checked
sudo apt-get update
as normal user(mertyildiran) it is working.But in chroot
apt-get update
- or -sudo apt-get update
both of them not workingEDIT:
/etc/resolv.conf in chroot directory:
-
muru about 9 yearsIf you're in a chroot, did you copy
/etc/resolv.conf
from the original system to the chroot? -
mertyildiran about 9 years@muru I edited question. I can't copy: "cp: not writing through dangling symlink ‘work/rootfs/etc/resolv.conf’"
-
muru about 9 yearsSince it's a chroot, you probably don't have
/run
set up. So, just delete the link and then copy. -
mertyildiran about 9 years@muru ´sudo mkdir work/rootfs/run/resolvconf´ and ´sudo cp /etc/resolv.conf work/rootfs/run/resolvconf/´ solved my problem. Thank you you can write an answer I will mark as accepted.
-
mertyildiran about 9 years@muru should I delete the link, hmm.., you right It is more appropriate. Thx! :)
-
mertyildiran about 9 years@muru One more thing. Why resolv.conf become as a link? Did I make a mistake?
-
-
typesanitizer over 6 yearsFor people who a bit slow like me, you need to replace
chroot
with the appropriate directory (like say/mnt
) to use the commands.