diff options
author | Aaron Ball <nullspoon@iohq.net> | 2015-10-30 08:43:10 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@iohq.net> | 2015-10-30 08:43:10 -0600 |
commit | 19abf334af83909012c6de55bed7ec7b01f0ca5d (patch) | |
tree | b4c4fc2eda26eb55a5b96c52a3b5d620c50212c8 /src | |
parent | 503c721f12af15b8f74e40ee62153afb80a128b1 (diff) | |
download | oper.io-19abf334af83909012c6de55bed7ec7b01f0ca5d.tar.gz oper.io-19abf334af83909012c6de55bed7ec7b01f0ca5d.tar.xz |
Wrote Gentoo:Kernel Cleanup post
Diffstat (limited to 'src')
-rw-r--r-- | src/gentoo:kernel_cleanup.ascii | 132 | ||||
-rw-r--r-- | src/index.ascii | 23 |
2 files changed, 146 insertions, 9 deletions
diff --git a/src/gentoo:kernel_cleanup.ascii b/src/gentoo:kernel_cleanup.ascii new file mode 100644 index 0000000..db2ef7c --- /dev/null +++ b/src/gentoo:kernel_cleanup.ascii @@ -0,0 +1,132 @@ +Gentoo:Kernel Cleanup +===================== +:author: Aaron Ball +:email: nullspoon@iohq.net +:revdate: October 30, 2015 + +== {doctitle} + +Gentoo is a source-based Linux distribution. Moreover it's aimed at more +advanced users with the intent of not forcing anything on them, as much as is +possible with so many packages. + +Normally, whenever you get a kernel update on a distro, say from 4.2.0 to +4.2.5, the system does several things. + +* Download the new kernel (pre-compiled) +* Install the new kernel +* Update the initramfs +* Update the bootloader +* Clean up the unused kernels + +Gentoo requires that their users to each of those items. I'm fairly new to +Gentoo and, coming from Arch Linux, already knew for the most part how to do +all of those steps, except for the last one. That said, lets talka bout how to +clean up unused kernels on your system. + +== TL;DR Summary + +Here are the locations that need to be cleaned up, in case you want to skip to +that section or already know what you're doing but just need the list. + +* emerge -C <sys-kernel/<type>-sources-<version> _(This is specific to Gentoo)_ +* Files + * /usr/src/linux-<versions> + * /lib/modules/<versions> + * /boot/*-<versions> + + +== Inventory + +The first step is to take an inventory. The largest part of a kernel in Gentoo +is its source code, so we'll look at that for the inventory (there are other +ways and we'll look into those as well). + +Gentoo stores its kernel source at _/usr/src/linux-*_. In there, you can see +multiple versions of the linux source code. In my case, I have linux-4.2.0 all +the way up to linux 4.2.5. + +NOTE: In my case, I'm using vanilla-sources for my kernel, so the directory +names for you might be a tad different. Despite though, they should still start +with _linux-x.x.x*_. + + +== Clean Up the Source + +Now that we have an inventory, let's clean up the source. This is very simple. +Once you know what versions you want to keep, we can issue an emerge command +that will clean up the files for the source. For my example, we'll say we want +to remove anything before 4.2.4 + +---- + emerge -Cp <sys-kernel/vanilla-sources-4.2.4 +---- + +That command will delete any files installed by emerge if they belong to kernel +versions 4.2.3 or less. However, it doesn't clean up any files created by the +compile process, so we still need to remove those. + +To see where we are first, here's an ls example of my src directory. + +---- + 0 [nullspoon@null ~]$ ls /usr/src/ + linux linux-4.2.0 linux-4.2.1 linux-4.2.2 linux-4.2.3 linux-4.2.4 linux-4.2.4-gentoo linux-4.2.5 linux-4.2.5-gentoo +---- + +Now for a simple but gratifying rm command. Since rm has no knowledge of the +kernel versioning scheme, we can't say "less than version 4.2.4" and it'll +clean up. In this case, we'll use a simple bash sequence. + +---- + rm -rf /usr/src/linux-4.2.{0,1,2,3} +---- + +NOTE: If you are worried about running that command and what it'll do, run it +with echo before it to see what it will output without actually deleting +anything. + + +== Clean up Installed Modules + +The Linux kernel stores its modules in */lib/modules* (fun fact: /lib is +usually a symlink to /lib64 if you're running a 64 bit system, or /lib32 if +you're running a 32 bit system). + +Similar to cleaning up the sources, we will clean up the moduels with a simple +but gratifying _rm -rf_ command. + +---- + rm -rf /lib/modules/4.2.{0,1,2,3} +---- + +That will clean up all the installed modules for the specified old kernel +versions (in this case, 4.2.0, 4.2.1, etc). + + +== Clean up Old Installed Kernels + +The Linux Kernel installs itself to _/boot_. To see what you have for the +given version set (again, using the one from previous examples, run the +following command... + +---- + ls /boot/*-4.2.{0,1,2,3} +---- + +Again, a simple rm command will clean up these files. + +---- + rm -f /boot/*-4.2.{0,1,2,3} +---- + + +And with that, you're done. All clean! + + + + + +[role="datelastedit"] +Last edited: {revdate} + +// vim:set syntax=asciidoc: diff --git a/src/index.ascii b/src/index.ascii index 11d9fd0..478401a 100644 --- a/src/index.ascii +++ b/src/index.ascii @@ -6,18 +6,14 @@ Index [role="index"] == Home -Git -~~~ -* link:?p=Git_as_a_Backup_Solution[Git as a Backup Solution] -* link:?p=Git_Basics[Git Basics] -* link:?p=Git:Branch_Author_List[Git:Branch Author List] -* link:?p=Git:Care_Free_Committing[Git:Care Free Committing] -* link:?p=Git:Changing_Project_Licensing[Git:Changing Project Licensing] -* link:?p=Git:Clone_All_Remote_Repos[Git:Clone All Remote Repos] +New Posts +~~~~~~~~~ +* link:?p=gentoo:kernel_cleanup[Gentoo:Kernel Cleanup] Linux ~~~~~ +* link:?p=gentoo:kernel_cleanup[Gentoo:Kernel Cleanup] * link:?p=Cool,_Fun,_and_Mostly_Useless_Things_to_do_with_Linux[Cool, Fun, and Mostly Useless Things to do with Linux] * link:?p=Changing_the_Hostname_on_a_Linux_Box[Changing the Hostname on a Linux Box] * link:?p=Linux:Using_Bash_to_Generate_a_Wordlist[Linux:Using Bash to Generate a Wordlist] @@ -80,7 +76,6 @@ Security * link:?p=Encrypting_Home_Directories_with_EncFS[Encrypting Home Directories with EncFS] * link:?p=Securing_a_Postfix_Smtp_Server[Securing a Postfix Smtp Server] - Filesystesm and Storage ^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,6 +98,16 @@ Scripting * link:?p=Javadoc-style_Perl_Documentation_Generator[Javadoc-style Perl Documentation Generator] +Git +~~~ +* link:?p=Git_as_a_Backup_Solution[Git as a Backup Solution] +* link:?p=Git_Basics[Git Basics] +* link:?p=Git:Branch_Author_List[Git:Branch Author List] +* link:?p=Git:Care_Free_Committing[Git:Care Free Committing] +* link:?p=Git:Changing_Project_Licensing[Git:Changing Project Licensing] +* link:?p=Git:Clone_All_Remote_Repos[Git:Clone All Remote Repos] + + Personal ~~~~~~~~ |