ublue-os / config

A layer to provide configuration files (udev rules, service units, etc)
https://universal-blue.org
Apache License 2.0
45 stars 28 forks source link

Problem: `ujust toggle-updates` doesn't change `AutomaticUpdatePolicy` #286

Open Malix-Labs opened 4 months ago

Malix-Labs commented 4 months ago

My updates are still being made automatically even after having it disabled since yesterday

image

image

Malix-Labs commented 4 months ago

This is starting to strongly get into my workflow, is there a way to break the automatic download script in some other ways?

lorduskordus commented 3 months ago

Let me try to help.

By looking at your first screenshot, it seems you have classic Silverblue automatic updates configured. The second line of rpm-ostree status will show something like AutomaticUpdates: stage; rpm-ostreed-automatic.timer: last run 4min 22s ago

You might need to set AutomaticUpdatePolicy to none:

[Daemon] AutomaticUpdatePolicy=none

IdleExitTimeout=60

- Do `cat /etc/rpm-ostreed.conf`, is the output different ? Does it at least contain the line `AutomaticUpdatePolicy=stage` ?

- If yes then you have two options:
  1. you can just do `sudo cp -f /usr/etc/rpm-ostreed.conf /etc/rpm-ostreed.conf` and overwrite it, that should get you the 'default' config
  2. or do `sudo nano /etc/rpm-ostreed.conf` and change `AutomaticUpdatePolicy=stage` to `AutomaticUpdatePolicy=none` manually.

- Once that is done, do:

systemctl reload rpm-ostreed systemctl disable rpm-ostreed-automatic.timer --now


- Now if everything worked, the output of `rpm-ostree status` should no longer show something like `AutomaticUpdates: stage; rpm-ostreed-automatic.timer: last run 4min 22s ago` and classic auto updates are therefore turned off.

Looking at the ujust script, disable does all of this, so you might also try running these too just to be sure:

sudo systemctl disable ublue-update.timer sudo systemctl disable --now flatpak-system-update.timer sudo systemctl disable --now rpm-ostreed-automatic.timer systemctl disable --now --user flatpak-user-update.timer

Malix-Labs commented 3 months ago

Log

malix@malix-pc ~> ujust --show toggle-updates
# Turn automatic updates on or off
toggle-updates ACTION="prompt":
    #!/usr/bin/bash
    source /usr/lib/ujust/ujust.sh
    CURRENT_STATE="Disabled"
    if systemctl is-enabled ublue-update.timer | grep -q enabled; then
      CURRENT_STATE="Enabled"
    fi
    OPTION={{ ACTION }}
    if [ "$OPTION" == "prompt" ]; then
      echo "Automatic updates are currently: ${bold}${CURRENT_STATE}${normal}"
      echo "Enable or Disable automatic updates?"
      OPTION=$(ugum choose Enable Disable)
    elif [ "$OPTION" == "help" ]; then
      echo "Usage: ujust toggle-updates <option>"
      echo "  <option>: Specify the quick option - 'enable' or 'disable'"
      echo "  Use 'enable' to Enable automatic updates."
      echo "  Use 'disable' to Disable automatic updates."
      exit 0
    fi
    if [ "${OPTION,,}" == "enable" ]; then
      sudo systemctl enable ublue-update.timer
    elif [ "${OPTION,,}" == "disable" ]; then
      sudo systemctl disable ublue-update.timer
    fi
lorduskordus commented 3 months ago

Okay.. I have my own image based on uBlue main and thought you and I would have the exact same ujust script. I have the version from this repository, while Bluefin has its own for some reason. I also have AutomaticUpdatePolicy set to none (by default) and still get auto-updates, so in my case, ublue-update itself is responsible for system updates.

Bluefin's version only enables/disables the ublue-update.timer (which starts the ublue-update.service).

