sudo apt-get update error on BeagleBone Black - beagleboneblack

I am using my Beaglebone Black rev C with the latest debian image installed. I have ssh'ed into it by connecting the ethernet ports and usb-ports of my laptop and my Beaglebone. My laptop has perfectly working wifi. After connecting into my Beaglebone and trying to update it, it gives me this error
Err:1 http://repos.rcn-ee.com/debian stretch InRelease
Temporary failure resolving 'repos.rcn-ee.com'
Err:2 http://deb.debian.org/debian stretch InRelease
Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian stretch-updates InRelease
Temporary failure resolving 'deb.debian.org'
Err:4 http://deb.debian.org/debian-security stretch/updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian-security/dists/stretch/updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://repos.rcn-ee.com/debian/dists/stretch/InRelease Temporary failure resolving 'repos.rcn-ee.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
I also checked by pinging to deb.debian.org, but it gives me
ping: deb.debian.org: Temporary failure in name resolution
I am using ubuntu gnome 16.03.04 LTS.Please give a solution to this issue.

While going through the same problem, I found the following website:
How to Connect a Beaglebone Black to the Internet via USB
Basically, you have to define a default gateway, define a default DNS, NTP Server to correct time, etc.
The biggest problem as also stated by the author is following commands cannot survive rebooting
/sbin/route add default gw 192.168.7.1
/usr/sbin/ntpdate pool.ntp.org
The problem can be solved including these commands into .bashrc, and for that please look for the related topic in AskUbuntu. Please note that, most of these options are very risky by default since it includes running sudo without a password.

Related

apt-get update failed, but exit status is still success, this broke my docker cache

Here is an important part of docker build log
#6 [stage-1 2/20] RUN apt-get -y update && apt-get -y upgrade
#6 sha256:6a65c591472319f4cf0c6954f890ee1d5e465b9b12670d78dd15e738cf4bd37d
#6 31.57 Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
#6 31.57 Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out
#6 31.57 Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
#6 31.57 Unable to connect to archive.ubuntu.com:http:
#6 31.57 Err:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
#6 31.57 Unable to connect to archive.ubuntu.com:http:
#6 32.00 Err:4 http://security.ubuntu.com/ubuntu focal-security InRelease
#6 32.00 Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out
#6 32.02 Reading package lists...
#6 32.04 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out
#6 32.04 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease Unable to connect to archive.ubuntu.com:http:
#6 32.04 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease Unable to connect to archive.ubuntu.com:http:
#6 32.04 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out
#6 32.04 W: Some index files failed to download. They have been ignored, or old ones used instead.
#6 32.06 Reading package lists...
#6 32.08 Building dependency tree...
#6 32.08 Reading state information...
#6 32.08 Calculating upgrade...
#6 32.08 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#6 DONE 32.3s
As you can see there are some errors, but for some reason docker considered that both commands ended with success: #6 DONE 32.3s.
This corrupted my Docker cache and created problems on build machine.
Question
Now question is not how to fix this step, this is cover by other SO questions (other).
How I can prevent this problem and force apt-get to report error (none zero exit code). In my case problem was temporary network problem and this corrupted docker cache. I've cleared cached to fix the issue, but how to prevent this problem to repeat in a future?
Those are not considered errors, but Warnings, as you can see by the W in front of the line.
You can make apt-get update fail hard with adding the following -o APT::Update::Error-Mode=any
Any failling commad on a POSIX operating system (linux, unix....) returns a code, 0 for success anything else for error.
This value is stored in the '$?' variable, but you can directly branch off your shell script with || for or and && for an and.
apt upgrade || echo "\e[31mERROR running APT \!\e[0m"
the \e gives you all kinds of formatting options color, bold, underscore etc... https://misc.flogisoft.com/bash/tip_colors_and_formatting

Error in Dockerfile + Temporary failure resolving 'deb.debian.org'

I have a Dockerfile but it gets an error when I want to build it. my Dockerfile is :
FROM php:7.4.8-fpm
ENV APP_HOME /var/www/html
# install all the dependencies and enable PHP modules
RUN apt-get update && apt-get upgrade -y && apt-get install -y
I get the following errors:
Err:1 http://httpredir.debian.org/debian jessie-backports InRelease
Temporary failure resolving 'httpredir.debian.org'
Err:2 http://security.debian.org/debian-security buster/updates InRelease
Temporary failure resolving 'security.debian.org'
Err:3 http://deb.debian.org/debian buster InRelease
Temporary failure resolving 'deb.debian.org'
Err:4 http://deb.debian.org/debian buster-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-backports/InRelease Temporary failure resolving 'httpredir.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Docker build failing on private hosted agent (Azure DevOps)

