Announcement

Collapse
No announcement yet.

What are "Linux headers" and why should I apt-get update?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What are "Linux headers" and why should I apt-get update?

    This is for the new folks.

    Because, if one installs only using Synaptic or Muon one will. eventually, get a popup window saying that some stuff is not going to be dealt with and, if one views the details, one sees that, the items are almost always "Linux headers".

    And they will "build up" even if one only does "updates"

    This can be, at worst. an "inconvenience" in that one has to close the window, but when the "not needed" headers "build up", I personally think that they can slow down the install of packages, and every once in a while, if a LOT of them have built up, when one goes to Synaptic it won't work.

    I may be wrong on that, but the evidence, for moi, is that if I then do the apt-get autoremove in terminal the situation goes away.

    Here is a very nice explanation of what "headers" are, go to the reply by Patrick Kilgore:

    https://answers.launchpad.net/ubuntu/+question/54157

    What to do, what to do, what to do.....

    Menu / system / terminal

    In terminal type:
    sudo apt-get update
    One will be asked for one's password, type it in and hit enter.

    Update will occur, it is instructive to watch it.

    At the end one will see a sentence to the effect that there outdated packages in the system and one should run

    apt-get autoremove
    There may be new packages to install, just go ahead and install them..

    and THEN run apt-get autoremove

    If one has not done this REGULARLY, it can take a LONG time for the autoremove to complete, but it is instructive to watch the headers being removed, they are time - date stamped.

    Soo...there are MANY very experienced folks here and if they would like to chime in to change, update, argue with or add to this post please so do, I will not argue, because I'm just a hardware kinda guy!

    woodhardwarekindaguysmoke
    Last edited by woodsmoke; Dec 30, 2015, 12:30 AM.

    #2
    Is there a way to get the autoremove to happen automatically? Command line solutions are not for everyone.

    Comment


      #3
      An FWIW post:

      Cheat sheet

      I keep copying bits from posts here, pasting them into a .odt, and currently have the following. I did some quick edits/cleaning of this text, but it is basically "what it is" from which you can extract and make your own notes. Vinny, ronw, kubicle, and others have posted on this subject (and some of the following may be from their posts).

      //////////

      Removing old kernels

      Every kernel has four packages (kernel 3.5.0-15 is shown as an example); and these are the files (for old kernels) that you want to remove:

      linux-headers-3.5.0-15 (header files)
      linux-headers-3.5.0-15-generic (additional headers depending on kernel type)
      linux-image-3.5.0-15-generic (kernel image) <-- Important
      linux-image-extra-3.5.0-15-generic (extra image)

      Once you have installed a new kernel and booted into it to see that it's working properly, you can remove all packages related to older kernels - generally around 220 MB for all packages together per kernel. However, you may want to keep the kernel version previous to the newest (that you are using now) so you have a backup option should something go wrong with the current (newest) kernel.


      In Muon (or Synaptic), you can enter in the search box:

      linux-image
      linux-headers
      Or, try this:
      Simply enter the kernel version number; for example, enter
      3.13.0
      and the headers and image files should come up.

      You can now uninstall all packages except those four for the latest kernel (and maybe the four files for the previous kernel, if you want a backup option).

      Un-installing
      Some users here (e.g., vinny and I) recommend you use the "purge" option (in Muon, for example), to remove these files.

      =====

      Removing kernels

      kubicle:
      Actually, removing a kernel image package frees over 100Mb (it's not just the image, the package installs a good number of firmware and modules in /lib/firmware/{kernel} and /lib/modules/{kernel}); if you add the headers, that's another 100 MB.

      =====

      Someone else said:
      > Remove the linux-image-VERSION-generic packages and it will also remove the modules for you.

      =====

      Keep the last two kernels:

      (ronw) I let auto-remove remove old kernels, AFTER confirming the 'keep last 2 kernels' bit is working. In other words, I run an 'ls /boot' and check that what auto-remove is going to do is sane.

      [Important:]
      See the '01autoremove-kernels' file in /etc/apt/apt.conf.d if you are interested in where the 'keep last 2' magic happens.

      =====

      Remove old kernels -- using apt-get
      Do the following if you wish to remove all older kernel versions that are not in use (except the previous one that you are not using. This is to make sure that if the current kernel version fails in some way, you have a way to go back to a previous state). Do the following:

      Code:
      sudo apt-get autoclean
      This will eliminate any old files (Including kernel versions) you may have. Note that if you have many old versions, it will take a while since it has to make sure that removing the kernel version has no issues. You can also do the following:

      Code:
      sudo apt-get clean
      Which will eliminate everything downloaded and stored in the cache folder of apt. Lastly you have:

      Code:
      sudo apt-get autoremove
      which would check for any unused packages and remove them if necessary. This is great for those libraries and dependency packages that are no longer needed by any app installed.

      \\\\\\\\\\
      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

      Comment


        #4
        Qqmike, thanks for the info on file cleanup. I'm pulling a copy for my docs.
        Woodsmoke, thanks for starting this thread.
        Kubuntu 24.11 64bit under Kernel 6.12.1, Hp Pavilion, 6MB ram. Stay away from all things Google...

        Comment


          #5
          @ TWPonKubuntu: you bet.

          Just checked. I have 10 kernel versions in my /boot directory. Time to get rid of 8 of those (I just use Muon, search, highlight, purge).
          An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

          Comment


            #6
            Thanks. I'm worried about removing the wrong kernels. I wonder if there is a button that does the same as autoremove? Presumably that knows what is allowed to be removed.

            Comment


              #7
              I don't know of any button to push in Muon.

              I'm worried about removing the wrong kernels.
              You can trust autoremove.

              Now and then you may see some discussion about what autoremove is doing or not doing or should do, and bugs do occur, and so on. However, you can almost always trust it to remove all but the two most recent kernel files (and related packages). (At worst, you can trust autoremove to remove all but the most recent kernel package. It will never leave you stranded without a kernel to boot up!)

              You can also trust yourself to remove them using Muon and the search box in Muon.
              Before you open Muon, open Dolphin, click the red Root folder (on the left side menu). Click /boot to open the /boot directory, look inside /boot to see your kernels. Look for the "main" kernel files, the vmlinux-x.x.x-x[.whatever]. For example, you might see this in your /boot:

              vmlinuz-3.13.0-63-generic[.efi.signed]
              vmlinuz-3.13.0-65-generic[.efi.signed]
              vmlinuz-3.13.0-67-generic[.efi.signed]
              vmlinuz-3.13.0-68-generic[.efi.signed]
              vmlinuz-3.13.0-70-generic[.efi.signed]
              vmlinuz-3.13.0-71-generic[.efi.signed]
              vmlinuz-3.13.0-73-generic[.efi.signed] <-- KEEP
              vmlinuz-3.13.0-74-generic[.efi.signed] <-- KEEP

              Now you know what to delete (using Muon):

              Delete everything related to 3.13.0-71 and lower (70, 68, 67, 65, and 63). You will keep (not delete) anything pertaining to 3.13.0-73 or 3.13.0-74.

              You are looking for these four types of files: linux-headers-, linux-headers-xxx-generic, linux-image-xxx-generic, linux-image-extra-xxx-generic.

              In the Muon search box, enter 3.13.0 and you will see all this stuff listed (you have to scroll way down to see all of it). Highlight the files to delete (see the post above for the four types of files you are looking for), right-click, mark for Purge, then click Apply at the top of the Muon menu, and then wait until it finishes (it may take awhile, like 2-10 minutes, depending on how many kernel packages you are removing).

              (In Muon, you can also search on linux-image and linux-headers, to see all the files to delete.)

              Edit:
              Btw, you can aways re-install a kernel and its packages if you accidentally delete one you had wanted to keep. Do this in Muon.
              An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

              Comment


                #8
                Thanks but that's way to complex to get normal users, like children and my old mum to remember all the steps.

                Adding autoremove as a button or an automatic function would open up Kubuntu to loads more people.
                Last edited by ianp5a; Dec 30, 2015, 02:32 PM.

                Comment


                  #9
                  way to complex to get children and my old mum to do.
                  Perhaps. But that is why you are appointed as the computer administrator for their computers!
                  An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                  Comment


                    #10
                    I don't see how I can help them. I have never needed the command line so far. I don't see why I'd have to learn a whole load of geekery. I work in usability. If I have to work 'for' an OS, rather than have the OS work for me, I'll dump it.

                    A lot of people have put a lot of work into the GUIs and usability and learnability of Kubuntu, it's a shame to exclude normal users from it.

                    Imagine an option to enable scheduling autoremove and other goodies. Not hard to do.
                    Last edited by ianp5a; Dec 30, 2015, 03:01 PM.

                    Comment


                      #11
                      Use Muon to install Bleachbit, then configure Bleachbit to do the autoremove, autoclean, and clean.

                      (Windows isn't much better, with just Cleanup. You also need CCleaner.)
                      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                      Comment


                        #12
                        https://www.google.com/search?client...utf-8&oe=utf-8
                        An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                        Comment


                          #13
                          Thanks. No I'm not a Windows fan. I dumped that years ago. But grannies and children can use it. Which is not the best usability criteria, but it's one way to explain it.

                          Comment


                            #14
                            I could sweat that muon package manager has an autoremove option in its menus, and/or has a pop-up offering to autoremove after fetching updates, if appropriate.

                            But swearing is not very polite, as I could be wrong,especially as I can't check as I'm at work, and away from my computers

                            Sent from my VS986 using Tapatalk

                            Comment


                              #15
                              Thanks. I'll take a look too.

                              Sent from my D5803 using Tapatalk

                              Comment

                              Working...
                              X