0

I'm currently in the process of trying to upgrade my Linux kernel from 4.4.0-63 to 4.10.12. I've gotten through the steps (by using http://www.thegeekstuff.com/2013/06/compile-linux-kernel manual) of: make -> make modules -> make modules_install

Though once I try to do "make install" I get the following error:

user@thiscomp:/usr/src/linux-4.10.12$ sudo make install
sh ./arch/x86/boot/install.sh 4.10.12 arch/x86/boot/bzImage \
            System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.12 
/boot/vmlinuz-4.10.12
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.12 
/boot/vmlinuz-4.10.12
update-initramfs: Generating /boot/initrd.img-4.10.12
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.12 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
make[1]: *** [install] Error 1
make: *** [install] Error 2

First, I checked to see if /boot was full, but it seemed like it wasn't:

user@thiscomp:/usr/src/linux-4.10.12$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       252G   43G  197G  18% /
...
/dev/sda1       236M   75M  149M  34% /boot

From what I've seen online, this usually has to do with past kernel versions s ticking around longer than they need to. Though, from what I was able to see, there weren't past versions hanging out after running "dpkg -l linux-image*":

un  linux-image     
ii  linux-image-4.4.0-63-generic  
ii  linux-image-extra-4.4.0-63-generic
ii  linux-image-generic-lts-xenial

I'm not sure where else to look to figure out the problem (especially since it seems like /boot isn't full). Any ideas?

edit Adding comment requested commands:

user@thiscomp:/usr/src/linux-4.10.12$ df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/dm-0      16777216 469172 16308044    3% /
..
/dev/sda1         62248    307    61941    1% /boot
user@thiscomp:/usr/src/linux-4.10.12$ ls -l /boot
total 69528
-rw-r--r-- 1 root root  1245512 Feb 13 06:43 abi-4.4.0-63-generic
-rw-r--r-- 1 root root   203277 Apr 25 22:42 config-4.10.12
-rw-r--r-- 1 root root   203277 Apr 25 22:32 config-4.10.12.old
-rw-r--r-- 1 root root   190255 Feb 13 06:43 config-4.4.0-63-generic
drwxr-xr-x 5 root root     1024 Apr 25 20:17 grub
-rw-r--r-- 1 root root 35960364 Apr 25 17:46 initrd.img-4.4.0-63-generic
drwx------ 2 root root    12288 Feb 15 16:18 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-r--r-- 1 root root  3662296 Apr 25 22:42 System.map-4.10.12
-rw-r--r-- 1 root root  3662296 Apr 25 22:32 System.map-4.10.12.old
-rw------- 1 root root  3897401 Feb 13 06:43 System.map-4.4.0-63-generic
-rw-r--r-- 1 root root  7169312 Apr 25 22:42 vmlinuz-4.10.12
-rw-r--r-- 1 root root  7169312 Apr 25 22:32 vmlinuz-4.10.12.old
-rw------- 1 root root  6989520 Feb 13 06:43 vmlinuz-4.4.0-63-generic

edit2 mounted tmpfs:

user@thiscomp:/usr/src/linux-4.10.12$ sudo mount -t tmpfs none /boot
user@thiscomp:/usr/src/linux-4.10.12$ sudo make install
sh ./arch/x86/boot/install.sh 4.10.12 arch/x86/boot/bzImage \
            System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.12         
/boot/vmlinuz-4.10.12
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.12                 
/boot/vmlinuz-4.10.12
update-initramfs: Generating /boot/initrd.img-4.10.12
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.12 /boot/vmlinuz-
4.10.12
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.10.12 
/boot/vmlinuz-4.10.12
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.12 
/boot/vmlinuz-4.10.12
comp528@virt05:/usr/src/linux-4.10.12$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       252G   43G  197G  18% /
...
none             16G  310M   16G   2% /boot
osgx
  • 90,338
  • 53
  • 357
  • 513
MangoOfFury
  • 97
  • 3
  • 11
  • 1
    Please note that SO is only for programming questions. Check Super User, UNIX&Linux or some other suitable site where this would be on topic. – Sami Kuhmonen Apr 26 '17 at 03:54
  • MangoOfFury, what is `ls -l /boot` output? How many modules are enabled in your kernel config? How many modules are installed into your initramfs? Check https://askubuntu.com/questions/223248, https://askubuntu.com/questions/497032 and other search results for "Generating" + "gzip: stdout: No space left on device" – osgx Apr 26 '17 at 03:58
  • I added the output of "df -i" and "ls -l /boot". Also, apologies. I wasn't aware that this was off topic – MangoOfFury Apr 26 '17 at 04:02
  • @MangoOfFury, try to delete some old files (`*.old`), but it will not help. We may expect that your built too many modules or with huge debug information. Temporary mount with tmpfs will allow you to generate initramfs and see its full size (200+MB). – osgx Apr 26 '17 at 04:05
  • added that to the post – MangoOfFury Apr 26 '17 at 04:12

1 Answers1

6

I checked to see if /boot was full, but it seemed like it wasn't:

 /dev/sda1       236M   75M  149M  34% /boot

run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.12 
/boot/vmlinuz-4.10.12
update-initramfs: Generating /boot/initrd.img-4.10.12
gzip: stdout: No space left on device