I am trying to build a dockerfile on a private-hosted Azure DevOps agent, which is behind a corporate proxy. The base image is python/3.8.3-slim-buster. When I run apt-get update I get the following errors:
Err:1 http://deb.debian.org/debian buster InRelease
470 status code 470 [IP: 151.101.36.204 80]
Err:2 http://security.debian.org/debian-security buster/updates InRelease
470 status code 470 [IP: 151.101.36.204 80]
Err:3 http://deb.debian.org/debian buster-updates InRelease
470 status code 470 [IP: 151.101.36.204 80]
Reading package lists...
E: The repository 'http://deb.debian.org/debian buster InRelease' is not signed.
E: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease 470 status code 470 [IP: 151.101.36.204 80]
E: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease 470 status code 470 [IP: 151.101.36.204 80]
E: The repository 'http://security.debian.org/debian-security buster/updates InRelease' is not signed.
E: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease 470 status code 470 [IP: 151.101.36.204 80]
E: The repository 'http://deb.debian.org/debian buster-updates InRelease' is not signed.
Now the tricky part is that if I log in to this agent manually, and give the docker build command there it works fine. Also building on a Microsoft hosted agent works fine.
I pass the proxy configuration with --build-arg flags to the Dockerfile.
Anyone any idea where the error could be?
Edit:
I tried adding the "--allow-releaseinfo-change" flag, still the same error. I have the feeling it somehow proxy related but can't figure out where to start looking.
Today I learned apt-get keeps the proxy-configuration somewhere else, as in my environment variables HTTP_PROXY & HTTPS_PROXY were not picked up.
Creating a proxy.conf and copying that to the container solved my problem as mentioned here:
https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-the-proxy-for-apt-for-ubuntu-18-04/

Dockerfile apt-get install - 503 service unavailable

Does anyone have a robust solution to prevent periodic 503 service unavailable errors from apt-get in a Dockerfile?
I've tried pointing to different mirrors in the /etc/apt/services.list file, but this sometimes causes other issues (warnings/errors relating to unsigned repositories, for example).
I'd like to use the APT::Acquire::Retries (or is it just Acquire::Retries?) option in either my apt.conf file or as a separate file in the /etc/apt/apt.conf.d directory, but no matter how I write it (e.g., APT::Acquire::Retries "20";) it doesn't seem to help. The man page explanation is here. My Dockerfile builds still fail after a 503, and I don't see any indication that it is using multiple retries.
Here's a snippet of the error message, if that helps. Note that a few lines it pulled successfully from the same server, a few lines above the error. Also if I go to the server FTP page in my browser, I can download the same package that fails the Dockerfile build.
Output snippet:
Get:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 xfonts-encodings all 1:1.0.4-2 [573 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 xfonts-utils amd64 1:7.7+3ubuntu0.16.04.2 [74.6 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/main amd64 xfonts-base all 1:1.0.4+nmu1 [5914 kB]
Err:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 xserver-common all 2:1.18.4-0ubuntu0.8
503 Service Unavailable [IP: 91.189.91.23 80]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 xvfb amd64 2:1.18.4-0ubuntu0.8 [777 kB]
[91mE: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/x/xorg-server/xserver-common_1.18.4-0ubuntu0.8_all.deb 503 Service Unavailable [IP: 91.189.91.23 80]
p.s. It doesn't just happen with xvfb - that just happens to be the one I copied here.
Thoughts? Thanks!
I found that there is a lot of confusion between APT::Acquire::Retries and Acquire::Retries, but the latter works for me. i.e.
echo 'Acquire::Retries "20";' > /etc/apt/apt.conf.d/80-retries;

Proxy for docker under windows 10 only works for http, but not for https

for quite a while I try to build a Dockerfile, but get therefore I need necessary not packages from Nvidia, which are fetched from a https link.
Since this I have to use proxy I set the following variables in the dockerfile:
ENV http_proxy http://proxy:0000
ENV https_proxy https://user:password#proxy:0000
If I do not add a user and a password to the https proxy, then I get the HTTP 407 error , which means an authentication failure. If I include a use and password I get the following error:
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [801 kB]
Ign:6 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 InRelease
.
.
.
Ign:24 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Packages
Ign:16 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Packages
Ign:24 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Packages
Ign:16 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Packages
Ign:24 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Packages
Ign:16 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Packages
Ign:24 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Packages
Err:16 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Packages
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Err:24 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Packages
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Fetched 15.7 MB in 3s (3984 kB/s)
Reading package lists...
W: The repository 'https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Release' does not have a Release file.
W: The repository 'https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Release' does not have a Release file.
E: Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
E: Failed to fetch https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
E: Some index files failed to download. They have been ignored, or old ones used instead.
So the proxy for http works, but not for https. I guess it is something with the ssl certificates as metnioned in the rror, but I can not find anything useful for this topic. Btw. this is a windows issue, obviously under Linux everything worked fine.

Resources