Exercise - Create an Azure Virtual Machine | Unable to run Apt-get update

Daniyal Yaseen 30 Reputation points
2023-01-26T06:39:10.3333333+00:00

Hello Team,

Thanks for the owe-sum training material, further I am unable to run the apt-get update inside of the azure CLI during performing lab "Exercise - Create an Azure Virtual Machine" ,, where I will be ab to get the root or sudo password so that I can run sudo apt-get update?

You prompt response would be appreciated as I am unable to proceed with the training.

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
878 questions
{count} vote

Accepted answer
  1. TP 75,296 Reputation points
    2023-01-26T07:01:48.2733333+00:00

    Hi Daniel,

    In the exercise the extension is supposed to run the sudo apt-get update command for you when you run az vm extension set command. Lately the process has been failing occasionally--you will know it failed if you see lots of errors in your cloud shell after running az vm extension set command. If you don't see these errors, then no need for you to run commands manually.

    If you do see the errors, please follow instructions below:

    You need to ssh to the vm you created before you can use sudo.

    Please activate new sandbox and create the VM as instructed in the exercise. After Task 1 finishes, make a note of the publicIpAddress that was assigned to the VM (e.g. 20.245.72.52). Start Task 2, and then when it errors out, follow steps below:

    Connect to the newly-created VM using ssh (in cloud shell). You will need to substitute the publicIpAddress you noted above for <VM public ip address> below:

    ssh azureuser@<VM public ip address>

    Example: ssh azureuser@20.245.72.52

    Enter yes when you are prompted.

    Copy and right-click -- paste the following three commands below in the cloud shell window. Wait for each to complete before pasting in the next command.

    sudo apt-get update
    
    sudo apt-get install -y nginx
    
    echo "<html><body><h2>Welcome to Azure! My name is $(hostname).</h2></body></html>" | sudo tee -a /var/www/html/index.html
    

    Performing the steps above should only add a couple of minutes to the process. Continue on in the module. If you have any questions please let me know in a comment.

    If this was helpful to you please Accept Answer.

    Thanks.

    -TP

    8 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Huzaifa Tanzeel 105 Reputation points Student Ambassador
    2023-03-18T13:21:28.5333333+00:00

    Initially running the following, note down the highlighted public ip address then proceed till sudo apt-get update and when password is not matched , type ssh azureuser@publicipaddress , substitute your public ip address noted above then press enter -> Type yes -> sudo apt-get update ->....

    az vm create \
      --resource-group learn-5f37f80a-6d89-424d-bb21-07e7429e0b92 \
      --name my-vm \
      --image UbuntuLTS \
      --admin-username azureuser \
      --generate-ssh-keys
    

    errorfind

    errorfind2

    5 people found this answer helpful.