Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: How do I permanently disable autoremove of old kernels?

  1. #1
    Join Date
    Dec 2008
    Location
    Glos, UK
    Beans
    469
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    How do I permanently disable autoremove of old kernels?

    In the last month or so, Software Update has included removing old kernels alongside its software updates. I don't want this to happen - ever. I know I can untick it each time, but it is too easy to forget to do so.

    After a bad experience where, for a while, I needed to go back several kernels to find a fully functional one I never want to have old kernels removed except when I do it manually using synaptic.

    So how can I tell Software Update to leave old kernels alone unless I positively select them for removal?
    Ask me a dumb question. Then I'll know I am in good company.

  2. #2
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,201
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: How do I permanently disable autoremove of old kernels?

    col48; Hello -

    Management of old kernels is a function of unattended-upgrades. There are a number of ways to have the system NOT remove old kernels.
    Many of us who completely manage packages manually purge unattended-upgrades - that maybe rather drastic for your use case, A simpler more direct means to disable the removal feature is to edit the autoremove setting in /etc/apt/apt.conf.d/50unattended-upgrades from 'true' to 'false' and uncomment the line if applicable .

    It is well worth the time and effort to learn what all the package unattended-upgrades controls.

    my bit to try and help
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  3. #3
    Join Date
    Aug 2013
    Beans
    4,941

    Re: How do I permanently disable autoremove of old kernels?

    Usually you only need go back one kernel, if you need to go back more than one it just mean the previous one wasn't working either and you should have removed it before the current one, so when you do get the current one the working one wouldn't be removed.

  4. #4
    Join Date
    Dec 2008
    Location
    Glos, UK
    Beans
    469
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: How do I permanently disable autoremove of old kernels?

    @Bashing-om: Thanks for your response.... your simpler option is just what I am looking for, but the file does not seem to have such a line at all.

    This is what my 50unattended-upgrades file looks like:

    Code:
    // Automatically upgrade packages from these (origin:archive) pairs
    Unattended-Upgrade::Allowed-Origins {
    	"${distro_id}:${distro_codename}";
    	"${distro_id}:${distro_codename}-security";
    	// Extended Security Maintenance; doesn't necessarily exist for
    	// every release and this system may not have it installed, but if
    	// available, the policy for updates is such that unattended-upgrades
    	// should also install from here by default.
    	"${distro_id}ESM:${distro_codename}";
    //	"${distro_id}:${distro_codename}-updates";
    //	"${distro_id}:${distro_codename}-proposed";
    //	"${distro_id}:${distro_codename}-backports";
    };
    
    // List of packages to not update (regexp are supported)
    Unattended-Upgrade::Package-Blacklist {
    //	"vim";
    //	"libc6";
    //	"libc6-dev";
    //	"libc6-i686";
    };
    
    // This option allows you to control if on a unclean dpkg exit
    // unattended-upgrades will automatically run 
    //   dpkg --force-confold --configure -a
    // The default is true, to ensure updates keep getting installed
    //Unattended-Upgrade::AutoFixInterruptedDpkg "false";
    
    // Split the upgrade into the smallest possible chunks so that
    // they can be interrupted with SIGUSR1. This makes the upgrade
    // a bit slower but it has the benefit that shutdown while a upgrade
    // is running is possible (with a small delay)
    //Unattended-Upgrade::MinimalSteps "true";
    
    // Install all unattended-upgrades when the machine is shuting down
    // instead of doing it in the background while the machine is running
    // This will (obviously) make shutdown slower
    //Unattended-Upgrade::InstallOnShutdown "true";
    
    // Send email to this address for problems or packages upgrades
    // If empty or unset then no email is sent, make sure that you
    // have a working mail setup on your system. A package that provides
    // 'mailx' must be installed. E.g. "user@example.com"
    //Unattended-Upgrade::Mail "root";
    
    // Set this value to "true" to get emails only on errors. Default
    // is to always send a mail if Unattended-Upgrade::Mail is set
    //Unattended-Upgrade::MailOnlyOnError "true";
    
    // Do automatic removal of new unused dependencies after the upgrade
    // (equivalent to apt-get autoremove)
    //Unattended-Upgrade::Remove-Unused-Dependencies "false";
    
    // Automatically reboot *WITHOUT CONFIRMATION*
    //  if the file /var/run/reboot-required is found after the upgrade 
    //Unattended-Upgrade::Automatic-Reboot "false";
    
    // If automatic reboot is enabled and needed, reboot at the specific
    // time instead of immediately
    //  Default: "now"
    //Unattended-Upgrade::Automatic-Reboot-Time "02:00";
    
    // Use apt bandwidth limit feature, this example limits the download
    // speed to 70kb/sec
    //Acquire::http::Dl-Limit "70";
    Maybe I need to ADD a line???
    This file claims to have been last modified in May 2017, but the unwanted behaviour only started a month or two ago. Odd.
    Ask me a dumb question. Then I'll know I am in good company.

  5. #5
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,201
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: How do I permanently disable autoremove of old kernels?

    col48; Well ! not -

    Will not hurt to give a try to adding to the file . - make a bckup 1st just in case.

    what release are you running ?
    my 18.10 file:
    Code:
    sysop@x1810:~$ cat  /etc/apt/apt.conf.d/50unattended-upgrades
    // Automatically upgrade packages from these (origin:archive) pairs
    //
    // Note that in Ubuntu security updates may pull in new dependencies
    // from non-security sources (e.g. chromium). By allowing the release
    // pocket these get automatically pulled in.
    Unattended-Upgrade::Allowed-Origins {
            "${distro_id}:${distro_codename}";
    	"${distro_id}:${distro_codename}-security";
    	// Extended Security Maintenance; doesn't necessarily exist for
    	// every release and this system may not have it installed, but if
    	// available, the policy for updates is such that unattended-upgrades
    	// should also install from here by default.
    	"${distro_id}ESM:${distro_codename}";
    //	"${distro_id}:${distro_codename}-updates";
    //	"${distro_id}:${distro_codename}-proposed";
    //	"${distro_id}:${distro_codename}-backports";
    };
    
    // List of packages to not update (regexp are supported)
    Unattended-Upgrade::Package-Blacklist {
    //	"vim";
    //	"libc6";
    //	"libc6-dev";
    //	"libc6-i686";
    };
    
    // This option will controls whether the development release of Ubuntu will be
    // upgraded automatically.
    Unattended-Upgrade::DevRelease "false";
    
    // This option allows you to control if on a unclean dpkg exit
    // unattended-upgrades will automatically run 
    //   dpkg --force-confold --configure -a
    // The default is true, to ensure updates keep getting installed
    //Unattended-Upgrade::AutoFixInterruptedDpkg "false";
    
    // Split the upgrade into the smallest possible chunks so that
    // they can be interrupted with SIGTERM. This makes the upgrade
    // a bit slower but it has the benefit that shutdown while a upgrade
    // is running is possible (with a small delay)
    //Unattended-Upgrade::MinimalSteps "false";
    
    // Install all unattended-upgrades when the machine is shutting down
    // instead of doing it in the background while the machine is running
    // This will (obviously) make shutdown slower
    //Unattended-Upgrade::InstallOnShutdown "true";
    
    // Send email to this address for problems or packages upgrades
    // If empty or unset then no email is sent, make sure that you
    // have a working mail setup on your system. A package that provides
    // 'mailx' must be installed. E.g. "user@example.com"
    //Unattended-Upgrade::Mail "root";
    
    // Set this value to "true" to get emails only on errors. Default
    // is to always send a mail if Unattended-Upgrade::Mail is set
    //Unattended-Upgrade::MailOnlyOnError "true";
    
    // Remove unused automatically installed kernel-related packages
    // (kernel images, kernel headers and kernel version locked tools).
    //Unattended-Upgrade::Remove-Unused-Kernel-Packages "false";
    
    // Do automatic removal of new unused dependencies after the upgrade
    // (equivalent to apt-get autoremove)
    //Unattended-Upgrade::Remove-Unused-Dependencies "false";
    
    // Automatically reboot *WITHOUT CONFIRMATION*
    //  if the file /var/run/reboot-required is found after the upgrade 
    //Unattended-Upgrade::Automatic-Reboot "false";
    
    // If automatic reboot is enabled and needed, reboot at the specific
    // time instead of immediately
    //  Default: "now"
    //Unattended-Upgrade::Automatic-Reboot-Time "02:00";
    
    // Use apt bandwidth limit feature, this example limits the download
    // speed to 70kb/sec
    //Acquire::http::Dl-Limit "70";
    
    // Enable logging to syslog. Default is False
    // Unattended-Upgrade::SyslogEnable "false";
    
    // Specify syslog facility. Default is daemon
    // Unattended-Upgrade::SyslogFacility "daemon";
    
    // Download and install upgrades only on AC power
    // (i.e. skip or gracefully stop updates on battery)
    // Unattended-Upgrade::OnlyOnACPower "true";
    
    // Download and install upgrades only on non-metered connection
    // (i.e. skip or gracefully stop updates on a metered connection)
    // Unattended-Upgrade::Skip-Updates-On-Metered-Connections "true";
    sysop@x1810:~$
    Mind that I do manage packages personally .

    hope this helps
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  6. #6
    Join Date
    Dec 2008
    Location
    Glos, UK
    Beans
    469
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: How do I permanently disable autoremove of old kernels?

    Since I only wish to update software manually, would it be better to uninstall (=remove in synaptic) the unattended-upgrades package?
    I would presumably still be prompted when updates become available.

    I'm running 16.04 Xenial.
    Last edited by col48; July 7th, 2018 at 08:48 PM. Reason: add info
    Ask me a dumb question. Then I'll know I am in good company.

  7. #7
    Join Date
    Aug 2016
    Location
    Wandering
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: How do I permanently disable autoremove of old kernels?

    Quote Originally Posted by col48 View Post
    Since I only wish to update software manually, would it be better to uninstall (=remove in synaptic) the unattended-upgrades package?
    I have since 16.04 and up.
    Quote Originally Posted by col48 View Post
    I would presumably still be prompted when updates become available.
    Nope>>>No Prompts to upgrade.
    You will now be responsible solely to run sudo apt update && sudo apt upgrade yourself.
    It might be easiest just to set never with Software Sources via the Screenshot I show
    Attached Images Attached Images
    Last edited by 1fallen; July 7th, 2018 at 09:06 PM.
    With realization of one's own potential and self-confidence in one's ability, one can build a better world.
    Dalai Lama>>
    Code Tags | System-info | Forum Guide lines | Arch Linux, Debian Unstable, FreeBSD

  8. #8
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,201
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: How do I permanently disable autoremove of old kernels?

    col48; Hummm ..

    I would presumably still be prompted when updates become available.
    Honestly - I have run development (testing) for so long where I run updates at least twice a day - I just do not recall how auto-updates work .

    A thought is to try purging the unattended-upgrades package .. test and if not happy re-install it and re-configure .

    all a process in learning
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  9. #9
    Join Date
    Dec 2008
    Location
    Glos, UK
    Beans
    469
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: How do I permanently disable autoremove of old kernels?

    @Bashing-om & 1fallen:

    Thanks both. I'll explore further in a couple of days.... Life gets in the way!!

    I do want to be told about updates, but I don't want old kernels to be purged automatically. They didn't until recently, so I wonder what changed?
    Last edited by col48; July 7th, 2018 at 09:11 PM.
    Ask me a dumb question. Then I'll know I am in good company.

  10. #10
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    14,201
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: How do I permanently disable autoremove of old kernels?

    col48; well..

    They didn't until recently, so I wonder what changed?
    I would hazard a guess that there were updates to the package manager ,,, and the scripts got overwrote .
    If ya still have the install media on hand might be good to compare the config files .

    inquiring minds want to know
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •