読者です 読者をやめる 読者になる 読者になる

エロサイトの作り方

2013年11月から勉強しながらエロサイトを作っています。

Ubuntuで/bootがいっぱいになる件

Ansibleでエラー

apt-getaptitudeでの更新でも起こるようですが、 今回はAnsibleで発生したのでとりあえずログをぺたり。

TASK: [common | install td-agent] *********************************************
failed: [crawler] => {"changed": true, "cmd": "curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh ", "delta": "0:00:50.757487", "end": "2015-01-09 02:44:01.169047", "item": "", "rc": 100, "start": "2015-01-09 02:43:10.411560"}
stderr:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   575  100   575    0     0    985      0 --:--:-- --:--:-- --:--:--   984
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   934  100   934    0     0   4803      0 --:--:-- --:--:-- --:--:--  4814
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-3.13.0-43-generic
vmlinuz(/boot/vmlinuz-3.13.0-43-generic
) points to /boot/vmlinuz-3.13.0-43-generic
 (/boot/vmlinuz-3.13.0-43-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-3.13.0-43-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-43-generic /boot/vmlinuz-3.13.0-43-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-43-generic /boot/vmlinuz-3.13.0-43-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-43-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.13.0-43-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.13.0-43-generic.postinst line 1025.
dpkg: error processing package linux-image-3.13.0-43-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-3.13.0-43-generic:
 linux-image-extra-3.13.0-43-generic depends on linux-image-3.13.0-43-generic; however:
  Package linux-image-3.13.0-43-generic is not configured yet.

dpkg: error processing package linux-image-extra-3.13.0-43-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.13.0-43-generic; however:
  Package linux-image-3.13.0-43-generic is not configured yet.
 linux-image-generic depends on linux-image-extra-3.13.0-43-generic; however:
  Package linux-image-extra-3.13.0-43-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 3.13.0.43.50); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
Errors were encountered while processing:
 linux-image-3.13.0-43-generic
 linux-image-extra-3.13.0-43-generic
 linux-image-generic
 linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

ディスクの空きが無い?

gzip: stdout: No space left on device

と言ってますね。

いやいや、まだあるでしょ。

$ df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/crawler--vg-root  205G  155G   40G  80% /
none                          4.0K     0  4.0K   0% /sys/fs/cgroup
udev                          7.7G   12K  7.7G   1% /dev
tmpfs                         1.6G  696K  1.6G   1% /run
none                          5.0M     0  5.0M   0% /run/lock
none                          7.7G     0  7.7G   0% /run/shm
none                          100M     0  100M   0% /run/user
/dev/sda1                     236M  223M  981K 100% /boot

……と思ったら、/bootが100%使用中だった。

update-initramfs: failed for /boot/initrd.img-3.13.0-43-generic with 1.

とログにあるように、ファイルは/bootに置こうとしたらしい。

/bootの中身

とりあえず/bootの中身を確認。

