web-dev-qa-db-ja.com

実稼働サーバーのディスク領域を解放しようとしています

ブートパーティションに空き領域を作成するためのソリューションのいくつかにコミットするのは大変です... autoremoveを読み、理解しました-apt-get -f installを読み、理解しました。しかし、私の問題は、そこに答えがあるすべての質問とは少し異なります。誰もが最後の3つのカーネルを除くすべてを手動で削除すると言います。こちらが私の予約です。

コマンドuname -rを発行すると、次のメッセージが表示されます。

4.4.0-78-generic

dpkg --list 'linux-image*'を発行すると、次のメッセージが表示されます。

rc  linux-image-4.4.0-31-generic                  4.4.0-31.50                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-62-generic                  4.4.0-62.83                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-63-generic                  4.4.0-63.84                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-64-generic                  4.4.0-64.85                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-66-generic                  4.4.0-66.87                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-70-generic                  4.4.0-70.91                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-71-generic                  4.4.0-71.92                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-72-generic                  4.4.0-72.93                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-75-generic                  4.4.0-75.96                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-78-generic                  4.4.0-78.99                 AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-79-generic                  4.4.0-79.100                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-81-generic                  4.4.0-81.104                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-83-generic                  4.4.0-83.106                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-87-generic                  4.4.0-87.110                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-89-generic                  4.4.0-89.112                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-91-generic                  4.4.0-91.114                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-92-generic                  4.4.0-92.115                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-93-generic                  4.4.0-93.116                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-96-generic                  4.4.0-96.119                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-97-generic                  4.4.0-97.120                AMD64                       Linux kernel image for version 4.4.0 on 64 bit x86 SMP
in  linux-image-4.4.0-98-generic                  <none>                      AMD64                       (no description available)
rc  linux-image-extra-4.4.0-31-generic            4.4.0-31.50                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-62-generic            4.4.0-62.83                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-63-generic            4.4.0-63.84                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-64-generic            4.4.0-64.85                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-66-generic            4.4.0-66.87                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-70-generic            4.4.0-70.91                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-71-generic            4.4.0-71.92                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-72-generic            4.4.0-72.93                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-75-generic            4.4.0-75.96                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-78-generic            4.4.0-78.99                 AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-79-generic            4.4.0-79.100                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-81-generic            4.4.0-81.104                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-83-generic            4.4.0-83.106                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-87-generic            4.4.0-87.110                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-89-generic            4.4.0-89.112                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-91-generic            4.4.0-91.114                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-92-generic            4.4.0-92.115                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-extra-4.4.0-93-generic            4.4.0-93.116                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-96-generic            4.4.0-96.119                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-97-generic            4.4.0-97.120                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-extra-4.4.0-98-generic            4.4.0-98.121                AMD64                       Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-generic                           4.4.0.98.103                AMD64                       Generic Linux kernel image

apt-get autoremoveを試みましたが、次のようになりました:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-98-generic but it is not installed
                       Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.

それで、Sudo apt-get -f installを介して依存関係を解決し、取得しようとします:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-79 linux-headers-4.4.0-79-generic linux-headers-4.4.0-81 linux-headers-4.4.0-81-generic linux-headers-4.4.0-83 linux-headers-4.4.0-83-generic linux-headers-4.4.0-87
  linux-headers-4.4.0-87-generic linux-headers-4.4.0-89 linux-headers-4.4.0-89-generic linux-headers-4.4.0-91 linux-headers-4.4.0-91-generic linux-headers-4.4.0-92 linux-headers-4.4.0-92-generic
  linux-image-4.4.0-79-generic linux-image-4.4.0-81-generic linux-image-4.4.0-83-generic linux-image-4.4.0-87-generic linux-image-4.4.0-89-generic linux-image-4.4.0-91-generic linux-image-4.4.0-92-generic
  linux-image-extra-4.4.0-79-generic linux-image-extra-4.4.0-81-generic linux-image-extra-4.4.0-83-generic linux-image-extra-4.4.0-87-generic linux-image-extra-4.4.0-89-generic
  linux-image-extra-4.4.0-91-generic linux-image-extra-4.4.0-92-generic
Use 'Sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-4.4.0-98-generic
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
  linux-image-4.4.0-98-generic
0 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.
12 not fully installed or removed.
Need to get 0 B/21.9 MB of archives.
After this operation, 67.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 446621 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-98-generic_4.4.0-98.121_AMD64.deb ...
Done.
Unpacking linux-image-4.4.0-98-generic (4.4.0-98.121) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-98-generic_4.4.0-98.121_AMD64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-98-generic' to '/boot/vmlinuz-4.4.0-98-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-98-generic_4.4.0-98.121_AMD64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

ここで私は混乱しています.. uname -rに従ってバージョン4.4.0-78-genericを使用しています。しかし、これまで読んだ文字通りすべての答えは、最新の3つを除くすべてを削除するように言っています!それは、現在利用しているカーネルを削除することを意味しますか??

私も試してみました:Sudo apt-get remove linux-image-4.4.0-31-genericは、dpkg --list 'linux-image*'に従って最も古いものです。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'linux-image-4.4.0-31-generic' is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

インストールされていない?!私は完全に混乱しています。この大惨事を見た後、私の次の行動は何ですか?現在使用しているバージョンよりも高いカーネルバージョンがある理由を誰かが説明できますか?そして、実稼働サーバーでこれをまっすぐに解決するにはどうすればよいですか?

THIS IS NOT A-DUPLICATE OF私の/ bootパーティションが100%に達したため、アップグレードできません。 '古いカーネルを削除してスペースを空けない As:

1)このOPは、競合するカーネルの問題に答えません..2)実稼働環境でこれを行うことの安全性に対処しません。

1
Zak

最初に次のパッケージをインストールします。

Sudo apt install byobu

その後、次のコマンドを使用して、未使用のカーネルを削除できます。

Sudo purge-old-kernels

これにより、スペースを解放できます。

詳細については、 この記事 を確認してください。

3
Michael