No Internet on Custom Image VM for Azure












1















I launched an Ubuntu 18.04 VM with Azure. I installed a bunch of stuff that I need. Then, I used the dashboard to create a custom image from this machine. After that, I checked that the image was okay by launching some machines with that image. Everything seemed to be working fine.



Today, I launched a new instance with my custom image. Then I tried to install a few things with apt-get install and I get the following error (e.g. for unzip):



sudo: unable to resolve host ABCDEFG: Resource temporarily unavailable
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package unzip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'unzip' has no installation candidate


This same thing happens for any package I try to install. After testing some basic things with my repositories, I checked the internet connection with ping. E.g. ping www.google.com which is also not working. I launched a vanilla Ubuntu 18.04 instance and I am not having these problems with that machine.



I have also tried sudo reboot but no luck with that. I did notice that when the system booted it shows the following error, also indicating that something is wrong with the internet:



Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings


Any help is greatly appreciated.










share|improve this question

























  • If the answer is helpful you can accept it.

    – Charles Xu
    Oct 10 '18 at 1:02
















1















I launched an Ubuntu 18.04 VM with Azure. I installed a bunch of stuff that I need. Then, I used the dashboard to create a custom image from this machine. After that, I checked that the image was okay by launching some machines with that image. Everything seemed to be working fine.



Today, I launched a new instance with my custom image. Then I tried to install a few things with apt-get install and I get the following error (e.g. for unzip):



sudo: unable to resolve host ABCDEFG: Resource temporarily unavailable
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package unzip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'unzip' has no installation candidate


This same thing happens for any package I try to install. After testing some basic things with my repositories, I checked the internet connection with ping. E.g. ping www.google.com which is also not working. I launched a vanilla Ubuntu 18.04 instance and I am not having these problems with that machine.



I have also tried sudo reboot but no luck with that. I did notice that when the system booted it shows the following error, also indicating that something is wrong with the internet:



Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings


Any help is greatly appreciated.










share|improve this question

























  • If the answer is helpful you can accept it.

    – Charles Xu
    Oct 10 '18 at 1:02














1












1








1








I launched an Ubuntu 18.04 VM with Azure. I installed a bunch of stuff that I need. Then, I used the dashboard to create a custom image from this machine. After that, I checked that the image was okay by launching some machines with that image. Everything seemed to be working fine.



Today, I launched a new instance with my custom image. Then I tried to install a few things with apt-get install and I get the following error (e.g. for unzip):



sudo: unable to resolve host ABCDEFG: Resource temporarily unavailable
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package unzip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'unzip' has no installation candidate


This same thing happens for any package I try to install. After testing some basic things with my repositories, I checked the internet connection with ping. E.g. ping www.google.com which is also not working. I launched a vanilla Ubuntu 18.04 instance and I am not having these problems with that machine.



I have also tried sudo reboot but no luck with that. I did notice that when the system booted it shows the following error, also indicating that something is wrong with the internet:



Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings


Any help is greatly appreciated.










share|improve this question
















I launched an Ubuntu 18.04 VM with Azure. I installed a bunch of stuff that I need. Then, I used the dashboard to create a custom image from this machine. After that, I checked that the image was okay by launching some machines with that image. Everything seemed to be working fine.



Today, I launched a new instance with my custom image. Then I tried to install a few things with apt-get install and I get the following error (e.g. for unzip):



sudo: unable to resolve host ABCDEFG: Resource temporarily unavailable
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package unzip is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'unzip' has no installation candidate


This same thing happens for any package I try to install. After testing some basic things with my repositories, I checked the internet connection with ping. E.g. ping www.google.com which is also not working. I launched a vanilla Ubuntu 18.04 instance and I am not having these problems with that machine.



I have also tried sudo reboot but no luck with that. I did notice that when the system booted it shows the following error, also indicating that something is wrong with the internet:



Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings


Any help is greatly appreciated.







azure azure-virtual-machine






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 9 '18 at 8:56









Charles Xu

4,3981210




4,3981210










asked Oct 8 '18 at 20:31









Jomnipotent17Jomnipotent17

157420




157420













  • If the answer is helpful you can accept it.

    – Charles Xu
    Oct 10 '18 at 1:02



















  • If the answer is helpful you can accept it.

    – Charles Xu
    Oct 10 '18 at 1:02

















If the answer is helpful you can accept it.

– Charles Xu
Oct 10 '18 at 1:02





If the answer is helpful you can accept it.

– Charles Xu
Oct 10 '18 at 1:02












2 Answers
2






active

oldest

votes


















1














When you create the custom image follow the step Deprovision the VM in the Azure VM, it will remove the file /etc/resolv.conf, so when you create a new Azure VM from the custom image, it cannot resolve the Domain name.



Hope this will help you to understand it.






share|improve this answer































    1














    So, after some digging around, I found this answer to something similar: https://askubuntu.com/questions/1045278/ubuntu-server-18-04-temporary-failure-in-name-resolution.



    I used the following command and the internet started working again:



    sudo ln -s ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf


    This is a little different than the answer on askubuntu because this is on an Azure image. First, I noticed that my image was missing resolv.conf in /etc. Using ls -la /etc/resolv.conf on a different azure image, I saw that it was a symbolic link to ../run/systemd/resolve/stub-resolve.conf, so I created a link that matched this format on my machine and that fixed things.



    ** EDIT **
    It's worth noting that when you deprovision the VM to create the custom image, it does say:




    WARNING! The waagent service will be stopped.



    WARNING! Cached DHCP leases will be deleted.



    WARNING! root password will be disabled. You will not be able to login as root.



    WARNING! /etc/resolv.conf will be deleted.



    WARNING! xxxx account and entire home directory will be deleted.







    share|improve this answer


























    • absolute hero! I was searching for this for ages. Same thing happened to me: created a custom image from Ubuntu on Azure. Made sure I deprovisioned properly with sudo waagent -deprovision+user -force then spun up a new VM but sudo constantly gave sudo: unable to resolve host XXX: Resource temporarily unavailable even though hostname was correct in /etc/hostname and /etc/hosts was default which worked prior to deprovisioning.

      – theyetiman
      Nov 22 '18 at 10:20











    • I am glad this was able to help others besides myself. Cheers @theyetiman

      – Jomnipotent17
      Nov 22 '18 at 15:24











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52709696%2fno-internet-on-custom-image-vm-for-azure%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    When you create the custom image follow the step Deprovision the VM in the Azure VM, it will remove the file /etc/resolv.conf, so when you create a new Azure VM from the custom image, it cannot resolve the Domain name.



    Hope this will help you to understand it.






    share|improve this answer




























      1














      When you create the custom image follow the step Deprovision the VM in the Azure VM, it will remove the file /etc/resolv.conf, so when you create a new Azure VM from the custom image, it cannot resolve the Domain name.



      Hope this will help you to understand it.






      share|improve this answer


























        1












        1








        1







        When you create the custom image follow the step Deprovision the VM in the Azure VM, it will remove the file /etc/resolv.conf, so when you create a new Azure VM from the custom image, it cannot resolve the Domain name.



        Hope this will help you to understand it.






        share|improve this answer













        When you create the custom image follow the step Deprovision the VM in the Azure VM, it will remove the file /etc/resolv.conf, so when you create a new Azure VM from the custom image, it cannot resolve the Domain name.



        Hope this will help you to understand it.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 9 '18 at 8:47









        Charles XuCharles Xu

        4,3981210




        4,3981210

























            1














            So, after some digging around, I found this answer to something similar: https://askubuntu.com/questions/1045278/ubuntu-server-18-04-temporary-failure-in-name-resolution.



            I used the following command and the internet started working again:



            sudo ln -s ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf


            This is a little different than the answer on askubuntu because this is on an Azure image. First, I noticed that my image was missing resolv.conf in /etc. Using ls -la /etc/resolv.conf on a different azure image, I saw that it was a symbolic link to ../run/systemd/resolve/stub-resolve.conf, so I created a link that matched this format on my machine and that fixed things.



            ** EDIT **
            It's worth noting that when you deprovision the VM to create the custom image, it does say:




            WARNING! The waagent service will be stopped.



            WARNING! Cached DHCP leases will be deleted.



            WARNING! root password will be disabled. You will not be able to login as root.



            WARNING! /etc/resolv.conf will be deleted.



            WARNING! xxxx account and entire home directory will be deleted.







            share|improve this answer


























            • absolute hero! I was searching for this for ages. Same thing happened to me: created a custom image from Ubuntu on Azure. Made sure I deprovisioned properly with sudo waagent -deprovision+user -force then spun up a new VM but sudo constantly gave sudo: unable to resolve host XXX: Resource temporarily unavailable even though hostname was correct in /etc/hostname and /etc/hosts was default which worked prior to deprovisioning.

              – theyetiman
              Nov 22 '18 at 10:20











            • I am glad this was able to help others besides myself. Cheers @theyetiman

              – Jomnipotent17
              Nov 22 '18 at 15:24
















            1














            So, after some digging around, I found this answer to something similar: https://askubuntu.com/questions/1045278/ubuntu-server-18-04-temporary-failure-in-name-resolution.



            I used the following command and the internet started working again:



            sudo ln -s ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf


            This is a little different than the answer on askubuntu because this is on an Azure image. First, I noticed that my image was missing resolv.conf in /etc. Using ls -la /etc/resolv.conf on a different azure image, I saw that it was a symbolic link to ../run/systemd/resolve/stub-resolve.conf, so I created a link that matched this format on my machine and that fixed things.



            ** EDIT **
            It's worth noting that when you deprovision the VM to create the custom image, it does say:




            WARNING! The waagent service will be stopped.



            WARNING! Cached DHCP leases will be deleted.



            WARNING! root password will be disabled. You will not be able to login as root.



            WARNING! /etc/resolv.conf will be deleted.



            WARNING! xxxx account and entire home directory will be deleted.







            share|improve this answer


























            • absolute hero! I was searching for this for ages. Same thing happened to me: created a custom image from Ubuntu on Azure. Made sure I deprovisioned properly with sudo waagent -deprovision+user -force then spun up a new VM but sudo constantly gave sudo: unable to resolve host XXX: Resource temporarily unavailable even though hostname was correct in /etc/hostname and /etc/hosts was default which worked prior to deprovisioning.

              – theyetiman
              Nov 22 '18 at 10:20











            • I am glad this was able to help others besides myself. Cheers @theyetiman

              – Jomnipotent17
              Nov 22 '18 at 15:24














            1












            1








            1







            So, after some digging around, I found this answer to something similar: https://askubuntu.com/questions/1045278/ubuntu-server-18-04-temporary-failure-in-name-resolution.



            I used the following command and the internet started working again:



            sudo ln -s ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf


            This is a little different than the answer on askubuntu because this is on an Azure image. First, I noticed that my image was missing resolv.conf in /etc. Using ls -la /etc/resolv.conf on a different azure image, I saw that it was a symbolic link to ../run/systemd/resolve/stub-resolve.conf, so I created a link that matched this format on my machine and that fixed things.



            ** EDIT **
            It's worth noting that when you deprovision the VM to create the custom image, it does say:




            WARNING! The waagent service will be stopped.



            WARNING! Cached DHCP leases will be deleted.



            WARNING! root password will be disabled. You will not be able to login as root.



            WARNING! /etc/resolv.conf will be deleted.



            WARNING! xxxx account and entire home directory will be deleted.







            share|improve this answer















            So, after some digging around, I found this answer to something similar: https://askubuntu.com/questions/1045278/ubuntu-server-18-04-temporary-failure-in-name-resolution.



            I used the following command and the internet started working again:



            sudo ln -s ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf


            This is a little different than the answer on askubuntu because this is on an Azure image. First, I noticed that my image was missing resolv.conf in /etc. Using ls -la /etc/resolv.conf on a different azure image, I saw that it was a symbolic link to ../run/systemd/resolve/stub-resolve.conf, so I created a link that matched this format on my machine and that fixed things.



            ** EDIT **
            It's worth noting that when you deprovision the VM to create the custom image, it does say:




            WARNING! The waagent service will be stopped.



            WARNING! Cached DHCP leases will be deleted.



            WARNING! root password will be disabled. You will not be able to login as root.



            WARNING! /etc/resolv.conf will be deleted.



            WARNING! xxxx account and entire home directory will be deleted.








            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 6 '18 at 16:15









            theyetiman

            5,51422133




            5,51422133










            answered Oct 8 '18 at 22:15









            Jomnipotent17Jomnipotent17

            157420




            157420













            • absolute hero! I was searching for this for ages. Same thing happened to me: created a custom image from Ubuntu on Azure. Made sure I deprovisioned properly with sudo waagent -deprovision+user -force then spun up a new VM but sudo constantly gave sudo: unable to resolve host XXX: Resource temporarily unavailable even though hostname was correct in /etc/hostname and /etc/hosts was default which worked prior to deprovisioning.

              – theyetiman
              Nov 22 '18 at 10:20











            • I am glad this was able to help others besides myself. Cheers @theyetiman

              – Jomnipotent17
              Nov 22 '18 at 15:24



















            • absolute hero! I was searching for this for ages. Same thing happened to me: created a custom image from Ubuntu on Azure. Made sure I deprovisioned properly with sudo waagent -deprovision+user -force then spun up a new VM but sudo constantly gave sudo: unable to resolve host XXX: Resource temporarily unavailable even though hostname was correct in /etc/hostname and /etc/hosts was default which worked prior to deprovisioning.

              – theyetiman
              Nov 22 '18 at 10:20











            • I am glad this was able to help others besides myself. Cheers @theyetiman

              – Jomnipotent17
              Nov 22 '18 at 15:24

















            absolute hero! I was searching for this for ages. Same thing happened to me: created a custom image from Ubuntu on Azure. Made sure I deprovisioned properly with sudo waagent -deprovision+user -force then spun up a new VM but sudo constantly gave sudo: unable to resolve host XXX: Resource temporarily unavailable even though hostname was correct in /etc/hostname and /etc/hosts was default which worked prior to deprovisioning.

            – theyetiman
            Nov 22 '18 at 10:20





            absolute hero! I was searching for this for ages. Same thing happened to me: created a custom image from Ubuntu on Azure. Made sure I deprovisioned properly with sudo waagent -deprovision+user -force then spun up a new VM but sudo constantly gave sudo: unable to resolve host XXX: Resource temporarily unavailable even though hostname was correct in /etc/hostname and /etc/hosts was default which worked prior to deprovisioning.

            – theyetiman
            Nov 22 '18 at 10:20













            I am glad this was able to help others besides myself. Cheers @theyetiman

            – Jomnipotent17
            Nov 22 '18 at 15:24





            I am glad this was able to help others besides myself. Cheers @theyetiman

            – Jomnipotent17
            Nov 22 '18 at 15:24


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52709696%2fno-internet-on-custom-image-vm-for-azure%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith