mattintosh note

どこかのエンジニアモドキの備忘録

NanoPi NEO2 の APT サーバを JP サーバに変更

パッケージのアップデートしようと思ったらハッシュ不一致とか出るのでサーバ変更。

デフォルトの /etc/apt/source.list ではサーバは http://ports.ubuntu.com に設定されている。

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ports.ubuntu.com/ubuntu-ports/ xenial universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial universe
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted

deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse

http://jp.archive.ubuntu.com で ARM バイナリのミラーを提供しているとのことなのでこちらを利用させていただく。

$ sudo gzip /etc/apt/sources.list
$ gzip -dc /etc/apt/sources.list.gz | sed '/^deb/s|ports.ubuntu.com|jp.archive.ubuntu.com|' | sudo tee /etc/apt/sources.list

差分。

--- /dev/fd/63   2018-11-10 16:59:09.349566783 +0900
+++ sources.list  2018-11-10 16:58:16.946964003 +0900
@@ -1,35 +1,35 @@
 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
 # newer versions of the distribution.
 
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial main restricted
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial main restricted
 
 ## Major bug fix updates produced after the final release of the
 ## distribution.
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-updates main restricted
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-updates main restricted
 
 ## Uncomment the following two lines to add software from the 'universe'
 ## repository.
 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
 ## team. Also, please note that software in universe WILL NOT receive any
 ## review or updates from the Ubuntu security team.
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial universe
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial universe
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial universe
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial universe
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-updates universe
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-updates universe
 
 ## N.B. software from this repository may not have been tested as
 ## extensively as that contained in the main release, although it includes
 ## newer versions of some applications which may provide useful features.
 ## Also, please note that software in backports WILL NOT receive any review
 ## or updates from the Ubuntu security team.
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
 
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse
-deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-security main restricted
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-security main restricted
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-security universe
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-security universe
+deb http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-security multiverse
+deb-src http://jp.archive.ubuntu.com/ubuntu-ports/ xenial-security multiverse

整形して並べるとこんな感じ。

deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            universe
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            universe
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    universe
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    universe
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-backports  main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-backports  main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   universe
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   universe
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   multiverse
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   multiverse

短い方が管理しやすいかな。

$ gzip /etc/apt/sources.list
$ gzip -dc /etc/apt/sources.list.gz | sed -n '/^deb/s|ports.ubuntu.com|jp.archive.ubuntu.com|p' | column -t | sudo tee /etc/apt/sources.list
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            universe
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial            universe
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    universe
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-updates    universe
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-backports  main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-backports  main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   main        restricted
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   main        restricted
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   universe
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   universe
deb      http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   multiverse
deb-src  http://jp.archive.ubuntu.com/ubuntu-ports/  xenial-security   multiverse