LoginSignup
1
1

More than 5 years have passed since last update.

vagrant、CentOS7でkernelのアップデートに失敗する

Posted at

発生した問題

vagrant上で yum updateを実行した際にkernelの更新が容量不足の為、失敗する。

実行時のログ
========================================================================================================================
 Package                              アーキテクチャー    バージョン                         リポジトリー          容量
========================================================================================================================
インストール中:
 kernel                               x86_64              3.10.0-327.36.3.el7                updates               33 M
 kernel-devel                         x86_64              3.10.0-327.36.3.el7                updates               11 M
更新します:
 NetworkManager                       x86_64              1:1.0.6-31.el7_2                   updates              2.0 M
 NetworkManager-libnm                 x86_64              1:1.0.6-31.el7_2                   updates              498 k
 NetworkManager-team                  x86_64              1:1.0.6-31.el7_2                   updates              132 k
 NetworkManager-tui                   x86_64              1:1.0.6-31.el7_2                   updates              212 k
 bind-libs-lite                       x86_64              32:9.9.4-29.el7_2.4                updates              724 k
 bind-license                         noarch              32:9.9.4-29.el7_2.4                updates               82 k
 dnsmasq                              x86_64              2.66-14.el7_2.1                    updates              229 k
 kernel-headers                       x86_64              3.10.0-327.36.3.el7                updates              3.2 M
 kernel-tools                         x86_64              3.10.0-327.36.3.el7                updates              2.4 M
 kernel-tools-libs                    x86_64              3.10.0-327.36.3.el7                updates              2.3 M
 kmod                                 x86_64              20-8.el7_2                         updates              114 k
 kmod-libs                            x86_64              20-8.el7_2                         updates               47 k
 kpartx                               x86_64              0.4.9-85.el7_2.6                   updates               60 k
 libgudev1                            x86_64              219-19.el7_2.13                    updates               67 k
 libteam                              x86_64              1.17-7.el7_2                       updates               45 k
 nginx                                x86_64              1:1.10.2-1.el7.ngx                 nginx                643 k
 openssl                              x86_64              1:1.0.1e-51.el7_2.7                updates              712 k
 openssl-libs                         x86_64              1:1.0.1e-51.el7_2.7                updates              953 k
 python                               x86_64              2.7.5-39.el7_2                     updates               89 k
 python-libs                          x86_64              2.7.5-39.el7_2                     updates              5.6 M
 python-perf                          x86_64              3.10.0-327.36.3.el7                updates              2.4 M
 selinux-policy                       noarch              3.13.1-60.el7_2.9                  updates              377 k
 selinux-policy-targeted              noarch              3.13.1-60.el7_2.9                  updates              3.9 M
 systemd                              x86_64              219-19.el7_2.13                    updates              5.1 M
 systemd-libs                         x86_64              219-19.el7_2.13                    updates              358 k
 systemd-sysv                         x86_64              219-19.el7_2.13                    updates               54 k
 teamd                                x86_64              1.17-7.el7_2                       updates              109 k
 tuned                                noarch              2.5.1-4.el7_2.6                    updates              194 k
 tzdata                               noarch              2016h-1.el7                        updates              439 k

トランザクションの要約
========================================================================================================================
インストール   2 パッケージ
更新          29 パッケージ

合計容量: 77 M
Is this ok [y/d/N]:
表示されたエラーメッセージ
Transaction check error:
  installing package kernel-3.10.0-327.36.3.el7.x86_64 needs 12MB on the /boot filesystem

エラーの要約
-------------
ディスク要求:
  少なくとも 12MB の空き容量がファイルシステム /boot で必要です。

環境

ホストOS: OS X El Capitan 10.11.6
ゲストOS: CentOS Linux release 7.2.1511 (Core)
※以前作成したVagrantfile を利用。

原因

kernelの更新を行う度に古いバージョンのkernelが/bootに残っていて、容量を圧迫している事が原因。

容量を確認すると/bootに空き容量がほとんど存在しない事が確認出来る。

容量の確認
$ df -h
ファイルシス                      サイズ  使用  残り 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00      38G  1.8G   34G    6% /
devtmpfs                            487M     0  487M    0% /dev
tmpfs                               497M     0  497M    0% /dev/shm
tmpfs                               497M  6.5M  490M    2% /run
tmpfs                               497M     0  497M    0% /sys/fs/cgroup
/dev/sda2                           190M  158M   18M   90% /boot
home_vagrant_laravel-front-sample   233G  101G  133G   44% /home/vagrant/laravel-front-sample
tmpfs                               100M     0  100M    0% /run/user/1000

解決方法

package-cleanupコマンドを利用して古いkernelを削除する。
yum-utilsの中に含まれるのでまずはインストールを行う。

インストール
$ sudo yum install yum-utils
package-cleanup実行
sudo package-cleanup --oldkernels --count=1

--count=1は最新のkernelだけを残して他は削除するという意味である。

package-cleanup実行前の状態
$ ls -la /boot
合計 152243
dr-xr-xr-x.  5 root root     1024  9月  7 23:54 .
dr-xr-xr-x. 18 root root     4096  9月  7 23:53 ..
-rw-r--r--.  1 root root      171  2月 17  2016 .vmlinuz-3.10.0-327.10.1.el7.x86_64.hmac
-rw-r--r--.  1 root root      171  8月 19 04:15 .vmlinuz-3.10.0-327.28.3.el7.x86_64.hmac
-rw-------.  1 root root  2963014  2月 17  2016 System.map-3.10.0-327.10.1.el7.x86_64
-rw-------.  1 root root  2964731  8月 19 04:15 System.map-3.10.0-327.28.3.el7.x86_64
-rw-r--r--.  1 root root   126431  2月 17  2016 config-3.10.0-327.10.1.el7.x86_64
-rw-r--r--.  1 root root   126431  8月 19 04:15 config-3.10.0-327.28.3.el7.x86_64
drwxr-xr-x.  2 root root     1024  2月 27  2016 grub
drwx------.  6 root root     1024  9月  7 00:07 grub2
-rw-r--r--.  1 root root 44494475  2月 27  2016 initramfs-0-rescue-70d63a0c469944bda91cd7743c2a3275.img
-rw-r--r--.  1 root root 18625394  9月  7 00:06 initramfs-3.10.0-327.10.1.el7.x86_64.img
-rw-r--r--.  1 root root 16929734  9月  7 00:01 initramfs-3.10.0-327.10.1.el7.x86_64kdump.img
-rw-r--r--   1 root root 18611877  9月  7 23:54 initramfs-3.10.0-327.28.3.el7.x86_64.img
-rw-r--r--   1 root root 16973197  9月  7 23:53 initramfs-3.10.0-327.28.3.el7.x86_64kdump.img
-rw-------.  1 root root 17453853  2月 27  2016 initramfs-3.10.0-327.el7.x86_64.img
-rw-r--r--.  1 root root   603225  2月 27  2016 initrd-plymouth.img
drwx------.  2 root root    12288  2月 27  2016 lost+found
-rw-r--r--.  1 root root   252630  2月 17  2016 symvers-3.10.0-327.10.1.el7.x86_64.gz
-rw-r--r--.  1 root root   252632  8月 19 04:17 symvers-3.10.0-327.28.3.el7.x86_64.gz
-rwxr-xr-x.  1 root root  5155536  2月 27  2016 vmlinuz-0-rescue-70d63a0c469944bda91cd7743c2a3275
-rwxr-xr-x.  1 root root  5155536  2月 17  2016 vmlinuz-3.10.0-327.10.1.el7.x86_64
-rwxr-xr-x.  1 root root  5159792  8月 19 04:15 vmlinuz-3.10.0-327.28.3.el7.x86_64
package-cleanup実行後の状態
$ ls -la /boot
合計 109213
dr-xr-xr-x.  5 root root     1024  9月  8 18:00 .
dr-xr-xr-x. 18 root root     4096  9月  7 23:53 ..
-rw-r--r--.  1 root root      171  8月 19 04:15 .vmlinuz-3.10.0-327.28.3.el7.x86_64.hmac
-rw-------.  1 root root  2964731  8月 19 04:15 System.map-3.10.0-327.28.3.el7.x86_64
-rw-r--r--.  1 root root   126431  8月 19 04:15 config-3.10.0-327.28.3.el7.x86_64
drwxr-xr-x.  2 root root     1024  2月 27  2016 grub
drwx------.  6 root root     1024  9月  8 18:00 grub2
-rw-r--r--.  1 root root 44494475  2月 27  2016 initramfs-0-rescue-70d63a0c469944bda91cd7743c2a3275.img
-rw-r--r--   1 root root 18611877  9月  7 23:54 initramfs-3.10.0-327.28.3.el7.x86_64.img
-rw-r--r--   1 root root 16973197  9月  7 23:53 initramfs-3.10.0-327.28.3.el7.x86_64kdump.img
-rw-------.  1 root root 17453853  2月 27  2016 initramfs-3.10.0-327.el7.x86_64.img
-rw-r--r--.  1 root root   603225  2月 27  2016 initrd-plymouth.img
drwx------.  2 root root    12288  2月 27  2016 lost+found
-rw-r--r--.  1 root root   252632  8月 19 04:17 symvers-3.10.0-327.28.3.el7.x86_64.gz
-rwxr-xr-x.  1 root root  5155536  2月 27  2016 vmlinuz-0-rescue-70d63a0c469944bda91cd7743c2a3275
-rwxr-xr-x.  1 root root  5159792  8月 19 04:15 vmlinuz-3.10.0-327.28.3.el7.x86_64

