locked
Custom Debian Image (apt-get not resolving) RRS feed

  • Question

  • Hi Guys,

    So I'm pretty new to azure, I've deployed a custom debian 7 image to azure, I have followed the check list: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/create-upload-vhd

    Everything seems to work except resolving addresses, I can ping 8.8.8.8 but cannot apt-get update  For example I get: "Something wicked happened resolving 'ftp.nl.debian.org"

    Firstoff to make sure it was not a firewall/port I opened all ports in the Network Security Groups and still doesn't work, just tried it to rule out any port issues. I can ssh in to the machine and also reach it's webpanel on a custom port opened in Network Security Group.

    Now I have read that it is most likely a DNS error which makes sense as I can ping an IP but not ping an hostname. I've also tried manually adding googles dns servers as someone suggested but to no avail. Do I need to adjust something in azure to be able to resolve hostnames.. in a custom linux image?? Some help would be awesome.


    • Changed type Nirushi J Sunday, May 28, 2017 5:31 AM From Discussion to question
    • Moved by Nirushi J Sunday, May 28, 2017 8:48 AM Moved from Networking to VM
    Saturday, May 27, 2017 6:13 PM

Answers

  • Hey,

    Thanks, shortly after my question I found the same article.

    I've resolved the issue without the article, to answer my own question, during deprovisioning the waagent deletes /etc/resolv.conf. This file (symlinked) holds the external nameservers in my case those of google (8.8.8.8 and 8.8.4.4). So I backed it up before deprovisioning. The same with /etc/hostname. Waagent renames the hostname to localhost.local but it needs the same name as given to the azure machine name.

    I did not test hostname resolving on the local vm, so I assumed it was an azure networking issue. Shortly after my question I tested it locally and had the same issue.

    So things to take in to account when deploying a custom debian based vhd:

    • Waagent/Walinuxagent deletes access to the root account, if not changed explicitly in /etc/waagent.conf. You'll get locked out if no other accounts are set up, ofcourse match this with credentials setup for the machine.
    • Waagent deletes /etc/resolv.conf, make a backup before deprovisioning, restore after deprovisioning.
    • Waagent changes the hostname in /etc/hostname, change it after deprovisioning to your machine name.

    Anyway thanks for your quick reaction, hopefully this post might help someone facing a similar issue.



    • Edited by L0wL3v3Ls Sunday, May 28, 2017 12:51 PM
    • Marked as answer by L0wL3v3Ls Sunday, May 28, 2017 12:51 PM
    Sunday, May 28, 2017 12:41 PM

All replies

  • Refer the below article:

    https://docs.microsoft.com/en-us/azure/virtual-machines/linux/azure-dns

    -------------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members

    Sunday, May 28, 2017 9:32 AM
  • Hey,

    Thanks, shortly after my question I found the same article.

    I've resolved the issue without the article, to answer my own question, during deprovisioning the waagent deletes /etc/resolv.conf. This file (symlinked) holds the external nameservers in my case those of google (8.8.8.8 and 8.8.4.4). So I backed it up before deprovisioning. The same with /etc/hostname. Waagent renames the hostname to localhost.local but it needs the same name as given to the azure machine name.

    I did not test hostname resolving on the local vm, so I assumed it was an azure networking issue. Shortly after my question I tested it locally and had the same issue.

    So things to take in to account when deploying a custom debian based vhd:

    • Waagent/Walinuxagent deletes access to the root account, if not changed explicitly in /etc/waagent.conf. You'll get locked out if no other accounts are set up, ofcourse match this with credentials setup for the machine.
    • Waagent deletes /etc/resolv.conf, make a backup before deprovisioning, restore after deprovisioning.
    • Waagent changes the hostname in /etc/hostname, change it after deprovisioning to your machine name.

    Anyway thanks for your quick reaction, hopefully this post might help someone facing a similar issue.



    • Edited by L0wL3v3Ls Sunday, May 28, 2017 12:51 PM
    • Marked as answer by L0wL3v3Ls Sunday, May 28, 2017 12:51 PM
    Sunday, May 28, 2017 12:41 PM