5

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:

enter image description here

Here is history of my normal acccount:

enter image description here

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 working

EDIT:

/etc/resolv.conf in chroot directory:

enter image description here

6
  • If you're in a chroot, did you copy /etc/resolv.conf from the original system to the chroot?
    – muru
    Feb 26, 2015 at 19:39
  • @muru I edited question. I can't copy: "cp: not writing through dangling symlink ‘work/rootfs/etc/resolv.conf’" Feb 26, 2015 at 19:49
  • Since it's a chroot, you probably don't have /run set up. So, just delete the link and then copy.
    – muru
    Feb 26, 2015 at 19:56
  • @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. Feb 26, 2015 at 19:56
  • @muru should I delete the link, hmm.., you right It is more appropriate. Thx! :) Feb 26, 2015 at 19:58

1 Answer 1

10

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
2
  • 2
    For people who a bit slow like me, you need to replace chroot with the appropriate directory (like say /mnt) to use the commands. Sep 4, 2017 at 20:44
  • works like a charm !
    – Alex
    Apr 11, 2023 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .