1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

aptでパッケージの更新を抑止する方法

Last updated at Posted at 2020-01-31

カスタムビルドのnginxをdebパッケージとしていれていたのですが、aptにより更新されてしまい、nginxが起動できなくなったことがあったので備忘録を兼ねて書いておきます。

更新を抑止

rootでやるか、sudoで実行します。

apt-mark hold <パッケージ名>

例:

apt-mark hold nginx

こうすることで、apt upgradeを実行しても無視されるようになります。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  nginx
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

更新の抑止を解除

上と同様の権限で。

apt-mark unhold <パッケージ名>

例:

apt-mark unhold nginx

こうすれば抑止を解除できます。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  nginx
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 851 kB of archives.
After this operation, 30.7 kB disk space will be freed.
Do you want to continue? [Y/n] 

抑止中のパッケージを確認する方法

apt-mark showhold

このコマンドを打つと抑止中のパッケージが表示されます。

もし何も返ってこない場合は抑止中のパッケージがないことになります。

参考文献

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?