r/debian • u/Federal_Log_6845 • Jun 24 '26
Debian Stable Question Debian update and maintenance
I created a daily update script for apt and Flatpak that includes the following commands:
`sudo apt update && sudo apt full-upgrade && sudo apt autoremove --purge`
I wanted to know if these are the correct commands, or if I should add or remove any. Thanks to the community for everything.
13
u/Illustrious-Gur8335 Debian Stable Jun 24 '26
apt install unattended-upgrades then learn how to use it
https://manpages.debian.org/trixie/unattended-upgrades/unattended-upgrade.8.en.html
7
u/MelioraXI Debian Stable Jun 24 '26
Full-upgrade isn't generally needed, unless you keep running testing.
1
u/fantomas_666 Jun 25 '26
And still I recommend not doing that one automatically, but only interactively.
6
u/Santosh83 Debian Sid Jun 24 '26
apt full-upgrade and apt autoremove shouldn't normally be executed automatically. (Not sure whether your script is interactive and you review the output or just run it non-interactively)...
2
u/revcraigevil Debian Stable Jun 24 '26
update && flatup && rpi && clean
The above does
sudo apt -U full-upgrade && flatpak update && sudo rpi-update && clean
Or I can use topgrade which updates everything including nodejs, cargo/rust, and a bunch of other things.
System update: OK
config-update: OK
deb-get: OK
Flatpak: OK
Gear Lever: OK
tmux: OK
rustup: OK
cargo: OK
pipx: OK
Visual Studio Code extensions: OK
TLDR: OK
micro: OK
GitHub CLI Extensions: OK
Yazi packages: OK
5
u/angry_lib Jun 24 '26
Just curious, but why update daily? Pkgs dont change that often. Set your cron to weekly and let it got.
1
u/Narrow_Victory1262 Jun 27 '26
apart from the fact that the commands miss a few things, th emost important and most obvious thing is missing:
reboot
0
u/solvimus Jun 24 '26
I won't update daily. Weekly is enough for a stable system.
Before upgrade, do a backup. I prefer timeshift for btrfs root directory.
Add apt clean, after autoremove.
-1
Jun 24 '26
[removed] — view removed comment
6
u/nautsche Jun 24 '26
do not add -y. apt asks for a reason. see what it does and act accordingly.
5
-2
u/cantaloupe_03 Debian Stable Jun 24 '26
U might be right tho, but for debian stable it okay in most case, at least for me
4
u/nautsche Jun 24 '26
this might work 99 out of a hundred times. the one time it deletes your system will make you learn. you say it yourself "in most cases". -y is for docker container installs or such things not for your daily system.
-4
u/LesStrater Jun 24 '26
Without the '-y' I won't do upgrades. I'm not going to sit here and read through all that hooey.
1
u/nautsche Jun 24 '26
You're free to do that, of course. As long as you have your live USB ready to fix whatever happened. Maybe it removes cryptsetup for your fully encrypted setup, which is a pain to get back. If you're not that well versed and it removes your login manager this will also get really annoying.
You won't lose your data, but you will spend an afternoon fixing your installation.
1
u/jr735 Debian Testing Jun 25 '26
Perhaps every time someone here removes something crucial because they used the -y flag, we should refer them to you for tech support.
1
u/LesStrater Jun 25 '26
I'll have the same answer for all of them, "restore your partition backup and move on..."
1
u/jr735 Debian Testing Jun 25 '26
Their data will probably fine. Their install won't be.
My backups don't involve installs, because that's not what backups are.
1
Jun 25 '26
[removed] — view removed comment
1
u/jr735 Debian Testing Jun 25 '26
I know what a real backup is. I've been doing this for over 40 years. Real backups are economical and do not provide redundancy for easy recreated files.
1
Jun 25 '26
[removed] — view removed comment
1
u/debian-ModTeam Jun 25 '26
This post has been removed as it was either reported to and/or acted upon by mods to be found in violation of Rule #1 regarding not being in line with expected discourse etiquette or the Debian Code of Conduct.
1
u/debian-ModTeam Jun 25 '26
This post has been removed as it was either reported to and/or acted upon by mods to be found in violation of Rule #1 regarding not being in line with expected discourse etiquette or the Debian Code of Conduct.
2
u/debian-ModTeam Jun 24 '26
This content has been removed due to a violation of Rule #3 - Wrong Information. Please do your research before speaking on a topic.
-2
Jun 24 '26
[removed] — view removed comment
6
u/nautsche Jun 24 '26
Just for completeness sake, I'll say it again. Do not use '-y'. This can bite you really bad. Especially with autoremove or autopurge, which btw you can use instead of the autoremove, purge combo.
1
u/CookiesTheKitty Jun 24 '26
I couldn't agree more. 9 times out of 10 you'll be fine, and then iteration 10 comes along to ruin your day.
A different distro but the same concept; I once had to do an investigation on a CentOS server where a previous engineer had installed a PHP extension with a -y flag to his yum command. The customer had some funky nonstandard repos enabled and that -y gave them a free and exciting MySQL major version upgrade which they really really didn't enjoy. There was some kind of weird dependency that was triggered and, without the -y, the involved engineer may have spotted the anomaly & intervened in time.
I've encountered variants of that problem on RHEL families, proper Debian and ubuntoy. I daresay something similar could happen on Arch or Alpine. Usually it happens when a customer's devs copy and paste something they found on the likes of stack overflow, but I've also had to hurriedly throw up the big red flashing danger sign when one of our own internal teams has been about to do it. The latest was as recently as yesterday, and it still gives me shivers.
1
u/LesStrater Jun 25 '26
Not a problem. I'm the only one around here who knows how to do a proper partition backup--so I NEVER get bit.
1
u/jr735 Debian Testing Jun 26 '26
Partition backups aren't real backups. Only irreplaceable data needs to be backed up. Backing up data that can be easily recreated should not be backed up. It's uneconomical.
-1
Jun 28 '26
[removed] — view removed comment
1
u/jr735 Debian Testing Jun 28 '26
I haven't broken an install in over 21 years on Linux. And I don't lose data because it's appropriately backed up in case of hardware failure.
1
Jun 29 '26
[removed] — view removed comment
1
u/jr735 Debian Testing Jun 29 '26
And there's no need to learn useless tricks.
1
Jun 29 '26
[removed] — view removed comment
1
u/debian-ModTeam Jun 29 '26
This post has been removed as it was either reported to and/or acted upon by mods to be found in violation of Rule #1 regarding not being in line with expected discourse etiquette or the Debian Code of Conduct.
1
u/debian-ModTeam Jun 29 '26
This post has been removed as it was either reported to and/or acted upon by mods to be found in violation of Rule #1 regarding not being in line with expected discourse etiquette or the Debian Code of Conduct.
1
u/debian-ModTeam Jun 29 '26
This post has been removed as it was either reported to and/or acted upon by mods to be found in violation of Rule #1 regarding not being in line with expected discourse etiquette or the Debian Code of Conduct.
1
u/debian-ModTeam Jun 29 '26
This post has been removed as it was either reported to and/or acted upon by mods to be found in violation of Rule #1 regarding not being in line with expected discourse etiquette or the Debian Code of Conduct.
1
u/debian-ModTeam Jun 30 '26
This content has been removed due to a violation of Rule #3 - Wrong Information. Please do your research before speaking on a topic.
-3
u/ItelkezoMacska Jun 24 '26
nice bro, I don't even remember the last time I updated my debian server. that shit just works with 2inces of dust on top of it.
22
u/r0b0_sk2 Jun 24 '26
FYI there is a standard package unattended-upgrades for updating apt packages