Memperbaiki error: "No space left on device" di Linux Ubuntu Server 12.04

Dokumentasi kali ini membahas tentang gagalnya prose update kernel Linux Ubuntu disebabkan alarm palsu "false alarm" yang menampilkan informasi bahwa tidak tersedianya ruang tersisa di hardisk.

Masalah Datang dari Partisi /boot
Setiap proses update/upgrade kernel, file image akan disimpan pada partisi /boot. Kebetulan pada saat instalasi saya tidak mengubah secara manual nilai partisi ini (di set otomatis oleh sistem) dengan mengambil ruang (space) sebanyak 227 MB. Lama-lama partisi ini menjadi sangat penuh dikarenakan proses upgrade kernel terbaru, sedangkan image kernel lama tidak dihapus (disimpan untuk jaga-jaga apabila gagal booting ke kernel versi terbaru yang diinstal). Sehingga penuhlah isi dari partisi /boot seperti dibawah ini:

Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-58-generic-pae i686)
 * Documentation:  https://help.ubuntu.com/
  System information as of Fri Apr  4 10:33:06 WIB 2014

  System load:  0.26                        Processes:           86
  Usage of /:   1.7% of 228.01GB   Users logged in:     0
  Memory usage: 12%                    IP address for eth1: 192.168.X.X
  Swap usage:   0%                         IP address for eth0: 192.168.X.X

  => /boot is using 99.1% of 227MB

Dari info diatas, partisi /boot sudah terisi sebesar 99,1% (warna orange) padahal kapasitas hardisk baru terpakai 1,7% dari 228 GB (warna hijau). Jadi pada saat melakukan perintah apt-get update dan apt-get upgrade ataupun apt-get autoremove (menghapus instalasi kernel lama) muncul error seperti dibawah ini:
 # apt-get -f autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-generic-pae linux-image-3.2.0-60-generic-pae linux-image-generic-pae
Suggested packages:
  fdutils linux-doc-3.2.0 linux-source-3.2.0 linux-tools
The following packages will be REMOVED:
  linux-headers-3.2.0-51 linux-headers-3.2.0-51-generic-pae
  linux-headers-3.2.0-54 linux-headers-3.2.0-54-generic-pae
  linux-headers-3.2.0-55 linux-headers-3.2.0-55-generic-pae
The following NEW packages will be installed:
  linux-image-3.2.0-60-generic-pae
The following packages will be upgraded:
  linux-generic-pae linux-image-generic-pae
