PC内の日付が狂ってapt update出来ない(解決)

またもや読者置いてけぼりの覚え書きをしておきますよ。

Debian 12が入った非力なサーバーへデプロイメントできるかテストをしていたら、まず最小限のコンポーネントしかないイメージだったため、なんとPython3が入っていないという驚きの状況。

しょうがねーなーと

apt update

としてみると、

Get:1 http://deb.debian.org/debian bookworm InRelease [129 kB]
Get:2 http://deb.debian.org/debian bookworm-backports InRelease [37.0 kB]
Reading package lists... Done
E: Release file for http://deb.debian.org/debian/dists/bookworm/InRelease is not valid yet (invalid for another 12d 20h 56min 57s). Updates for this repository will not be applied.

はぁ???

どうやらサーバーのハードウェア内の日付設定がおかしいらしい。

date

dateコマンドをやってみると一ヶ月くらい前の日付がでたw

apt install ntp

で時刻サーバーで時刻を更新したら治ったというカキコがあるが、そもそもaptコマンドが働かないのに、なぜこれが出来るというのだ・・・・と途方に暮れそうになるも

date -s '2021-12-02 23:24:00'

みたいに手動で大体の日付と時刻を設定できるのだそうな。

これでようやく

apt update && apt upgrade

が出来て

apt install python3
apt install python3-venv
apt install python-is-python3

が可能になった。

なんだったんだ・・・・