I'm working on Debian 9.7.0 without desktop environment. I've made a script to update my packages and I added in /etc/crontab to run on start-up. Here's the script:

apt-get update && apt-get upgrade

When I'm running it manually it works just fine, but on start-up apt-get won't fetch debian url. Here are the logs:

Err:1 http:///ftp.be.debian.org/debian stretch InRelease
  Temporary failure resolving 'ftp.be.debian.org'
Err:2 http://ftp.be.debian.org/debian stretch-updates InRelease
  Temporary failure resolving 'ftp.be.debian.org'
Err:3 http://security.debian.org/debian-security stretch/updates InRelease
  Temporary failure resolving 'security.debian.org'
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

If I'm not mistaken apt-get cannot access the debian servers?

Edit: I also tried to change the servers in /etc/apt/sources.list but I still got the same errors.

Does someone knows how comes and how to deal with it?

I couldn't find any answer, so hopefully this is not a repost. Have a great day.


It looks like this script is running before your network is up.

I would advise using a systemd service which will run at boot, this way to can require it runs once your network is up.

For example:

# /etc/systemd/system/update.service
Description=Apt Update & Upgrade



Then run:

systemctl daemon-reload
systemctl enable update.service

Alternatively, I would probably just use the unattended-upgrades package to do all of this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.