sfos-upgrade

Rating: 
4.957445
Your rating: None Average: 5 (47 votes)

Scripts for fail-safe and semi-automated upgrading of SailfishOS at the command line with logging

 
Upgrading SailfishOS at the GUI (via Settings→SailfishOS updates) provides very little information about its progress / process / success, beyond reading /var/log/systemupdate.log after an upgrade. This can make troubleshooting issues hard.
Furthermore the GUI offers no control which SailfishOS version to upgrade to.

In contrast to that, Jolla's guide how to upgrade SailfishOS at the command line offers full control, while lacking any logs or safety checks.
Furthermore it is tedious and error prone to issue multiple, critical commands manually at the command line.

sfos-upgrade performs the steps to upgrade SailfishOS at the command line in an semi-automated manner, while providing extensive safety measures plus full log output at the screen and in a log file.

 
Safety measures:

  • Check free space on the root filesystem.
  • Check BTRFS allocation, if the root filesystem uses BTRFS.
  • Check battery state (since v1.0).
  • Check if upgrading to a correct and available SailfishOS version.
  • Check if omitting (i.e. "jumping over") a stop release (since v0.3).
  • Automatically unapply all Patches, if Patchmanager 2 is installed.
  • Stop systemd services for cron, btrfs-balance-checker etc. (since v2.2).
  • Terminate running processes, which may disturb upgrading SailfishOS (since v2.7).
  • Disable all OpenRepos' repositories, when upgrading from a SailfishOS version below 1.0.4 (since v0.4).
  • Emit a warning when downgrading.
  • Prevent downgrades, which would likely break the SailfishOS installation (since v3).

 
Usage (as root user):

  • sfos-upgrade [<version>]
    With a version number provided as parameter, it sets SSU to this version and in release mode before upgrading to this SailfishOS version. This is the regular use case.
    Without a version number, it retrieves the one set for SSU to perform slightly relaxed checks, but does not alter SSU's settings for upgrading.  Hence the version to upgrade to and SSU's "release mode" have to be set (by e.g. ssu re <version>) before executing sfos-upgrade without a parameter.
  • sfos-upgrade --verify
    Performs a "samegrade" operation, i.e. checks if the recent versions of all available RPMs are installed and updates or installs them accordingly.
    This option was introduced with v3.7.0.
  • sfos-upgrade -?|--help
    Emits a brief usage description.

When an upgrade succeeded, reboot, and do not miss to run post_sfos-upgrade (as root) then!
Not running it will result in an huge upgrade log file (containing many duplicate entries), plus may result (as any SailfishOS upgrade at the command line without tidying efforts afterwards) in RPMs failing to install (with "unmet dependency" / "Fatal error: nothing provides X needed by Y" errors) and annoying notifications from the store-client that an upgrade to the installed version is available.

