Random question: How often do you update your packages?

I check every day but update if one of three options is met:

A new browser version, a new kernel version or if the updates reach > 300 Mb.

1 Like

I’ve just tried to apply your mogrified version of the code to my alias (function), and I got to look at it in more detail so I noticed it only checks for the first element in the array $reboot (which is “ucode”), and never any other. I might be misunderstanding something, but this code, as it is written, does not work properly, it will print “Needs reboot” only when there is an update to “ucode”.

Also, even if it checked for all the elements in the array, it would not work for “linux-lts”, for example, since in that one, “linux” does not end with a space or end of the word.

This version, however, works fine:

#!/bin/bash
UPDATES=$(checkupdates; yay -Qua)
[[ "$UPDATES" == "" ]] || echo "$UPDATES"  # no need to print a blank line if no updates
REBOOT=(ucode cryptsetup linux nvidia mesa systemd wayland xf86-video xorg)
for i in ${REBOOT[@]}; do
  if [[ $UPDATES =~ $i ]]; then
    echo "Needs reboot"
    exit 0; # no need to print the message multiple times
  fi
done

EDIT: I’ve now removed

alias cu="checkupdates; yay -Qua"

from my .zshrc and replaced it with this function:

Details
cu() { # check for updates, requires "pacman-contrib" and "yay"
  local UPDATES=$(checkupdates; yay -Qua)
  [[ "$UPDATES" == "" ]] && return 2 || echo "$UPDATES" 
  
  # assume packages containing these strings in name need reboot after updating
  local REBOOT="(ucode|cryptsetup|linux|nvidia|mesa|systemd|wayland|xf86-video|xorg|plasma|sddm)"

  if [[ $UPDATES =~ $REBOOT ]]; then
    echo -n "\nWarning: reboot after updating, just in case.\n"
    return 1
  fi
  return 0
}

EDIT: improved the function by implementing suggestions by @linux-aarhus

4 Likes

You maybe right. I didn’t know these threads that you quoted before either. Is the forum engine smart enough to add links to topics with similar titles to the topic’s starting post?

The forum engine does not do this on it’s own. If you manually put a link to another topic in a post, then both topics will be linked to each other.

Pudge

Really, now I checked on one of the threads I created, it’s a very good feature, thank you. :+1:

1 Like

I can see I bugged with the regex - it should have been

reboot="(ucode|cryptsetup|linux|nvidia|mesa|systemd|wayland|xf86-video|xorg)"

Then this check

[[ $updates =~ "$reboot" ]]

I tested with https://regex101.com/r/A5wv9k/1 - and I can’t see why bash won’t parse it.


Edit got it … never quote the regex :man_facepalming:

#!/usr/bin/env bash
reboot="(ucode|cryptsetup|linux|nvidia|mesa|systemd|wayland|xf86-video|xorg)"
updates=$(checkupdates)
echo "$updates"
if [[ $updates =~ $reboot ]]; then
    echo "Needs reboot .."
fi

Your function

cu() { # check for updates, needs "pacman-contrib" and "yay"
  local UPDATES=$(checkupdates; yay -Qua)
  [[ "$UPDATES" == "" ]] && return 2 || echo "$UPDATES" 
  # assume packages containing these strings in name need reboot after updating
  local REBOOT="(ucode|cryptsetup|linux|nvidia|mesa|systemd|wayland|xf86-video|xorg)"
  if [[ $UPDATES =~ $REBOOT ]]; then
    echo -n "\nWarning: reboot after updating, just in case.\n"
    return 1
  fi
  return 0
}

2020-08-25T06:50:00Z EDIT: Refactored to work if yay is not installed

#!/usr/bin/env bash
reboot="(ucode|cryptsetup|linux|nvidia|mesa|systemd|wayland|xf86-video|xorg)"
if [[ $(which yay) =~ (yay) ]]; then
    updates=$(checkupdates; yay -Qua)
else
    updates=$(checkupdates)
fi
echo "$updates"
if [[ $updates =~ $reboot ]]; then
    echo "Updating possibly requires system restart ..."
fi

Cross posted to Manjaro Forum

1 Like

The longest I usually go is probably a couple days unless there’s a package with known issues. Much easier to troubleshoot if something goes wrong if there’s only a few packages updated.

1 Like

That’s a good way to think of it, I suspect. The alternative is what I ran into last night on Rolling Rhino (Xubuntu rolling distibution) - I walked into 325 packages! Definitely took more time to see what and why than I wished to spend… Fortunately - no troubles this time - and I won’t leave it 4 days again!

Pacman usually work well though, even with the 100+ updates I occasionally get (gambas tends to throw 80 or so by itself when it updates).

1 Like

It’s Rolling so i constantly check. First thing i do when i start the computer.

2 Likes

Roughly every 10 days or so, after getting burnt out with doing updates (pre-eOS). Run a light system, with no notifs and just tkpacman + terminal check for AUR updates. Much better and get more done, plus I like to balance in stability as much as possible, but do back up a main folder containing a few config backups etc probably once a day, which I’m working on sorting better, as little backups here and there add up.

as soon as they are released and I get the notification. Whats the point of running a cutting edge rolling release If not updating right away?

1 Like

Sometimes there can be significant breakages e.g. kernel/grub recently, and you see reports of this over the first 24-48 hours, but if you’re okay with fixing everything, go for it! :+1:t2:

(included quote, but hasn’t come through in post)

3 Likes

A VERY good idea is to do three things regarding this of course:

  1. Implement timeshift or another backup tool to take snapshots. I have my computer take a snapshot every boot (it is only disruptive the very first time you take a snapshot).
  2. Subscribe via an RSS reader to the Arch Linux news page.
  3. Check these forums for news regarding updates.
4 Likes

If you wanna use timeshift , installing EOS with Btrfs is a good idea . Automatic snapshots won’t bother you . They will be created in a sec

2 Likes

I stick with ext4; I was messing around with Btrfs on suse (for obvious reasons) and I find timeshift is just easier to deal with (IMHO, of course). I mean you just schedule it and it runs in the background.
I am going overkill but I have snapshots for the three latest boots, 1 daily and 1 weekly snapshot. Since it only takes incremental backups it’s not really causing any space issues.

Definitely; already doing those 2. Will need to check out Timeshift properly. :+1:t2:

1 Like

There is also a downside to updating packages less often. This is exactly the case on one of my machines, the Opera Developer browser cannot be installed from the AUR because it is not up to date and there is already a newer version on the Opera website. On the other machine I use and update daily, this is not a problem.

Yes, not updating means not updating anything. You definitely, don’t want to install or update anything unless you first do a full update from the repos.

Doing something like only updating one application is a recipe for disaster unless you really know what you are doing.

3 Likes

By that, I just meant that both of the daily-level and less frequent update strategies have their pros and cons. Between the two is the golden mean, which is not easy to find. Anyway, I switched to using rolling release distributions to get fresher packages than in conservative distributions.

I do check for and install updates every Sunday AM. I sit down, sip my coffee, and do the updates, and do my daily check for my emails. Later I will switch to youtube and look at my daily subscriptions.

4 Likes