spurin / diveintoansible-lab

Dive Into Ansible Lab
788 stars 498 forks source link

connection refused for "sudo apt update" #62

Closed beckyjmcdabq closed 2 years ago

beckyjmcdabq commented 2 years ago

I love this course!

I've been following along and am trying to update "ubuntu-c" with sudo apt update but I'm getting an error:

ansible@ubuntu-c:~$ sudo apt update
[sudo] password for ansible: 
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease                                                  
  Could not connect to archive.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused)
Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease                                          
  Unable to connect to archive.ubuntu.com:http:
Err:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease                                        
  Unable to connect to archive.ubuntu.com:http:
Err:4 http://security.ubuntu.com/ubuntu focal-security InRelease                                        
  Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused)
Reading package lists... Done                        
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Could not connect to archive.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Could not connect to archive.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused)
W: Some index files failed to download. They have been ignored, or old ones used instead.

I am running this lab from behind a proxy. From a web browser, I can navigate to archive.ubuntu.com and am presented with Index of /.

What can I do to get ubuntu-c updated so I can install ssh-pass?

beckyjmcdabq commented 2 years ago

I figured it out ... I needed to add the proxies to /etc/apt/apt.conf.d/proxy.conf

spurin commented 2 years ago

Hi @beckyjmcdabq

Thanks for your comments! Looks like you've resolved this by the time I've seen it.

Hope you enjoy the rest of the course. Any further issues then you know how to reach me.

Best Regards

James Spurin

beckyjmcdabq commented 2 years ago

I had the same issue when trying to clone the diveintoansible repo. I had to add proxy information to git: git config --global http.proxy http_proxy=http://username:password@proxy.xxx.xxx:80/ and then I was able to clone.

Most people are probably not doing this lab behind a proxy.

spurin commented 2 years ago

Thanks @beckyjmcdabq

Hopefully you won't have any further issues or at least, if you do will be able to resolve them with a proxy tweak 😁

An option as an alternative if you have problems is the following -

https://github.com/spurin/diveintoansible-lab-gcp-cloudshell

I've literally just got this working/configured today so mileage may vary, but in my testing it's working very well! Depending on your access, this could also be a good option for you. I'll be making reference to this in an update to the course soon.

In short, I've customised a Google Cloudshell image with the lab environment.

With a standard/free Google account you can start a Cloudshell instance at no cost, using this lab image. It's just a couple of steps that appear in the tutorial pane as it starts 👍

As I say, you may not need it but good as a backup. Worth a try if you're interested.

Best Regards

James Spurin