R. Ayanokouzi et al.

[debian] リモートアップグレード作業メモ (stretch から buster)

リモートで stretch から buster へアップグレード。ssh で対象のマシンにログインして作業。

アップグレードを繰り返していると古いパッケージが残る。これらを検索して削除。aptitude と apt-forktracer とで出力が違うことに注意。

# aptitude search '?and( ?installed, ?not( ?origin(Debian) ) )'
i A cpp-4.9             - GNU C preprocessor
i   fonts-droid         - handheld device font with extensive style and language support
i A gcc-4.9             - GNU C compiler
i A gcc-4.9-base        - GCC, the GNU Compiler Collection (base package)
i A gfortran-4.9        - GNU Fortran compiler
i   libapt-inst1.5      - deb package format runtime library
i   libapt-pkg4.12      - package management runtime library
i A libasan1            - AddressSanitizer -- a fast memory error detector
i   libept1.4.12        - High-level library for managing Debian package information
i A libgcc-4.9-dev      - GCC support library (development files)
i A libgfortran-4.9-dev - Runtime library for GNU Fortran applications (development files)
i   libgraphite3        - SILGraphite - a "smart font" rendering engine
i A libisl10            - manipulating sets and relations of integer points bounded by linear constraints
i   libnettle4          - low level cryptographic library (symmetric and one-way cryptos)
i   libreadline6        - GNU readline and history libraries, run-time libraries
i A libruby2.1          - Libraries necessary to run Ruby 2.1
i A libsp1c2            - Runtime library for James Clark's SP suite
i   libssl1.0.0         - Secure Sockets Layer toolkit - shared libraries
i A libstdc++-4.9-dev   - GNU Standard C++ Library v3 (development files)
i   libxapian22         - Search engine library
i   python-reportbug    - Python modules for interacting with bug tracking systems
i   python-support      - automated rebuilding support for Python modules
i A ruby2.1             - Interpreter of object-oriented scripting language Ruby
i A sp                  - James Clark's SGML parsing tools
i   sysvinit            - System-V-like init utilities - transitional package
i   w3c-dtd-xhtml       - W3C eXtensible HyperText Markup Language (XHTML) DTD
# apt-forktracer | sort
cpp-4.9 (4.9.2-10)
fonts-droid (1:4.4.4r2-6)
gcc-4.9 (4.9.2-10)
gcc-4.9-base (4.9.2-10)
gfortran-4.9 (4.9.2-10)
libapt-inst1.5 (
libapt-pkg4.12 (
libasan1 (4.9.2-10)
libept1.4.12 (
libgcc-4.9-dev (4.9.2-10)
libgfortran-4.9-dev (4.9.2-10)
libgraphite3 (1:2.3.1-0.2)
libisl10 (0.12.2-2)
libnettle4 (2.7.1-5+deb8u2)
libreadline6 (6.3-8+b3)
libruby2.1 (2.1.5-2+deb8u3)
libsp1c2 (1.3.4-1.2.1-47.3)
libssl1.0.0 (1.0.1t-1+deb8u6)
libstdc++-4.9-dev (4.9.2-10)
libxapian22 (1.2.19-1+deb8u1)
linux-image-4.9.0-8-amd64 (4.9.144-3) [Debian: 4.9.110-3+deb9u6]
python-reportbug (6.6.3)
python-support (1.0.15)
ruby2.1 (2.1.5-2+deb8u3)
sp (1.3.4-1.2.1-47.3)
sysvinit (2.88dsf-59)
w3c-dtd-xhtml (1.2-4)
# apt-get purge $(aptitude --display-format '%p' --disable-columns search '?and( ?installed, ?not( ?origin(Debian) ) )')
# apt-get purge linux-image-4.9.0-8-amd64

apt souces list で参照されているリポジトリをチェックして、proposed-updates がないことを確認。

# grep --regexp='^deb' /etc/apt/sources.list /etc/apt/sources.list.d/* 2> /dev/null
/etc/apt/sources.list:deb http://ftp.jp.debian.org/debian stretch main
/etc/apt/sources.list:deb-src http://ftp.jp.debian.org/debian stretch main
/etc/apt/sources.list:deb http://security.debian.org/ stretch/updates main
/etc/apt/sources.list:deb-src http://security.debian.org/ stretch/updates main

apt souces list で参照されているリポジトリを buster のものに変更。

# grep --regexp='^deb' /etc/apt/sources.list /etc/apt/sources.list.d/* 2> /dev/null
/etc/apt/sources.list:deb http://ftp.jp.debian.org/debian buster main
/etc/apt/sources.list:deb-src http://ftp.jp.debian.org/debian buster main
/etc/apt/sources.list:deb http://security.debian.org/ buster/updates main
/etc/apt/sources.list:deb-src http://security.debian.org/ buster/updates main


# apt update
Get:1 http://ftp.jp.debian.org/debian buster InRelease [118 kB]
Get:2 http://ftp.jp.debian.org/debian buster/main Sources [7,827 kB]
Get:3 http://security.debian.org buster/updates InRelease [39.1 kB]
Get:4 http://security.debian.org buster/updates/main Sources [25.9 kB]
Get:5 http://security.debian.org buster/updates/main amd64 Packages [52.2 kB]
Get:6 http://security.debian.org buster/updates/main Translation-en [28.9 kB]
Get:7 http://ftp.jp.debian.org/debian buster/main amd64 Packages [7,897 kB]
Get:8 http://ftp.jp.debian.org/debian buster/main Translation-en [5,967 kB]
Fetched 22.0 MB in 6s (3,316 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1096 packages can be upgraded. Run 'apt list --upgradable' to see them.


# apt -o APT::Get::Trivial-Only=true full-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
The following NEW packages will be installed:
The following packages will be upgraded:
1096 upgraded, 221 newly installed, 12 to remove and 0 not upgraded.
Need to get 2,363 MB of archives.
After this operation, 1,804 MB of additional disk space will be used.
E: You don't have enough free space in /var/cache/apt/archives/.
# apt purge $(deborphan)

二段階アップグレードの1段階目 upgrade を行う。

# apt-get upgrade

apt cleanしてキャッシュを削除した後、二段階アップグレードの2段階目 full-upgrade を行う。

# apt clean
# apt-get full-upgrade


# shutdown -r

システムが degraded モードでないこと、エラーが出ないことを確認。アップデートによって設定ファイルが変わった場合などこれは、apt以外のパッケージシステム(pipとかcpanとか)に依存するデーモンを走らせている場合には必須

# systemctl status
# systemctl
# journalctl --boot --follow

sshd がファイルが見つからないエラーを出していた。/etc/ssh/sshd_config をメンテナの提供するものに差し替えたため。dpkg-reconfigure openssh-server で解決。

# journalctl --boot --unit=ssh
Aug 04 13:25:02 XXXXXXXXXXXXXXXX sshd[3441]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Aug 04 13:25:02 XXXXXXXXXXXXXXXX sshd[3441]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
# dpkg-reconfigure openssh-server

diskが見つからず、swapが無効になっていた。swap 領域を変更していたのを忘れていたため。アップデートとは無関係。/etc/fstab 内の swap エントリ AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE を aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee に変更。再起動してswap状態確認。

# journalctl --boot --follow
Aug 04 13:38:12 XXXXXXXXXXXXXXXX systemd[1]: dev-disk-by\x2duuid-AAAAAAAA\x2dBBBB\x2dCCCC\x2dDDDD\x2dEEEEEEEEEEEE.device: Job dev-disk-by\x2duuid-AAAAAAAA\x2dBBBB\x2dCCCC\x2dDDDD\x2dEEEEEEEEEEEE.device/start timed out.
Aug 04 13:38:12 XXXXXXXXXXXXXXXX systemd[1]: Timed out waiting for device /dev/disk/by-uuid/AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE.
Aug 04 13:38:12 XXXXXXXXXXXXXXXX systemd[1]: Dependency failed for /dev/disk/by-uuid/AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE.
Aug 04 13:38:12 XXXXXXXXXXXXXXXX systemd[1]: dev-disk-by\x2duuid-AAAAAAAA\x2dBBBB\x2dCCCC\x2dDDDD\x2dEEEEEEEEEEEE.swap: Job dev-disk-by\x2duuid-AAAAAAAA\x2dBBBB\x2dCCCC\x2dDDDD\x2dEEEEEEEEEEEE.swap/start failed with result 'dependency'.
Aug 04 13:38:12 XXXXXXXXXXXXXXXX systemd[1]: dev-disk-by\x2duuid-AAAAAAAA\x2dBBBB\x2dCCCC\x2dDDDD\x2dEEEEEEEEEEEE.device: Job dev-disk-by\x2duuid-AAAAAAAA\x2dBBBB\x2dCCCC\x2dDDDD\x2dEEEEEEEEEEEE.device/start failed with result 'timeout'.
# swapon --show
# blkid
/dev/vda3: UUID="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" TYPE="swap" PARTUUID="XXXXXXXX-YY"
# vi /etc/fstab
# systemctl reboot
# swapon --show
/dev/vda3 partition   2G   0B   -2

レガシーネットワークインターフェイス名の移行。 /etc/systemd/network 以下にある 99-default.link と 50-virtio-kernel-names.link を適切にリネームして、/etc/network/interfaces 内の eth0 を ens3 に書き換えて、再起動。

cd /etc/systemd/network
# mv 99-default.link _99-default.link
# mv 50-virtio-kernel-names.link _50-virtio-kernel-names.link
# vi /etc/network/interfaces
(snip) eth0 を ens3 に書き換え
# update-initramfs -u
# shutdown -r
# systemctl status
# systemctl
# journalctl --boot --follow --unit ssh.service
# journalctl --boot --follow --unit ddclient.service
# journalctl --boot --follow --unit nmbd.service --unit smbd.service

ちょっと困る。外向きのインターフェイスに ipv6 を使っているとgmailへのアクセスがログインエラーでるのはちょっと問題。今の所ipv4だけを使ってるからいいけど。


  1. 第4章 Debian 9 (stretch) からのアップグレード
  2. Search term reference


  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us


  1. Posted: 2007-09-20T12:28:26+09:00
  2. Modified: 2007-09-20T12:28:26+09:00
  3. Generated: 2021-03-31T07:51:36+09:00