2013年8月9日 星期五

[Linux] 解決 apt-get 之 gzip: stdout: No space left on device 問題 @ Ubuntu 12.04 Server

噴訊息:

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-#.#.#-##-generic with 1.
dpkg: error processing initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

接著查看 /boot:

$ df  -h
Filesystem              Size  Used Avail Use% Mounted on
...
/dev/sda1               228M  218M     0 100% /boot


解法:

$ uname -a
Linux 3.2.0-51-generic #77-Ubuntu SMP Wed Jul 24 20:18:19 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

代表現在跑 Linux 3.2.0-51 也算正常吧,那就把其他清掉吧

$ dpkg -l 'linux-image-*' | grep '^ii'
ii  linux-image-3.2.0-29-generic        3.2.0-29.46                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-35-generic        3.2.0-35.55                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-37-generic        3.2.0-37.58                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-38-generic        3.2.0-38.61                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-39-generic        3.2.0-39.62                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-40-generic        3.2.0-40.64                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-41-generic        3.2.0-41.66                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-43-generic        3.2.0-43.68                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-44-generic        3.2.0-44.69                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-45-generic        3.2.0-45.70                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-48-generic        3.2.0-48.74                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-49-generic        3.2.0-49.75                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-51-generic        3.2.0-51.77                         Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-server                  3.2.0.51.61                         Linux kernel image on Server Equipment

開始慢慢清掉之前裝過的:(此例還保留前一份linux-image-3.2.0-49-generic這份)

$ sudo apt-get purge linux-image-3.2.0-29-generic linux-image-3.2.0-35-generic linux-image-3.2.0-37-generic linux-image-3.2.0-38-generic linux-image-3.2.0-39-generic linux-image-3.2.0-40-generic linux-image-3.2.0-41-generic linux-image-3.2.0-43-generic linux-image-3.2.0-44-generic linux-image-3.2.0-45-generic  linux-image-3.2.0-48-generic

再次查看: 

$ df -h
Filesystem              Size  Used Avail Use% Mounted on
...
/dev/sda1               228M   51M  165M  24% /boot


收工

沒有留言:

張貼留言