I’ve been wrestling with an issue on my Ubuntu 18.04 machine and could really use some advice. So, here’s the deal: I have this running system that I need to keep stable for a project I’m working on, but I’ve noticed that unattended upgrades are updating my packages automatically when I least expect it. You know how it is—I’m in the middle of an important task, and suddenly I get those pesky notifications about updates, or worse, my system tries to restart after an upgrade. It’s super frustrating, and I need a reliable way to stop APT processes from running unattended.
I’ve dabbled with a few things like editing the `unattended-upgrades` configuration file and switching off the automatic updates. But honestly, things seem to be getting a bit overwhelming, and I don’t want to break anything in the process. It’s not just about the unattended upgrades either; I’ve had issues with other processes using APT, like when I’m trying to install software or clean up my system with `apt-get autoremove`, and the package manager is locked up because something else is running.
I read something about the `APT::Periodic::AutocleanInterval` setting, but I’m not 100% sure where to go next. Is there a command or perhaps a setting I can tweak so that I regain control over my updates?
Additionally, are there any recommendations for checking if something else is utilizing APT at that moment? I’d hate to restart the system or mess something up because I wasn’t sure what was running.
Has anyone dealt with this before? What’s worked for you? I’d really appreciate any insights or steps you could share to help keep my system from springing these surprise updates on me during critical work. Thanks!
Sounds like you’re having a pretty frustrating time with those automatic updates in Ubuntu! It’s like they know when you’re in the zone and decide to pop up with their notifications. Here’s a way to get a handle on it:
Disable Unattended Upgrades
You can disable unattended upgrades altogether. Open your terminal and run this command:
When prompted, just choose not to enable automatic updates. This should stop your system from grabbing updates without your say-so.
Edit Config File
If you’d rather keep some updates but want to limit them, you can edit the unattended-upgrades configuration file. Here’s how:
Look for these lines:
Change their values to “0” to disable them:
APT Lock Issues
For the locked APT issue when trying to install or remove packages, you can check if any APT processes are running using:
This will show you if there’s anything actively using APT. If you see a running process that you didn’t start, it might be the culprit.
Cleaning Up
As for the
APT::Periodic::AutocleanInterval
, that’s more about cleaning up old packages than about stopping updates. You can tweak it by editing:You can set it to a higher number or even to “0” to disable autocleaning.
Final Tip
Just to be on the safe side, it’s a good idea to backup your files before making big changes. Just to keep things stable while you play around with the settings!
Good luck, and hopefully, these steps help! Just take it slow, and you’ll find the balance between stability and updates.
To manage unattended upgrades on your Ubuntu 18.04 machine, you can start by disabling them completely to regain control over your package updates. Edit the `unattended-upgrades` configuration file located at `/etc/apt/apt.conf.d/20auto-upgrades`. You can achieve this by running the command:
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
.In this file, you should find the lines:
AAPT::Periodic::Enable: "1";
and
AAPT::Periodic::Update-Package-Lists: "1";
Change these values to
"0"
to disable automatic updates. Additionally, visit the `/etc/apt/apt.conf.d/50unattended-upgrades` file to fine-tune which packages are automatically updated by commenting out any relevant lines. This should greatly minimize unexpected updates.For issues related to APT being locked by other processes, you can check which process is using it by executing:
sudo lsof /var/lib/dpkg/lock
or
ps aux | grep apt
.This will show a list of processes that are currently using APT. If you wish to prevent any locking issues while performing maintenance tasks like
apt-get autoremove
, consider usingsudo dpkg --configure -a
to ensure any incomplete operations are finalized. If you determine that an unwanted process is using APT, you can either wait for it to finish or stop it cautiously using its PID withsudo kill
. Always ensure that you have backups and are aware of what processes you stop to avoid potential system instability.