0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ubuntu apt upgradeで not fully installed エラー (openssh-server)

Last updated at Posted at 2025-02-19

Ubuntu 24.04でapt upgradeを行った際に失敗したので、対策メモ

  • 環境

Windows 11 24H2, wsl1, ubuntu 24.4.02

  • 症状

updateは問題無く完了したが、続くupgradeではopenssh-serverがエラーで更新できない

$ sudo apt update
Hit:1 https://ftp.riken.jp/Linux/ubuntu noble InRelease
       ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up openssh-server (1:9.6p1-3ubuntu13.8) ...
dpkg: error processing package openssh-server (--configure):
installed openssh-server package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • 解決策

    コマンド2つで問題無くエラーが解消された
  1. 残った作業ファイル(post-installation script)を削除
    sudo rm /var/lib/dpkg/info/openssh-server.postinst
    
  2. パッケージの再構築(構築が済んでいない全てのパッケージが対象)
    sudo dpkg --configure --pending
    
  • 結果

    問題無くupgrade完了
    $ sudo apt upgrade
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    Calculating upgrade... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    
    別の方法として、apt full-upgradeを勧めるサイトもあったが、今回は効かなかった。

下記を参考にしました
https://unix.stackexchange.com/questions/638594/how-do-i-tell-apt-get-install-to-stop-trying-to-setup-openssh-server

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?