cleanup (reclaiming disk space) after kernel build

Recently I installed openSUSE 12.1. A few days later updated it to 3.1.9.1.4-default using (I think) Software Update or zypper.

Trying to install a driver which I was trying to incorporate into the kernel, I did three things that increased my disk space:

I 1. used zypper to install packages: make, gcc, kernel-source, kernel-syms. It could not find kernel-headers.
(note: I tried to get kernel-headers too, but it said " ‘linux-glibc-devel’ providing ‘kernel-headers’ is already installed."
root:/usr/src/linux: >zypper install kernel-headers

  1. I ran “make” and “make modules_install” from /usr/src/linux ( I ended up removing the new driver source code from the kernel tree because I could not get it to compile during the “make”, but I finished the make anyway).

I assume that most (if not all) of the .o (object code) files can be deleted. I hear there are make options to cleanup stuff after make. What exactly can I safely do to free disk space??? Also, any advice on keeping kernel source around?

The usr/src/linux directory currently contains 5.6G.

The current contents of /lib/modules is:

root:/lib/modules>ls -al
total 36
drwxr-xr-x 7 root root 4096 Apr 18 15:34 .
drwxr-xr-x 22 root root 12288 Apr 21 10:42 …
drwxr-xr-x 3 root root 4096 Apr 18 15:34 3.1.0-1.1-default
drwxr-xr-x 6 root root 4096 Apr 23 10:17 3.1.9-1.4-default
drwxr-xr-x 2 root root 4096 Apr 18 09:46 3.1.9-1.4-desktop
drwxr-xr-x 2 root root 4096 Apr 18 09:46 3.1.9-1.4-pae
drwxr-xr-x 2 root root 4096 Apr 18 09:46 3.1.9-1.4-xen
root:/lib/modules>

Thanks you for any help.

On 2012-04-24 16:56, odindba wrote:

> I 1. used zypper to install packages: make, gcc, kernel-source,
> kernel-syms. It could not find kernel-headers.
> (note: I tried to get kernel-headers too, but it said "
> ‘linux-glibc-devel’ providing ‘kernel-headers’ is already installed."
> root:/usr/src/linux: >zypper install kernel-headers
>
> 2. I ran “make” and “make modules_install” from /usr/src/linux ( I

You should have run “make cloneconfig” first, and then use the option to
change the name of the kernel, so as not to overwrite the original modules.
There is a readme with instructions.

> I assume that most (if not all) of the .o (object code) files can be
> deleted.

Yes, but you installed then on top, so no.

> I hear there are make options to cleanup stuff after make. What
> exactly can I safely do to free disk space???

make clean.

> Also, any advice on
> keeping kernel source around?

You can remove the rpm, and reinstall the kernel binary.

> The usr/src/linux directory currently contains 5.6G.

Delete it later.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Thank you.

The “make clean” reduced the space usage in /usr/src/linux from 5.6 Gig to 516 Meg.

Are you saying that removing kernal-source and kernal-syms (using zypper or Yast->Software Manager) would mess my system up?

Thanks

On 2012-04-24 23:16, odindba wrote:
>
> Thank you.
>
> The “make clean” reduced the space usage in /usr/src/linux from 5.6 Gig
> to 516 Meg.

aha.

> Are you saying that removing kernal-source and kernal-syms (using
> zypper or Yast->Software Manager) would mess my system up?

No, I’m saying that you did already :slight_smile:

You installed your compiled modules on top of the modules that came with
the binary kernel rpm, because you did not change its name.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On 2012-04-24 23:16, odindba wrote:

> Are you saying that removing kernal-source and kernal-syms (using
> zypper or Yast->Software Manager) would mess my system up?

Look, the first phase of making a kernel here is “make cloneconfig”, which
you skipped. This makes sure that you use the same options as the suse
kernel you are running - thus when you replace the modules you are doing so
with modules compiled with different options, and this may be a problem.

You have the choice of using the same kernel name, and add another module,
or making a new kernel, with different options, and a different name. For
this, in the kernel configuration phase the first thing to do is select a
kernel name, there is a menu entry for that.

Thus I suggest you replace the running kernel with another copy of it, to
make sure.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I am a novice at doing anything with kernels.

Could you tell me exactly what steps to do starting with
make cloneconfig and ending with any Grub changes that will result in everything being fine, or should I just give up and reinstall OpenSuse 12.1 from scratch.

I have never touched kernels before this week.
Thanks.

On 2012-04-25 00:56, odindba wrote:
>
> I am a novice at doing anything with kernels.
>
> Could you tell me exactly what steps to do starting with
> make cloneconfig and ending with any Grub changes that will result in
> everything being fine, or should I just give up and reinstall OpenSuse
> 12.1 from scratch.
>
> I have never touched kernels before this week.

What is your intention?

If you want to restore the status, simply reinstall the kernel binary using
YaST.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

My intention is to have and use a kernel I trust is fine. I hear you saying mine might be currently inconsistent.

What exactly would I do in Yast to replace the kernal binaries for 3.1.9.1.4?

Thanks

I am now running zypper install kernel-default

Could you look at its output below to see if you think I am OK or not please? Thanks

It seems to be installing 3.1.10.1.9 ( I had 3.1.9.1.4 before this zypper command)

but after it finished, uname -a says: root:/root>uname -a
Linux linux-5bf5 3.1.9-1.4-default #1 SMP Fri Jan 27 08:55:10 UTC 2012 (efb5ff4) i686 i686 i386 GNU/Linux
root:/root>

My output from zypper install kernel-default was:

root:/root>zypper install kernel-default
Loading repository data…
Reading installed packages…
Resolving package dependencies…

The following package is going to be upgraded:
kernel-default

1 package to upgrade.
Overall download size: 36.8 MiB. After the operation, additional 68.0 KiB will be used.
Continue? [y/n/?] (y): y
Retrieving package kernel-default-3.1.10-1.9.1.i586 (1/1), 36.8 MiB (114.1 MiB unpacked)
Retrieving: kernel-default-3.1.10-1.9.1.i586.rpm [done (499.8 KiB/s)]
Installing: kernel-default-3.1.10-1.9.1 [done]
Additional rpm output:

Kernel image: /boot/vmlinuz-3.1.10-1.9-default
Initrd image: /boot/initrd-3.1.10-1.9-default
KMS drivers: nouveau
Root device: /dev/disk/by-id/ata-IC35L120AVV207-0_VNVD00G4G1UHYD-part6 (/dev/sdb6) (mounted on / as ext4)
Kernel Modules: hwmon thermal_sys thermal processor fan libata ata_piix ata_generic rtc-cmos button video wmi mxm-wmi i2c-core i2c-algo-bit drm drm_kms_helper ttm nouveau pata_amd pata_marvell pata_piccolo pata_sch pata_hpt3x3 pata_acpi pata_opti pata_qdi sata_qstor libahci ahci pata_hpt37x sata_sx4 sata_inic162x pata_ali pata_triflex pata_ns87415 pata_atp867x pata_cs5535 pata_hpt3x2n acard-ahci pata_pdc202xx_old pata_jmicron pata_mpiix pata_atiixp pata_arasan_cf pata_rz1000 pata_cs5520 pata_it8213 pata_it821x sata_nv pata_sl82c105 pata_ns87410 sata_sil pata_cypress pata_cmd640 pata_legacy sata_sil24 sata_mv pdc_adma pata_cmd64x pata_cs5536 pata_oldpiix sata_svw pata_rdc pata_pdc2027x pata_serverworks pata_sis sata_promise pata_sil680 pata_optidma sata_sis pata_isapnp sata_vsc pata_via ahci_platform pata_cs5530 pata_sc1200 pata_artop pata_hpt366 sata_uli pcmcia_core pcmcia pata_pcmcia pata_netcell pata_radisys pata_ninja32 sata_via pata_efar usbcore ohci-hcd uhci-hcd ehci-hcd hid usbhid
Features: acpi kms block usb resume.userspace resume.kernel
Bootsplash: openSUSE (1280x1024)

root:/root>uname -r
3.1.9-1.4-default

On 2012-04-25 01:26, odindba wrote:

> What exactly would I do in Yast to replace the kernal binaries for
> 3.1.9.1.4?

Just tell yast to reinstall it. Click on the package several times, it will
tell you what it is going to do with each click.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On 2012-04-25 01:46, odindba wrote:
> It seems to be installing 3.1.10.1.9 ( I had 3.1.9.1.4 before this
> zypper command)
>

You have to reboot.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)