Logs are originally written to /var/log/systemupdate_*.log-dupes.txt and tidied by tidy_log-dupes (which is called by post_sfos-upgrade) to /var/log/systemupdate_*.log.txt.

 
Notes:

  • All operations comprise the RPMs from all enabled repositories, because that is version --dup's implicit behaviour (as with pkcon upgrade-system and zypper dist-upgrade / zypper dup too, all utilising libzypp).
  • When upgrading from a long outdated SailfishOS version (e.g. after a "factory reset"), sfos-upgrade eases and speeds up the process of upgrading to a recent SailfishOS release via consecutively installing all "stop releases" on the way.
    Simply run sfos-upgrade <intended version>, reboot, and repeat: it will guide you through all stop releases.
    When upgrading to SailfishOS releases < 4.1.0, you may omit running `post_sfos-upgrade` between consecutive SailfishOS upgrades (but do reboot each time!).  But you shall run it after having upgraded to any SailfishOS release ≥ 4.1.0 or the ultimately intended version.
  • To ensure that a SailfishOS installation is complete and up to date, use sfos-upgrade --verify; this will "samegrade" to the installed version, which is as close as one can get to the version --verify lost since SailfishOS 2.2.1 (which only checked for missing or not up-to-date RPMs, while "samegrading" will also install them) without zypper. With it (per pkcon install zypper), a zypper refresh && zypper verify --dry-run comes closer to what version --verify did (only checking). While zypper can also be used for up-/down-/same-grading, that is rather a "last resort"-measure than the primary recommendation, hence use sfos-upgrade for that.
  • sfos-upgrade supports all public SailfishOS releases and should work fine for upgrading from / to any release (it accepts only version numbers of at least 1.0.0.0 at the command line, but omits this check when called without a parameter after utilising ssu to pre-set a version to upgrade to).
  • sfos-upgrade is simply a frontend for ssu re and version --dup, performing a multitude of checks before initiating the upgrade proper, while post_sfos-upgrade carries out the "Final clean up" steps from Jolla's guide and an also necessary pkcon refresh, which some seem to omit when upgrading manually at the command line (often running into aforementioned issues later, then).
  • sfos-upgrade's source files are hosted at Github.
  • For discussing its specific scripts and RPM packaging, please use its issue tracker at Github.
  • Issues with this RPM package or the shell scripts it installs shall also be filed at sfos-upgrade's issue tracker at Github.

 
License:
LGPL-2.1-only

Application versions: 
AttachmentSizeDate
File sfos-upgrade-3.9.22-release14.noarch.rpm30.59 KB21/03/2023 - 17:28
File sfos-upgrade-3.10.1-release2.noarch.rpm30.87 KB21/03/2023 - 17:28
File sfos-upgrade-3.11.2-release2.noarch.rpm21.42 KB27/09/2023 - 04:30
File sfos-upgrade-3.11.3-release3.noarch.rpm21.8 KB08/03/2024 - 02:03
File sfos-upgrade-3.11.4-release4.noarch.rpm21.82 KB21/09/2024 - 04:20

Comments

scanner's picture

version
SailfishOS 2.1.4.14 (Lapuanjoki)

ssu re
WARNING: ssu.ini does not seem to be writable. Setting values might not work.
Device release is currently: 2.1.4.14

ssu s
WARNING: ssu.ini does not seem to be writable. Setting values might not work.
Device registration status: not registered
Device model: Intex Aqua Fish (l500d / Aqua Fish)
Device UID: ***
Release: 2.1.4.14
Domain: sales

olf's picture

Thank you!

So sfos-upgrade should already work fine on Intex Aqua Fishs.

P.S.:
Reading related articles about the status of support for the Aqua Fish at TJC [1], [2], [3], [4], the last well running SailfishOS release for original Aqua Fishs (i.e., not converted to Jolla C) is 2.2.1.18
One may be able to upgrade to SFOS 3.0.0, but not any further without breaking things, and 3.0.0 brought many changes, among them a couple of flaws (most being fixed in later releases).
BTW, this may also be of interest.

olf's picture

BTW, sfos-upgrade is in "maintenance mode" since version 3.6, as it appears to be working well for its users. That means there will be no new releases, unless bugs are reported (preferably at Github) or a new SailfishOS release breaks it.

P.S.: Still it would be helpful if owners of an Inoi T8, Jala Accione or Jala Accione P contribute the output of version, ssu re and ssu s on their devices to issue 32.

olf's picture

If you own a device sold by Inoi (e.g. R7 or T8), Jala (Accione or Accione P) or Intex (Aquafish, not reflashed as Jolla C), please consider contributing information to issue 32, at least the output of version, ssu re and ssu s.
Thanks!

olf's picture

Meanwhile @ItsHardToTakeUsername was so kind to provide this information for an Inoi R7, still it would be very helpful if owners of an Inoi T8, Jala (Accione or Accione P) or Intex (Aquafish, not reflashed as Jolla C) contribute the output of version, ssu re and ssu s on their devices to issue 32 (or here).
Thanks!

anasyntes's picture

Thank you! Much appreciated.

dalas_revo's picture

