Product SiteDocumentation Site

6.7. 安定版から次のディストリビューションへのアップグレード

Debian の最もよく知られた特色の 1 つに、インストールされたシステムを安定版から次の安定版にアップグレードできることが挙げられます。そして有名なサブコマンドである dist-upgrade はプロジェクトの評判に大きく寄与し続けています。いくつかの事前準備に必要な時間を含めても、コンピュータのアップグレードに必要な時間はパッケージリポジトリからのダウンロード速度に依存してわずか数分から数十分です。

6.7.1. 推奨手順

Debian の安定版は次のリリースまでの間にかなり長い時間をかけて大きく進化するので、アップグレードの前にリリースノートを読むべきです。
In this section, we will focus on upgrading a Stretch system to Buster. This is a major operation on a system; as such, it is never 100% risk-free, and should not be attempted before all important data has been backed up.
アップグレードを簡単に (短時間で) 実行するために身に付けるべき良い癖の 1 つに、インストール済みパッケージを整理整頓し、本当に必要なものだけを残すことがあります。これを行う便利なツールが aptitudedeborphandebfoster です (第 6.2.7 節「自動的にインストールされたパッケージの追跡」を参照してください)。たとえば以下のコマンドを実行した後、aptitude の対話型モードで削除予定としてマークされたパッケージの再確認と微調整を行うことができます。
# deborphan | xargs aptitude --schedule-only remove
Now for the upgrading itself. First, you need to change the /etc/apt/sources.list file to tell APT to get its packages from Buster instead of Stretch. If the file only contains references to Stable rather than explicit codenames, the change isn't even required, since Stable always refers to the latest released version of Debian. In both cases, the database of available packages must be refreshed (with the apt update command or the refresh button in synaptic).
新しいパッケージソースが登録されたら、真っ先に apt upgrade を使い、最小アップグレードを実行するべきです。アップグレードを 2 段階に分けて行うことにより、パッケージ管理ツールの作業が軽減されますし、パッケージ管理ツールが最新のバージョンになっていることが保証されます。また、最新のパッケージ管理ツールには、多くのバグ修正がなされているかもしれませんし、ディストリビューション全体のアップグレードを完了させるために必要な改善が含まれているかもしれません。
Once this first upgrade is done, it is time to handle the upgrade itself, either with apt full-upgrade, aptitude, or synaptic. You should carefully check the suggested actions before applying them: you might want to add suggested packages or deselect packages which are only recommended and known not to be useful. In any case, the front-end should come up with a scenario ending in a coherent and up-to-date Buster system. Then, all you need is to do is wait while the required packages are downloaded, answer the debconf questions and possibly those about locally modified configuration files, and sit back while APT does its magic.

6.7.2. アップグレードの後から問題を取り扱う

Debian メンテナの最大限の努力にも関わらず、システムのメジャーアップグレードは常に望んだ通りに順調に進むわけではありません。新しいソフトウェアバージョンは古いものと互換性がないかもしれません (たとえば、デフォルト動作やデータフォーマットが変わっているかもしれません)。また、いくつかのバグは Debian リリース前のテスト段階を経たにも関わらず見過ごされているかもしれません。
いくつかの問題を未然に防ぐために、apt-listchanges パッケージをインストールすることが可能です。apt-listchanges は、あるパッケージのアップグレード作業の開始時に、このパッケージのアップグレードを行うことで生じる可能性のある問題の情報を表示します。この情報はパッケージメンテナがまとめたもので、ユーザが内容を確認できるように /usr/share/doc/package/NEWS.Debian ファイルに含まれています。これらのファイルを (場合によっては apt-listchanges を通じて) 読めば、予期しない状況に驚かされることがなくなるでしょう。
You might sometimes find that the new version of a software doesn't work at all. This generally happens if the application isn't particularly popular and hasn't been tested enough; a last-minute update can also introduce regressions which are only found after the stable release. In both cases, the first thing to do is to have a look at the bug tracking system at https://bugs.debian.org/package, and check whether the problem has already been reported. If this is case it will be also listed before the upgrade begins, if you have apt-listbugs installed. If it hasn't, you should report it yourself with reportbug. If it is already known, the bug report and the associated messages are usually an excellent source of information related to the bug:
  • パッチが既に存在し、バグ報告からそれを入手できる場合もあります。この場合、壊れたパッケージの修正されたバージョンを再コンパイルすることが可能です (第 15.1 節「ソースを使ったパッケージの再ビルド」をご覧ください)。
  • バグ報告には問題に対する次善策が報告されており、報告に対する返信から問題の本質を理解できる場合もあります。
  • さらに、メンテナが修正されたパッケージを用意して既に公開している場合もあります。