$ ll /boot
total 221000
drwxr-xr-x  4 root root     3072 Jan  9 02:44 ./
drwxr-xr-x 23 root root     4096 Jan  9 02:43 ../
-rw-r--r--  1 root root  1158016 May  3  2014 abi-3.13.0-24-generic
-rw-r--r--  1 root root  1162712 Aug 14 01:45 abi-3.13.0-34-generic
-rw-r--r--  1 root root  1163858 Aug 15 11:56 abi-3.13.0-35-generic
-rw-r--r--  1 root root  1163858 Sep  4 07:24 abi-3.13.0-36-generic
-rw-r--r--  1 root root  1164489 Sep 23 07:24 abi-3.13.0-37-generic
-rw-r--r--  1 root root  1164547 Oct 28 23:25 abi-3.13.0-39-generic
-rw-r--r--  1 root root  1164509 Nov 14 03:30 abi-3.13.0-40-generic
-rw-r--r--  1 root root  1164720 Dec  9 05:28 abi-3.13.0-43-generic
-rw-r--r--  1 root root   165510 May  3  2014 config-3.13.0-24-generic
-rw-r--r--  1 root root   165611 Aug 14 01:45 config-3.13.0-34-generic
-rw-r--r--  1 root root   165652 Aug 15 11:56 config-3.13.0-35-generic
-rw-r--r--  1 root root   165671 Sep  4 07:24 config-3.13.0-36-generic
-rw-r--r--  1 root root   165712 Sep 23 07:24 config-3.13.0-37-generic
-rw-r--r--  1 root root   165712 Oct 28 23:25 config-3.13.0-39-generic
-rw-r--r--  1 root root   165745 Nov 14 03:30 config-3.13.0-40-generic
-rw-r--r--  1 root root   165745 Dec  9 05:28 config-3.13.0-43-generic
drwxr-xr-x  5 root root     1024 Nov 25 06:38 grub/
-rw-r--r--  1 root root 20030651 Aug 15 19:52 initrd.img-3.13.0-24-generic
-rw-r--r--  1 root root 20088413 Aug 15 19:52 initrd.img-3.13.0-34-generic
-rw-r--r--  1 root root 20100570 Aug 30 06:43 initrd.img-3.13.0-35-generic
-rw-r--r--  1 root root 20110750 Sep 24 06:38 initrd.img-3.13.0-36-generic
-rw-r--r--  1 root root 20108169 Oct  9 06:36 initrd.img-3.13.0-37-generic
-rw-r--r--  1 root root 20112257 Oct 30 06:33 initrd.img-3.13.0-39-generic
-rw-r--r--  1 root root 20113641 Nov 25 06:38 initrd.img-3.13.0-40-generic
drwx------  2 root root    12288 Aug 15 19:41 lost+found/
-rw-r--r--  1 root root   176500 Mar 12  2014 memtest86+.bin
-rw-r--r--  1 root root   178176 Mar 12  2014 memtest86+.elf
-rw-r--r--  1 root root   178680 Mar 12  2014 memtest86+_multiboot.bin
-rw-------  1 root root  3372643 May  3  2014 System.map-3.13.0-24-generic
-rw-------  1 root root  3381262 Aug 14 01:45 System.map-3.13.0-34-generic
-rw-------  1 root root  3386444 Aug 15 11:56 System.map-3.13.0-35-generic
-rw-------  1 root root  3386479 Sep  4 07:24 System.map-3.13.0-36-generic
-rw-------  1 root root  3386945 Sep 23 07:24 System.map-3.13.0-37-generic
-rw-------  1 root root  3386936 Oct 28 23:25 System.map-3.13.0-39-generic
-rw-------  1 root root  3387231 Nov 14 03:30 System.map-3.13.0-40-generic
-rw-------  1 root root  3388760 Dec  9 05:28 System.map-3.13.0-43-generic
-rw-------  1 root root  5776416 May  3  2014 vmlinuz-3.13.0-24-generic
-rw-------  1 root root  5797728 Aug 14 01:45 vmlinuz-3.13.0-34-generic
-rw-------  1 root root  5806368 Aug 15 11:56 vmlinuz-3.13.0-35-generic
-rw-------  1 root root  5806848 Sep  4 07:24 vmlinuz-3.13.0-36-generic
-rw-------  1 root root  5808832 Sep 23 07:24 vmlinuz-3.13.0-37-generic
-rw-------  1 root root  5808544 Oct 28 23:25 vmlinuz-3.13.0-39-generic
-rw-------  1 root root  5808960 Nov 14 03:30 vmlinuz-3.13.0-40-generic
-rw-------  1 root root  5814080 Dec  9 05:28 vmlinuz-3.13.0-43-generic

なんか色々あるけど、わからん。

aptitude autoclean効きます?

$ sudo aptitude autoclean
Freed 0 B of disk space
$ df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/sda1                     236M  223M  981K 100% /boot

ダメだった。

じゃあ、apt-get autoremoveは効きます?

$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-headers-3.13.0-24 linux-headers-3.13.0-24-generic
  linux-headers-3.13.0-35 linux-headers-3.13.0-35-generic
  linux-headers-3.13.0-36 linux-headers-3.13.0-36-generic
  linux-headers-3.13.0-37 linux-headers-3.13.0-37-generic
  linux-headers-3.13.0-39 linux-headers-3.13.0-39-generic
  linux-image-3.13.0-24-generic linux-image-3.13.0-35-generic
  linux-image-3.13.0-36-generic linux-image-3.13.0-37-generic
  linux-image-3.13.0-39-generic linux-image-extra-3.13.0-24-generic
  linux-image-extra-3.13.0-35-generic linux-image-extra-3.13.0-36-generic
  linux-image-extra-3.13.0-37-generic linux-image-extra-3.13.0-39-generic
0 upgraded, 0 newly installed, 20 to remove and 72 not upgraded.
4 not fully installed or removed.
After this operation, 1,352 MB disk space will be freed.
Do you want to continue? [Y/n]

お、なんか消せそう。yで続行

...
done

完了。さて消えたかな?

$ df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/sda1                     236M   95M  129M  43% /boot

こ う か は ば つ ぐ ん だ !

というわけで

定期的に実行しないとダメなのかな。