It is still problem with the free space on /boot partition. (There was temporary file written by gzip, up to 149 MB of 300MB, but when all space was used and boot was full, gzip just deleted the file so you don't see it)

You may try to temporary mount something bigger into /boot partition, like

 mount -t tmpfs none /boot

and restarting sudo make install to find real size of your initramfs (300MB).

Or find what parameters are used by /etc/kernel/postinst.d/initramfs-tools to start update-initramfs and add -v option. You may also try to

  • reformat your disk to bigger /boot
  • disable some modules in config and doing rebuild
  • strip modules before installing by make INSTALL_MOD_STRIP=1 modules_install command - https://superuser.com/questions/705121
  • install only needed modules into initramfs
osgx
  • 90,338
  • 53
  • 357
  • 513
  • I tried that and added the results to the post. I'm not sure what Im seeing here in regards to: "none 16G 310M 16G 2% /boot" – MangoOfFury Apr 26 '17 at 04:12
  • @MangoOfFury, No errors with installing into tmpfs (and this clearly will not boot your PC as tmpfs is temporal imitation of FS in your OS RAM). And we see your initramfs + kernel image size is 310 MB, and kernel image size is 7 MB, so **your initramfs is ~300 MB. Don't fit into 150 MB of your real `/boot`**. Reconsider list of modules to build and to include into your initramfs (compare lists of modules in /lib/modules/old_kernel and /lib/modules/you_kernel; and count `=M` in old kernel config and in your config). Or reformat your drive with bigger /boot. Not a programming question. – osgx Apr 26 '17 at 04:17
  • Ok thank you I will try that – MangoOfFury Apr 26 '17 at 04:20
  • Actually I did simply accept all the defaults and save the .config file that was generated from "make menuconfig".. so I'll have to see where the differences are between my old kernel and this one. Is there anyway to know which modules I definitely want to keep? – MangoOfFury Apr 26 '17 at 04:24
  • Did you use same kind of defaults and default assumptions in your kernel configuration and in your /boot partition sizing? It is case when people of kernel will assume bigger /boot (they need to test all modules by building) than people of whole-disk-as-md-dm-device-with-smallest-possible-boot-partition-that-fits-at-most-two-compact-kernels from Ubuntu LVM installer. If you can't configure kernel, just: use askubuntu.com for questions (it will be easier to close question as duplicate); and use ubuntu's kernel (or ubuntu srcs&kernel building process, not classic `make someconfig; make install`) – osgx Apr 26 '17 at 04:28
  • I'm not entirely sure as this was a system given to me to work with. I will try to used askubuntu.com from now on! I'm just hoping I can figure this out or resize /boot without having to wipe/format/otherwise the entire system. I appreciate the help – MangoOfFury Apr 26 '17 at 04:36
  • Mango, just try not to reinvent the kernel building process of the OS you don't know (on virtual machines of other people). Use OS upgrading guides and kernels from your vendors: https://wiki.ubuntu.com/Kernel/LTSEnablementStack https://wiki.ubuntu.com/Kernel/RollingLTSEnablementStack - there are 4.8 kernels for xenial as simple as `sudo apt-get install --install-recommends linux-generic-hwe-16.04` - http://packages.ubuntu.com/xenial/kernel/linux-generic-hwe-16.04. Why you need to move from 4.4 to 4.8 or 4.10 on virtual? There is no new hardware to support – osgx Apr 26 '17 at 04:44
  • And there is PPA: http://news.softpedia.com/news/how-to-install-linux-kernel-4-10-on-ubuntu-16-10-and-ubuntu-16-04-lts-513164.shtml "(e.g. linux-image-4.10.0-041000-generic_4.10.0-041000.201702191831_amd64.deb if you're running Ubuntu on a 64-bit PC) from http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10/ ." – osgx Apr 26 '17 at 04:46
  • Ah I was following this walk though: http://www.thegeekstuff.com/2013/06/compile-linux-kernel but it seems to not have served me well. – MangoOfFury Apr 26 '17 at 04:46
  • I wasn't sure if some of these other options allowed you to build a kernel that has files that I've edited. I will look into them, thanks! – MangoOfFury Apr 26 '17 at 04:47
  • 2
    @osgx, I'm pretty sure the size is so big since they didn't strip the modules. Sounds pretty much like that. – 0andriy Apr 26 '17 at 09:28
  • @0andriy, there is also different config - ubuntu generic for old kernel and defconfig for new. He need no so many modules for virtual guest kernel - there is limited set of emulated hardware. How to strip modules before install? Is passing `INSTALL_MOD_STRIP=1` to `make modules_install` enough? (https://superuser.com/questions/705121) – osgx Apr 26 '17 at 12:37
  • It seems that this image (initrd.img-4.10.12 : 312,429,420) is significantly larger than my current one (initrd.img-4.4.0-63-generic : 35,960,364) I thought maybe I could set CONFIG_DEBUG_KERNEL=n to save space, but 1. It keeps switching back to =y, and 2. my current kernel has it set to =y..so i dont know if that's even the problem – MangoOfFury Apr 26 '17 at 13:27
  • And interestingly enough, the new kernel that I'm trying to big and seems to large has less modules (=m is 4332) than the one I'm trying to update (=m is 4409) – MangoOfFury Apr 26 '17 at 13:51
  • 1
    @MangoOfFury, Try `make INSTALL_MOD_STRIP=1 modules_install` command to install modules. Also: you can try using `make oldconfig` with config from 4.4 xenial kernel or even disable most hardware drivers - you have no hardware in virtual environment. – osgx Apr 26 '17 at 14:04
  • Well this is a system I was given but it is an actual machine. I'm just ssh'ing into it. I will try to run with the oldconfig now as well as tripping the modules. – MangoOfFury Apr 26 '17 at 14:23
  • stripping the modules ended up helping significantly and reduced the size quite a bit. Thank you for being persistent and helping me out! I'm not sure what the protocol is, but do you edit your answer to include what solved it, then I mark it as correct? – MangoOfFury Apr 26 '17 at 15:02