Since your output of /usr/etc/rpm-ostreed.conf has AutomaticUpdatePolicy set to stage, I assume Bluefin's config uses the classic rpm-ostreed-automatic updates but don't see how disabling/enabling the ublue-update.timer would also toggle that. Unless it's enough to have rpm-ostreed-automatic.timer disabled and its state depends on the ublue-update.timer state.

I think you should create the issue in Bluefin's repository.


I probably won't be able to help you further, but your system updates should be turned off.

In the meantime:

Classic rpm-ostreed-automatic updates

Difference between /usr/etc/ and /etc/

Malix-Labs commented 3 months ago
lorduskordus commented 3 months ago

Now that I looked at Bluefin's topgrade config, I think Bluefin's ublue-update does handle rpm-ostree itself and the only issue here is that the classic rpm-ostree updates are enabled, when they shouldn't be.

It's happening because the main image (that Bluefin is based on) pulls ublue-os/config, which contains the ublue-os-update-services package and main's post-install.sh script configures and enables it. This was used back when ublue-update didn't exist. The custom image module I'm using, that installs ublue-update removes this package.

Try running this to see if ublue-os-update-services package is installed:

rpm -q ublue-os-update-services

As for whether ublue-update handles rpm-ostree, if you can, try running this (with auto-updates disabled & when you know a new image exists, new images are built daily at about 16:40 UTC)

systemctl start ublue-update.service

If I'm correct, it will update your system using rpm-ostree. You should see a new entry in rpm-ostree status.

Bluefin's / Aurora's maintainers would either have to override remove the ublue-os-update-services package as well or remove it from main / config entirely.


However, it seems that my ujust toggle-updates script was in fact broken from the start, since now I can't enable the updates back

The line: AutomaticUpdates: stage; rpm-ostreed-automatic.timer: last run 4min 22s ago is only related to the classic rpm-ostree auto updates. If you run ujust toggle-updates again, the CURRENT_STATE informs you whether the ublue-update.timer is enabled. If it is, auto-updates are on.

Lastly, to be clear, if I am correct, then 'undoing the package' by disabling the classic rpm-ostree updates (AutomaticUpdatePolicy=none and disabling the service) + disabling the services handling Flatpak (All of them are listed at the end of my first comment) is everything you need to do and you can use the ujust toggle-updates script.

Malix-Labs commented 3 months ago
Malix-Labs commented 3 months ago

After the recent 3.0.0 update, I wanted to toggle the automatic updates again, Do you know how I could make it?

lorduskordus commented 3 months ago

After the recent 3.0.0 update, I wanted to toggle the automatic updates again, Do you know how I could make it?

This for system updates (AutomaticUpdatePolicy=stage): https://docs.fedoraproject.org/en-US/iot/applying-updates-UG/#_automatic_updates

Everything else: ujust toggle-updates

Edit: This is wrong, ujust toggle-updates toggles ublue-update, which handles everything including system updates. The problem is that there is another tool in place that's also updating the system.

Malix-Labs commented 3 months ago

Thanks for the AutomaticUpdatePolicy workaround

It would be nice if it could be added to ujust toggle-updates

lorduskordus commented 3 months ago

I installed Bluefin in a VM yesterday to not pollute this issue with assumptions anymore.

Disabled classic automatic updates provided by Fedora

That means ublue-update does handle rpm-ostree, so I guess I was right saying the classic automatic updates provided by Fedora should not be enabled. (Two tools handling system updates, disabling ublue-update doesnt stop the other tool, so system updates are still handled, hence why this issue was created.)

ujust toggle-updates works just fine, all that's needed to do is not ship classic automatic updates by Fedora on by default. It is likely an oversight.


Before ublue-update is triggered: 1

ublue-update is running: 2

ublue-update finished: 3


@Malix-off Turn off the classic auto updates by Fedora

In /etc/rpm-ostreed.conf set AutomaticUpdatePolicy=none

and do:

systemctl reload rpm-ostreed
systemctl disable rpm-ostreed-automatic.timer --now 

Use ujust toggle-updates normally, as ublue-update handles everything.