Announcement

Collapse
No announcement yet.

Cleaning up system partition before upgrading to 22.04

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Cleaning up system partition before upgrading to 22.04

    I still haven't upgraded my system to 22.04

    I need to clean up my system partition first because I only have free space of 6 gigabytes and I'm not sure it will be enough for upgrading.


    I already used Bleachbit and as you can see I still don't have enough free space.

    does anybody have any idea what could be the problem


    someone here once told me that the most common Problem in this case is old kernels. So I tried the ls/boot command and this is what I came up with


    does anybody know if this could be the problem and what should I do to get rid of it ?

    Code:
    ron@ron-Vostro-270$  ls /boot
    config-5.4.0-100-generic  config-5.4.0-90-generic       initrd.img-5.4.0-173-generic  System.map-5.4.0-144-generic  vmlinuz-5.4.0-122-generic
    config-5.4.0-104-generic  config-5.4.0-91-generic       initrd.img-5.4.0-174-generic  System.map-5.4.0-146-generic  vmlinuz-5.4.0-124-generic
    config-5.4.0-105-generic  config-5.4.0-92-generic       initrd.img-5.4.0-73-generic   System.map-5.4.0-147-generic  vmlinuz-5.4.0-125-generic
    config-5.4.0-107-generic  config-5.4.0-94-generic       initrd.img-5.4.0-74-generic   System.map-5.4.0-148-generic  vmlinuz-5.4.0-126-generic
    config-5.4.0-109-generic  config-5.4.0-96-generic       initrd.img-5.4.0-77-generic   System.map-5.4.0-150-generic  vmlinuz-5.4.0-128-generic
    config-5.4.0-110-generic  config-5.4.0-97-generic       initrd.img-5.4.0-81-generic   System.map-5.4.0-152-generic  vmlinuz-5.4.0-131-generic
    config-5.4.0-113-generic  config-5.4.0-99-generic       initrd.img-5.4.0-84-generic   System.map-5.4.0-155-generic  vmlinuz-5.4.0-135-generic
    config-5.4.0-117-generic  efi                           initrd.img-5.4.0-86-generic   System.map-5.4.0-156-generic  vmlinuz-5.4.0-137-generic
    config-5.4.0-120-generic  grub                          initrd.img-5.4.0-88-generic   System.map-5.4.0-164-generic  vmlinuz-5.4.0-144-generic
    config-5.4.0-121-generic  initrd.img                    initrd.img-5.4.0-89-generic   System.map-5.4.0-167-generic  vmlinuz-5.4.0-146-generic
    config-5.4.0-122-generic  initrd.img-5.4.0-100-generic  initrd.img-5.4.0-90-generic   System.map-5.4.0-172-generic  vmlinuz-5.4.0-147-generic
    config-5.4.0-124-generic  initrd.img-5.4.0-104-generic  initrd.img-5.4.0-91-generic   System.map-5.4.0-173-generic  vmlinuz-5.4.0-148-generic
    config-5.4.0-125-generic  initrd.img-5.4.0-105-generic  initrd.img-5.4.0-92-generic   System.map-5.4.0-174-generic  vmlinuz-5.4.0-150-generic
    config-5.4.0-126-generic  initrd.img-5.4.0-107-generic  initrd.img-5.4.0-94-generic   System.map-5.4.0-73-generic   vmlinuz-5.4.0-152-generic
    config-5.4.0-128-generic  initrd.img-5.4.0-109-generic  initrd.img-5.4.0-96-generic   System.map-5.4.0-74-generic   vmlinuz-5.4.0-155-generic
    config-5.4.0-131-generic  initrd.img-5.4.0-110-generic  initrd.img-5.4.0-97-generic   System.map-5.4.0-77-generic   vmlinuz-5.4.0-156-generic
    config-5.4.0-135-generic  initrd.img-5.4.0-113-generic  initrd.img-5.4.0-99-generic   System.map-5.4.0-81-generic   vmlinuz-5.4.0-164-generic
    config-5.4.0-137-generic  initrd.img-5.4.0-117-generic  initrd.img.old                System.map-5.4.0-84-generic   vmlinuz-5.4.0-167-generic
    config-5.4.0-144-generic  initrd.img-5.4.0-120-generic  memtest86+.bin                System.map-5.4.0-86-generic   vmlinuz-5.4.0-172-generic
    config-5.4.0-146-generic  initrd.img-5.4.0-121-generic  memtest86+.elf                System.map-5.4.0-88-generic   vmlinuz-5.4.0-173-generic
    config-5.4.0-147-generic  initrd.img-5.4.0-122-generic  memtest86+_multiboot.bin      System.map-5.4.0-89-generic   vmlinuz-5.4.0-174-generic
    config-5.4.0-148-generic  initrd.img-5.4.0-124-generic  System.map-5.4.0-100-generic  System.map-5.4.0-90-generic   vmlinuz-5.4.0-73-generic
    config-5.4.0-150-generic  initrd.img-5.4.0-125-generic  System.map-5.4.0-104-generic  System.map-5.4.0-91-generic   vmlinuz-5.4.0-74-generic
    config-5.4.0-152-generic  initrd.img-5.4.0-126-generic  System.map-5.4.0-105-generic  System.map-5.4.0-92-generic   vmlinuz-5.4.0-77-generic
    config-5.4.0-155-generic  initrd.img-5.4.0-128-generic  System.map-5.4.0-107-generic  System.map-5.4.0-94-generic   vmlinuz-5.4.0-81-generic
    config-5.4.0-156-generic  initrd.img-5.4.0-131-generic  System.map-5.4.0-109-generic  System.map-5.4.0-96-generic   vmlinuz-5.4.0-84-generic
    config-5.4.0-164-generic  initrd.img-5.4.0-135-generic  System.map-5.4.0-110-generic  System.map-5.4.0-97-generic   vmlinuz-5.4.0-86-generic
    config-5.4.0-167-generic  initrd.img-5.4.0-137-generic  System.map-5.4.0-113-generic  System.map-5.4.0-99-generic   vmlinuz-5.4.0-88-generic
    config-5.4.0-172-generic  initrd.img-5.4.0-144-generic  System.map-5.4.0-117-generic vmlinuz                  
    vmlinuz-5.4.0-89-generic
    config-5.4.0-173-generic  initrd.img-5.4.0-146-generic  System.map-5.4.0-120-generic  vmlinuz-5.4.0-100-generic     vmlinuz-5.4.0-90-generic
    config-5.4.0-174-generic  initrd.img-5.4.0-147-generic  System.map-5.4.0-121-generic  vmlinuz-5.4.0-104-generic     vmlinuz-5.4.0-91-generic
    config-5.4.0-73-generic   initrd.img-5.4.0-148-generic  System.map-5.4.0-122-generic  vmlinuz-5.4.0-105-generic     vmlinuz-5.4.0-92-generic
    config-5.4.0-74-generic   initrd.img-5.4.0-150-generic  System.map-5.4.0-124-generic  vmlinuz-5.4.0-107-generic     vmlinuz-5.4.0-94-generic
    config-5.4.0-77-generic   initrd.img-5.4.0-152-generic  System.map-5.4.0-125-generic  vmlinuz-5.4.0-109-generic     vmlinuz-5.4.0-96-generic
    config-5.4.0-81-generic   initrd.img-5.4.0-155-generic  System.map-5.4.0-126-generic  vmlinuz-5.4.0-110-generic     vmlinuz-5.4.0-97-generic
    config-5.4.0-84-generic   initrd.img-5.4.0-156-generic  System.map-5.4.0-128-generic  vmlinuz-5.4.0-113-generic     vmlinuz-5.4.0-99-generic
    config-5.4.0-86-generic   initrd.img-5.4.0-164-generic  System.map-5.4.0-131-generic  vmlinuz-5.4.0-117-generic     vmlinuz.old
    config-5.4.0-88-generic   initrd.img-5.4.0-167-generic  System.map-5.4.0-135-generic  vmlinuz-5.4.0-120-generic
    config-5.4.0-89-generic   initrd.img-5.4.0-172-generic  System.map-5.4.0-137-generic  vmlinuz-5.4.0-121-generic
    ron@ron-Vostro-270~$
    Last edited by Snowhog; Mar 19, 2024, 01:36 PM.

    #2
    In the Konsole terminal emulator:
    • first
      sudo apt update && apt list --upgradable
    • if there are new packages
      sudo apt full-upgrade
      and
      reboot
    • then
      sudo apt autoremove --purge
      Warning: Read the output carefully and be sure that you really want to remove these (alleged useless) packages!
    • and
      sudo apt autoclean
    • reboot
      and check your free space
    If still not enough free space, try something like Filelight or for CLI ncdu to find out what uses up your space.
    Last edited by Schwarzer Kater; Mar 19, 2024, 12:30 PM. Reason: typos et al.
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    Comment


      #3
      have you run an apt autoremove at all?
      6Gb should be enoughg room, but of course you could have a bit more by cleaning up, for sure.

      What bleachbit settings are you using? I do hate that tool, it mucks with too many things, potentially. My first thought was that this might be the case of the problem, but I calmed down and don't really think so in this case.

      Why are you upgrading now?
      Might it be a better time to do a fresh install, if you do intend to go to 24.04 next month or so?

      Normally, you should have only three current kernels, but in older Ubuntu releases, this setup was often and easily be broken - and seems to be the case here. It is built in to apt itself today, instead of being separate scripts and processes

      There are scripts that can remove a bunch of these
      Or do it manually
      https://askubuntu.com/questions/1253...untu-20-04-lts

      I have used this myself, or something much like it, in the past.
      Last edited by claydoh; Mar 19, 2024, 12:35 PM.

      Comment


        #4
        I've never seen 46 kernels (yes, I counted) on one machine. That takes up a bit of space! That's like 5GB of initrd.img!

        Please Read Me

        Comment


          #5
          If autoremove doesn't get you down to only two, there's some issue with your system configuration. However, I suspect the upgrade would likely fix it.

          Please Read Me

          Comment


            #6
            Originally posted by oshunluvr View Post
            If autoremove doesn't get you down to only two, there's some issue with your system configuration. However, I suspect the upgrade would likely fix it.
            Maybe not. part of the problem was that kernel packages were being set as 'manual' installs by a bug somewhere, iirc, which would not change in the upgrade.

            Originally posted by oshunluvr View Post
            I've never seen 46 kernels (yes, I counted) on one machine. That takes up a bit of space! That's like 5GB of initrd.img!
            I saw a pile once, but I didn't count. it was after 7 upgrades, 3.5 years, back in the day, either starting or ending with 13.10 or so. Things definitely were not being autoremoved. It wasn't may main daily driver, but did run 24/7 for Kodi and backups destination. Somehow I never noticed the pileup happening until I ran out of inodes.

            Comment


              #7
              Kernel autoremove was changed from a file in /etc/apt/apt.conf.d to hard coding into apt itself. It's really no longer user configurable unless you edit the code to apt. The later versions of apt keep newest, current, and last kernels. My suspicion is when upgrading from 20.04 to 22.04, one would get the newer version of apt. Of course, this assumes one uses apt to upgrade.

              Please Read Me

              Comment


                #8
                Yes, but apt is still basing this off of being set as manual or auto-installed. ie as a dependency of a meta-package.
                if these were marked as manual (no matter how it was installed), as was happening to some in the past, then they won't be autoremoved
                ( I tested)

                apt-mark showauto | grep linux

                Code:
                $ apt-mark showauto | grep linux-
                binutils-x86-64-linux-gnu
                linux-base
                linux-headers-5.15.0-101
                linux-headers-5.15.0-101-generic
                linux-headers-6.2.0-39-generic
                linux-headers-6.5.0-25-generic
                linux-headers-6.5.0-26-generic
                linux-hwe-6.2-headers-6.2.0-39
                linux-hwe-6.5-headers-6.5.0-25
                linux-hwe-6.5-headers-6.5.0-26
                linux-image-5.15.0-101-generic
                linux-image-6.5.0-25-generic
                linux-image-6.5.0-26-generic
                linux-image-generic
                linux-libc-dev
                linux-modules-5.15.0-100-generic
                linux-modules-5.15.0-101-generic
                linux-modules-6.5.0-25-generic
                linux-modules-6.5.0-26-generic
                linux-modules-extra-5.15.0-101-generic
                linux-modules-extra-6.5.0-25-generic
                linux-modules-extra-6.5.0-26-generic
                linux-sound-base


                and
                apt-mark showmanual | grep linux
                $ apt-mark showmanual | grep linux-
                Code:
                linux-firmware
                linux-generic
                linux-headers-generic
                linux-headers-generic-hwe-22.04
                linux-image-5.15.0-100-generic  <--------------------see me?
                linux-image-generic-hwe-22.04

                Code:
                $ sudo apt autoremove
                Reading package lists... Done
                Building dependency tree... Done
                Reading state information... Done
                Starting pkgProblemResolver with broken count: 0
                Starting 2 pkgProblemResolver with broken count: 0
                Done
                
                $ sudo apt-mark auto linux-image-5.15.0-100-generic
                linux-image-5.15.0-100-generic set to automatically installed.
                
                ​]sudo apt autoremove
                Reading package lists... Done
                Building dependency tree... Done
                Reading state information... Done
                Starting pkgProblemResolver with broken count: 0
                Starting 2 pkgProblemResolver with broken count: 0
                Done
                The following packages will be REMOVED:
                 linux-image-5.15.0-100-generic linux-modules-5.15.0-100-generic
                0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
                After this operation, 127 MB disk space will be freed.
                Do you want to continue? [Y/n]
                
                ​
                ​This could lead to a useful way to fix this, if the kernel packages were marked as manual.

                Comment


                  #9
                  (Like claydoh. once I had to do this. [Edit]This post overlapped with claydoh's last one, and you might wait for his opinion on my suggestion here.)
                  Before trying the following, I suggest a good backup.

                  I suggest you identify the last two kernel versions you have, then do through each of the others (carefully) and remove them. The packages to remove are linux-modules-5.4.0-something-generic and linux-headers-5.4.0-something​.

                  If you are familiar with a tool like muon, synaptic, or aptitude I suggest using that tool, but otherwise you can use apt, for example
                  Code:
                  sudo apt remove linux-headers-5.4.0-81
                  sudo apt remove linux-modules-5.4.0-81-generic​
                  When my Kubuntu had linux 5 kernels, some header directories were not removed by the normal process, and they piled up for a while till I noticed them. This might have been a side effect of using dkms. After removing the old kernels, you might check for files or directories that have the old kernel version numbers in their names, and carefully delete them.

                  If you use grub as a boot loader, after deleting old kernels running sudo update-grub will tidy up the recovery menu.
                  Last edited by jlittle; Mar 19, 2024, 02:38 PM.
                  Regards, John Little

                  Comment


                    #10
                    I'm a GUI user so all this is way too complicated for me.

                    the reason I did not upgrade till now is because I prefer stability over everything and I always upgrade a year after the official release date So last april was my time to upgrade but since I noticed I had a problem with my memory I kept a putting it off because I didn't want to deal with it


                    before using Bleachbit I used this command and it helped a bit.

                    Code:
                    sudo apt-get clean && sudo apt-get autoclean && sudo apt-get autoremove[B][COLOR=#000000][FONT=Arial][/FONT][/COLOR][/B]
                    Actually, when I did use bleachbit it was mostly for cleaning the home folder


                    So what I think is going to be the best move for me to get out of this mess right now is to back up everything and try to upgrade anyway and see what happens.

                    what do you say ?

                    By the way, does it matter if I upgrade from the GUI or use the command line in this case ?



                    Comment


                      #11
                      Originally posted by ronshor View Post
                      By the way, does it matter if I upgrade from the GUI or use the command line in this case ?
                      No, there is no difference, other than how the prompts are presented to you.

                      Originally posted by ronshor View Post
                      So what I think is going to be the best move for me to get out of this mess right now is to back up everything and try to upgrade anyway and see what happens.

                      what do you say ?
                      As a firm believer in at least attempting upgrades.........do a clean install.
                      Backups, of course.
                      Or use some method to get rid of all the excess files, either via scripts, or manually via Muon or Synaptic.
                      I have a feeling that you might run out of inodes soon enough, which will be much more of a headache.

                      Comment


                        #12
                        Originally posted by ronshor View Post
                        I'm a GUI user so all this is way too complicated for me.
                        Then I suggest installing Synaptic, or maybe Muon. They're GUI apps, and you can search for the kernel version numbers.
                        Regards, John Little

                        Comment


                          #13
                          Originally posted by jlittle View Post

                          Then I suggest installing Synaptic, or maybe Muon. They're GUI apps, and you can search for the kernel version numbers.
                          Okay, but how can I do it with Muon ?

                          Comment


                            #14
                            Search for items containing -5.4.0-100-generic or similar - the newest seems to be 172, you might leave a few of the most current versions to be safe, for starters.
                            Then mass select all the unwanted items, and uninstall.

                            Comment


                              #15
                              Click image for larger version

Name:	Screenshot_20240324_140310.png
Views:	63
Size:	384.7 KB
ID:	677607

                              I ran the search you suggested on Muon and this is what it came up with.

                              So, what Should I do now ?

                              Just uninstall these 4 items ?


                              Comment

                              Working...
                              X