Thanks for the scripts, I use them on my XA2. Unfortunately upgrading from 3.0.2.8 to 3.0.3.10 on the Aigo (Jolla Tablet) fails for me with sfos-upgrade, complaining about a missing /sys/class/power_supply/battery/uevent.

olf's picture

@dalas_revo, please let us analyse this at Github's issue tracker: I opened an issue there with questions for you and "might introduce an override for this after some more analysis".

olf's picture

A proper solution for this (now also extracting the battery information on Aigo tablets and other devices with unusual battery paths) was implemented in the v3.1 pre-release.
One may download it from Github and manually install it (or per Storeman -> Local RPM files).
Feedback at Github for this or other functionality is appreciated, as always.

oxygenh's picture

I have same issue, that SrDweeb. Sfos-upgrade report abour DOWNGRADE when i try to 3.0.3.10 from 3.0.3.9

olf's picture

Can confirm that sfos-upgrade incorrectly warns about downgrading, when upgrading from SailfishOS 3.0.3.x to 3.0.3.10.
This is solely an usability issue, simply answer with y or Y when asked if you really want to perform the "downgrade", then sfos-upgrade will upgrade SailfishOS as usual.
This will be rectified in the 3.0 release.

oxygenh's picture

Thank you very much.

olf's picture

See issue #24 for details and a fix.

DrDweeb's picture

Upgrade from 3.0.3.9 to 3.0.3.10 sends a downgrade warning, suggesting you have a problem dealing with 2 digit point upgrades - an embarrassing oversight

DrDweeb's picture

Thanks, sadly I must manually install every time so this is fabulous!

Maximilian1st's picture

Just wanted to say thanks for the scripts, for some reason the only way for me to update an Xperia X 5122.

seiichiro0185's picture

Thanks for this nice script, upgrade on XA2 Plus from 3.0.1.14 to 3.0.2.8 worked without problem.

dyraig's picture

Great little helper - thank you very much!

olf's picture

You are welcome.

Actually (as usual with Free Software), I did not create sfos-upgrade out of altruism, but because I wanted a safe upgrade method at the command line:
I used to upgrade SailfishOS at the GUI for years, because of the (undocumented) checks it seems to perform and because it is the "officially" supported method, but I was always annoyed how slow it is (it uses only a fraction of the available bandwidth, when downloading). Furthermore upgrading at the command line per ssu re && version --dup is documented to be a fallback method only to be used, when upgrading at the GUI fails and it obviously takes a lot of care to remember and check all preconditions, plus carrying out the "Final clean up" steps and a pkcon refresh afterwards.
But as upgrading to SailfishOS 2.2.1 and later to 3.0.0 at the GUI failed for me, I tried the command line method and realised how much faster it is. Hence I wrote two little shell scripts automating this process, one performing the upgrade proper, the other one the post upgrade actions after rebooting.
Being afraid to forget to check the prerequisites (battery charge, free space on root filesystem etc.) when using these two scripts in the future, I started to add these checks in December 2018. Well, as one is a always a mediocre tester for ones own programming, I decided to invest more time to add more checks, make the scripts more fail-safe and release them on Openrepos in January. Apparently that worked well, as I have only received one minor complaint per PM, yet.

Happy upgrading,
olf

objectifnul's picture

Tested (and approved) on my good old Jolla phone, which is my test machine. Still not convinced by Sfos 3.0.1.11 UX, so my XperiaX still sports 2.2.0.29 «Mouhijoki».

Vieno's picture

Haha, same here. My Xperia Xc stays with 2.2.0.29 till there is enough reason(e.g. patches) to change and my Jolla One provides me a sneak preview of things to come.

olf's picture

So am I, but IMO this / there is no reason not to upgrade to SFOS 2.2.1.

objectifnul's picture

Some of my favourite patches are not compliant with SFOS > Mouhijoki 2.2.0.29. So I stick to it for now.

Historyscholar's picture

GOOD Thanks!

t0t3u's picture

Niiice! Can't wait for next release to test it.
Thank you!

Pages