sundarnagarajan / rdp-thinbook-linux

Linux on the RDP Thinbook
Other
10 stars 17 forks source link

apt-get update fails within chroot for Ubuntu 17.10 ISO #12

Closed sundarnagarajan closed 7 years ago

sundarnagarajan commented 7 years ago

Error message is:

    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/artful/InRelease  Could not resolve 'archive.ubuntu.com'
    W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/artful-security/InRelease  Could not resolve 'security.ubuntu.com'
    W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/artful-updates/InRelease  Could not resolve 'archive.ubuntu.com'
sundarnagarajan commented 7 years ago

On Ubuntu 17.10 systemd provides the system-wide DNS resolver. On such distributions, /etc/resolv.conf inside the ISO points at ../run/systemd/resolve/stub-resolv.conf and the target will not exist IFF you are remastering on an older distribution (like xenial 16.04) that does not use systemd as the system-wide resolver.

Answer is to detect that there is no nameserver line in /etc/resolv.conf, and if so, we move the existing /etc/resolv.conf aside and replace it with a file pointing at Google Public DNS. At the end of the script we restore the original /etc/resolv.conf