削除されている事が確認出来る。
再度yum updateを実行すると問題なくkernelのUpdateに成功する。

update実行ログ
インストール:
  kernel.x86_64 0:3.10.0-327.36.3.el7                     kernel-devel.x86_64 0:3.10.0-327.36.3.el7

更新:
  NetworkManager.x86_64 1:1.0.6-31.el7_2                       NetworkManager-libnm.x86_64 1:1.0.6-31.el7_2
  NetworkManager-team.x86_64 1:1.0.6-31.el7_2                  NetworkManager-tui.x86_64 1:1.0.6-31.el7_2
  bind-libs-lite.x86_64 32:9.9.4-29.el7_2.4                    bind-license.noarch 32:9.9.4-29.el7_2.4
  dnsmasq.x86_64 0:2.66-14.el7_2.1                             kernel-headers.x86_64 0:3.10.0-327.36.3.el7
  kernel-tools.x86_64 0:3.10.0-327.36.3.el7                    kernel-tools-libs.x86_64 0:3.10.0-327.36.3.el7
  kmod.x86_64 0:20-8.el7_2                                     kmod-libs.x86_64 0:20-8.el7_2
  kpartx.x86_64 0:0.4.9-85.el7_2.6                             libgudev1.x86_64 0:219-19.el7_2.13
  libteam.x86_64 0:1.17-7.el7_2                                nginx.x86_64 1:1.10.2-1.el7.ngx
  openssl.x86_64 1:1.0.1e-51.el7_2.7                           openssl-libs.x86_64 1:1.0.1e-51.el7_2.7
  python.x86_64 0:2.7.5-39.el7_2                               python-libs.x86_64 0:2.7.5-39.el7_2
  python-perf.x86_64 0:3.10.0-327.36.3.el7                     selinux-policy.noarch 0:3.13.1-60.el7_2.9
  selinux-policy-targeted.noarch 0:3.13.1-60.el7_2.9           systemd.x86_64 0:219-19.el7_2.13
  systemd-libs.x86_64 0:219-19.el7_2.13                        systemd-sysv.x86_64 0:219-19.el7_2.13
  teamd.x86_64 0:1.17-7.el7_2                                  tuned.noarch 0:2.5.1-4.el7_2.6
  tzdata.noarch 0:2016h-1.el7

完了しました!
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