Friday, February 1, 2019

Kali apt-get fail (404 not found), apt-get update fail (not valid yet), Fix=old date

In Kali I was trying to install packages but kept getting this error

root@kali:~# apt-get install libssh-dev
Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libgnutls-dane0 libunbound2
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libssh-4 zlib1g-dev
Suggested packages:
The following NEW packages will be installed:
  libssh-dev zlib1g-dev
The following packages will be upgraded:
1 upgraded, 2 newly installed, 0 to remove and 1472 not upgraded.
Need to get 435 kB/649 kB of archives.
After this operation, 1,651 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 kali-rolling/main amd64 libssh-4 amd64 0.8.5-1
  404  Not Found [IP: 80]
Err:2 kali-rolling/main amd64 libssh-dev amd64 0.8.5-1
  404  Not Found [IP: 80]
E: Failed to fetch  404  Not Found [IP: 80]
E: Failed to fetch  404  Not Found [IP: 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

When I tried the update I got this error

root@kali:~# apt-get update
Get:1 kali-rolling InRelease [30.5 kB]
Reading package lists... Done     
E: Release file for is not valid yet (invalid for another 41d 16h 53min 30s). Updates for this repository will not be applied.

When I ran date I realized is was many days behind

root@kali:~# date

The fix was to install ntpdate and run it

root@kali:~# apt-get install ntpdate
root@kali:~# ntpdate

Now my date was correct

root@kali:~# date

And now my installs worked

root@kali:~# apt-get install libssh-dev