Depending on the severity of the bug, a new version of the package may be prepared specifically for a new revision of the stable release. When this happens, the fixed package is made available in the proposed-updates section of the Debian mirrors (see 第 6.1.2.3 節「提案された更新」). The corresponding entry can then be temporarily added to the sources.list file, and updated packages can be installed with apt or aptitude.
Sometimes the fixed package isn't available in this section yet because it is pending a validation by the Stable Release Managers. You can verify if that is the case on their web page. Packages listed there aren't available yet, but at least you know that the publication process is ongoing.

6.7.3. Cleaning Up after an Upgrade

APT usually ensures a clean upgrade, pulling in new and updated dependencies, or removing conflicting packages. But even being such a great tool, it cannot cover all tasks users and administrators will face after an upgrade, because they require a human decision.

6.7.3.1. Packages removed from the Debian Archive

Sometimes the Debian FTP Masters remove packages from the Debian archive, because they contain release critical bugs, were abandoned by their upstream author or their package maintainer, or simply reached their end of life. In this case a newer Debian release does not ship the package anymore. To find all packages, which do not have a package source, use the apt-show-versions command:
$ apt-show-versions | grep "No available version"
A similar result can be achieved by aptitude search ~o. If the packages found are not required anymore, they should be purged from the system, because they will not face any updates for critical or security related bugs anymore.

6.7.3.2. Dummy and Transitional Packages

Sometimes, it might be necessary for a package to get a new name. In this case often the old package is kept as an (almost) empty package, depending on the new one and installing only the mandatory files in /usr/share/doc/package/. Such packages are called "dummy" or "transitional" packages. If the package maintainer in charge also changed the section of this package to oldlibs, then tools like aptitude, deboprhan, or debfoster (see sidebar ALTERNATIVE deborphandebfoster) can pickup these packages to suggest their removal.
Unfortunately there is currently no foolproof way of making sure that these packages are automatically removed or picked by the tools mentioned above. One way to check if the system still has some of these packages installed, is to look through the package descriptions of installed packages and then check the results. Be careful not to schedule the results for automatic removal, because this method can lead to false positives:
$ dpkg -l | grep ^ii | grep -i -E "(transition|dummy)"
Because the new package is pulled in as a dependency of the transitional package, it is usually marked as automatically installed and might be scheduled for removal if you try to purge the transitional package from your system. In this case you can use either of the approaches described in sidebar TIP 同時に削除とインストールを行う」 and 第 6.2.7 節「自動的にインストールされたパッケージの追跡」 to selectively remove the transitional package.

6.7.3.3. Old or Unused Configuration Files

If the upgrade was successful there might be some configuration file cruft, either from dpkg (see 第 5.2.3 節「チェックサム、設定ファイルのリスト」), ucf or from removed packages. The latter can be purged by using apt autoremove --purge. The configuration files, that were handled by dpkg or ucf during the upgrade process, have left some counterparts with a dedicated suffix (e.g. .dpkg-dist, .dpkg-old, .ucf-old). Using the find or locate command can help to track them down. If they are no longer of any use, they can be deleted.

6.7.3.4. Files not owned by any Package

The Debian policy enforces that packages don't leave files behind when they are purged. Violating this principle is a serious bug and you will rarely encounter it. If you do, report it; and if you are curious though, you can use the cruft or cruft-ng package to check your system for files not owned by any package.