PureOS to Debian, how do I get back to PureOS?

I added the following Debian packages:

deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

deb http://deb.debian.org/debian-security/ buster/updates main
deb-src http://deb.debian.org/debian-security/ buster/updates main

deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main

At some point after this, there were updates (via the “Software” app in the GUI), I installed the updates, and then after rebooting, I noticed some traces of Debian, like in the Settings -> “About” section, and also on the login screen.

How do I get back to PureOS?

3 Likes

i almost did ths today, but reconsidered when i saw in apt list --upgradable various -puros packages were going to be replaced with (slightly) newer debian ones

not sure how to go about restoring this, though, unfortunately—but there must be some command to “downgrade” the installed packages to what is in the repository, after removing the buster lines in apt sources

(another option might be to wait for the rolling release Librem is working on, would suppose that’d track buster more closely)

Thanks for replying, @vmedea!

I did some research on my own, and unfortunately (from what I found) there doesn’t seem to be an easy way to revert, it’s more-or-less a manual process (that can be scripted), it’s basically going through the logs, finding out which packages were updated, and then downgrading them.

That’s an interesting idea about waiting for the next PureOS update. :thinking:

I’m not sure what I’m going to do yet, nonetheless thanks for the reply! :smiley:

The answer is to use apt pinning. This can a) prevent newer Debian packages from overwriting pureos packages and b) if the priority setting is low enough it will even uninstall Debian packages for pureos packages even when that means downgrading versions.
Sorry commuting now and am only on a phone, so can’t provide links, but Google for apt pinning on the Debian documentation.

I would try pinning by origin, create /etc/apt/preferences with the following content:

Package: *
Pin: origin /repo.(pureos.net|puri.sm)/
Pin-priority: 1100

Then remove/comment out everythinng in /etc/apt/sources.list except for PureOS soruces, active content should looke like this:

deb https://repo.puri.sm/pureos amber main
deb https://repo.pureos.net/pureos/ amber-security main
deb https://repo.pureos.net/pureos/ amber-updates main

After that do apt-get update and apt-get dist-upgrade. Pin-priority >1000 will cause apt to downgrade packages to PureOS versions.

The above is untested, so do let us know how it went, should you try it.

Once done, remove /etc/apt/preferences.

3 Likes

Thanks for fleshing out my hint :smiley:. I fully agree, except that removing the non-purism sources should not be necessary in case you want to keep some nonpurism packages, e.g. Firefox. In this case pinning could help you to just install Firefox from Debian but ignore the rest of Debian.

Thanks for replying @spaetz and @Dwaff! :+1: :smiley:

I’ll give this a try tonight or this weekend.

If I understand correctly, I can “pin” the pureos packages (via /etc/apt/preferences, and keep this file around) and also keep the Debian sources (to install other software)? :thinking:

Yes, given the right priorities you can prefer pureos in general and keep specific debian packages.

I tried this last night, and as far as I can tell, it was successful! I restarted and had to re-sign the changes in /boot. Right away I noticed during the boot process it used to mention "Debian 10’, this was replaced with “PureOS”, and the “About” section is updated now too. So far I haven’t run into any issues.

Thank you very much @spaetz @Dwaff!!!

Unless I’m missing something, this seems like the best of both worlds. :thinking: :grey_question:

Also, should I update the priority of the pin I created? I’m not sure I understand all the different priority levels.

Decrease priority below 1000 but keep it above 500. This way, packages common in Debian and PureOS will automatically get PureOS version, unless you override from command line. If priority stays above 1000, overriding is not possible.

2 Likes

Thanks @Dwaff! I updated it to priority 900. :+1:

Also, thanks for the original snippet, that would have taken me a while to get right!