2 upgraded, 1 newly installed, 6 to remove and 44 not upgraded.
3 not fully installed or removed.
Need to get 0 B/38.4 MB of archives.
After this operation, 89.1 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 320686 files and directories currently installed.)
Unpacking linux-image-3.2.0-60-generic-pae (from .../linux-image-3.2.0-60-generi                     c-pae_3.2.0-60.91_i386.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.2.0-60-generic-pae_                     3.2.0-60.91_i386.deb (--unpack):
 failed in write on buffer copy for backend dpkg-deb during `./boot/vmlinuz-3.2.                     0-60-generic-pae': No space left on device
No apport report written because the error message indicates a disk full error     
     
         dp kg-deb: error: subprocess paste was killed by signal (Broken pipe) Examining /etc/kernel/postrm.d .
Proses penghapusan image kernel lama tidak berhasil dikarenakan muncul peringatan error: "No space left on device No apport report written because the error message indicates a disk full error" diatas.

Menghapus Image Kernel Lama Secara Manual
Salah satu cara untuk memperbaiki kesalahan ini adalah dengan melakukan penghapusan kernel lama secara manual meskipun kurang disarankan dikarenakan beresiko tinggi apabila salah menghapus dapat menyebabkan sistem gagal booting. Sekali lagi berhati-hatilah melakukan penghapusan kernel secara manual. Langkah-langkahnya sebagai berikut:
  1. Periksa versi kernel yang aktif dengan perintah
    # uname -r
    3.2.0-58-generic-pae
    Pada sistem diatas kernel yang aktif adalah versi 3.2.0-58
  2. Kemudian ketikan perintah dibawah ini untuk melihat versi kernel yang ada dalam sistem
    # ls /boot |grep vmlinuz | cut -d'-' -f2,3
    3.2.0-29
    3.2.0-40
    3.2.0-48
    3.2.0-49
    3.2.0-51
    3.2.0-54
    3.2.0-55
    3.2.0-56
    3.2.0-57
    3.2.0-58
    Kernel lama terlihat mulai dari versi 29 sd 57. Hasilnya mungkin akan berbeda tergantung dari versi ubuntu yang diinstall.
  3. Selanjutnya dicoba dengan menghapus versi terlama dari kernel diatas yaitu 3.2.0-29 dengan mencari nama imagenya
    # dpkg -l | grep ^ii | grep 3.2.0-29 | awk -F' ' '{ print $2 }'
    linux-image-3.2.0-29-generic-pae
  4. Hapus linux image diatas dengan perintah
    # aptitude remove linux-image-3.2.0-29-generic-pae
    The following packages will be REMOVED:
      linux-headers-3.2.0-51{u} linux-headers-3.2.0-51-generic-pae{u} linux-headers-3.2.0-54{u}
      linux-headers-3.2.0-54-generic-pae{u} linux-headers-3.2.0-55{u}
      linux-headers-3.2.0-55-generic-pae{u} linux-image-3.2.0-29-generic-pae
    0 packages upgraded, 0 newly installed, 7 to remove and 46 not upgraded.
    Need to get 0 B of archives. After unpacking 316 MB will be freed.
    The following packages have unmet dependencies:
     linux-image-generic-pae : Depends: linux-image-3.2.0-59-generic-pae but it is not going to be installed.
     linux-generic-pae : Depends: linux-headers-generic-pae (= 3.2.0.59.70) but 3.2.0.60.71 is installed.

    The following actions will resolve these dependencies:
         Remove the following packages:
    1)     linux-generic-pae
    2)     linux-image-generic-pae
    Accept this solution? [Y/n/q/?] y

    The following packages will be REMOVED:
      linux-generic-pae{a} linux-headers-3.2.0-51{u} linux-headers-3.2.0-51-generic-pae{u}
      linux-headers-3.2.0-54{u} linux-headers-3.2.0-54-generic-pae{u} linux-headers-3.2.0-55{u}
      linux-headers-3.2.0-55-generic-pae{u} linux-image-3.2.0-29-generic-pae
      linux-image-generic-pae{a}
    0 packages upgraded, 0 newly installed, 9 to remove and 44 not upgraded.
    Need to get 0 B of archives. After unpacking 316 MB will be freed.
    Do you want to continue? [Y/n/?] y
    (Reading database ... 320686 files and directories currently installed.)
    Removing linux-generic-pae ...
    Removing linux-image-generic-pae ...
    Removing linux-headers-3.2.0-51-generic-pae ...
    Removing linux-headers-3.2.0-51 ...
    Removing linux-headers-3.2.0-54-generic-pae ...
    Removing linux-headers-3.2.0-54 ...
    Removing linux-headers-3.2.0-55-generic-pae ...
    Removing linux-headers-3.2.0-55 ...
    Removing linux-image-3.2.0-29-generic-pae ...
    Examining /etc/kernel/postrm.d .
    run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-29-generic-pae /boot/vmlinuz-3.2.0-29-generic-pae
    update-initramfs: Deleting /boot/initrd.img-3.2.0-29-generic-pae
    run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-29-generic-pae /boot/vmlinuz-3.2.0-29-generic-pae
    Generating grub.cfg ...
    Found linux image: /boot/vmlinuz-3.2.0-58-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-58-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-57-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-57-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-56-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-56-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-55-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-55-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-54-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-54-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-51-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-51-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-49-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-49-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-48-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-48-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-40-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-40-generic-pae
    Found memtest86+ image: /memtest86+.bin
    done
    Setting up initramfs-tools (0.99ubuntu13.4) ...
    update-initramfs: deferring update (trigger activated)
    Processing triggers for initramfs-tools ...
    update-initramfs: Generating /boot/initrd.img-3.2.0-58-generic-pae

    Current status: 0 broken [-2], 44 updates [-2].
    Dengan otomatis sistem Ubuntu akan mendeteksi linux image versi lainnya dan menghapusnya
  5. Lanjutkan dengan perintah dibawah ini untuk membersihkan cache dan mengecek ulang penghapusan diatas
    # apt-get clean
    # apt-get -f autoremove
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 44 not upgraded.
    Sekarang perintah apt-get -f autoremove berjalan tanpa ada error
  6. Restart sistemdan ulangi langkah diatas jika masih diperlukan.

Referensi:
http://tuxtweaks.com/2009/12/remove-old-kernels-in-ubuntu/

Komentar

Most Popular Posts