2023-10-18 Upgrading from PureOS to Debian Bookworm

⚠ This page does something messy: It migrates from something like
Debian, with a rolling release, mixing in packages from testing,
different versions and what not to Debian stable. This is absolutely
not supported by anybody. I decided to give it a try after creating
a full backup of my system. The intent was to save myself the time
of fiddling with all the tools and configurations again. My system
is no just my home directory. As you'll see, not a lot of time was
saved and whole lot of sweat was spent. You'll find forum threads
saying that it was easy and went smoothly.
Be mindful of the Debian version they were moving to and read the
upgrade specific items of the release notes for the Debian version
you are moving to. Make informed decisions. 😬

easy and went smoothly

I have a Purism laptop. Its operating system is called PureOS and it's a Debian derivative. I've decided that I needed to upgrade from PureOS to Debian.

I like Debian. I want the same system on my laptop like I have on my server. The reason I am no longer happy with PureOS is that the curl update didn't arrive.

On the laptop:

curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1n zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3

Release-Date: 2019-02-06

On the server:

curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.11 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.52.0 librtmp/2.3 OpenLDAP/2.5.13

Release-Date: 2023-02-20

No security updates? No updates? I don't know. I don't understand.

I kept thinking, one day soon I will have to replace it with Debian. All I needed was a backup. And I guess now I'm ready!

backup

New "/etc/apt/sources.list":

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

deb http://deb.debian.org/debian bookworm main non-free contrib
deb https://deb.debian.org/debian-security bookworm-security main non-free contrib

And then:

apt update
apt upgrade

I hope I'm right! Getting 1244 packages…

One thing I'm noticing is that the old font directories are never deleted because there are hidden `.uuid` files in all of them.

Conflicts in `/etc/ImageMagick-6/policy.xml`: The only important thing I need to keep is the new max width and area to handle panorama pictures from the phone.

<policy domain="resource" name="width" value="32KP"/>
<policy domain="resource" name="area" value="128MB"/>

I saw a ton of "Possible missing firmware" messages but I rebooted anyway, and it worked. More on the missing firmware below.

The first boot system, whatever it is called, the one that asks you for the password to decrypt the disc, still looks like PureOS. The backgrounds and logos in the login manager, whatever it is called, also looks like PureOS. This is a low priority issue.

The Perlbrew setup for fish, my shell, prints a lot of errors about the use of `set`. I need to look into this, but I guess it is also a low priority issue unless I want to do Perl development right now – which I do not. A bit later, I don't know why, this stopped? Or something about login shells and other shells? Something to keep an eye on.

This here annoyed me, too:

Warning: Setting GRUB_TIMEOUT to a non-zero value when
GRUB_HIDDEN_TIMEOUT is set is no longer supported.

Where was it from?

I commented the setting in `/usr/share/grub/default` but that wasn’t enough. When I changed the setting in `/etc/default/grub` from 5 to 0, that worked. Running `update-grub` no longer prints the warning. As it turns out, however, there was a conflict for this file in the end and I installed the maintainer version, so I could have saved myself the time. 😅

But now, let's look at the missing firmware. This is what it said:

I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.19.0-24-amd64
I: /initrd.img.old is now a symlink to boot/initrd.img-4.19.0-24-amd64
I: /vmlinuz is now a symlink to boot/vmlinuz-6.1.0-13-amd64
I: /initrd.img is now a symlink to boot/initrd.img-6.1.0-13-amd64
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.1.0-13-amd64
W: Possible missing firmware /lib/firmware/i915/skl_huc_2.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_huc_2.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_huc_4.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/glk_huc_4.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_huc_4.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_huc_4.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/cml_huc_4.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/icl_huc_9.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/ehl_huc_9.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/ehl_huc_9.0.0.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.9.3.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.9.3.bin for module i915
W: Possible missing firmware /lib/firmware/i915/dg1_huc.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.9.3.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc_7.9.3.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_huc.bin for module i915
W: Possible missing firmware /lib/firmware/i915/skl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/glk_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/cml_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/icl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/ehl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/ehl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/dg1_guc_70.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_guc_69.0.3.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_guc_70.bin for module i915
W: Possible missing firmware /lib/firmware/i915/adlp_guc_69.0.3.bin for module i915
W: Possible missing firmware /lib/firmware/i915/adlp_guc_70.1.1.bin for module i915
W: Possible missing firmware /lib/firmware/i915/adlp_guc_70.bin for module i915
W: Possible missing firmware /lib/firmware/i915/dg2_guc_70.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_dmc_ver1_07.bin for module i915
W: Possible missing firmware /lib/firmware/i915/skl_dmc_ver1_27.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1_04.bin for module i915
W: Possible missing firmware /lib/firmware/i915/glk_dmc_ver1_04.bin for module i915
W: Possible missing firmware /lib/firmware/i915/icl_dmc_ver1_09.bin for module i915
W: Possible missing firmware /lib/firmware/i915/tgl_dmc_ver2_12.bin for module i915
W: Possible missing firmware /lib/firmware/i915/rkl_dmc_ver2_03.bin for module i915
W: Possible missing firmware /lib/firmware/i915/dg1_dmc_ver2_02.bin for module i915
W: Possible missing firmware /lib/firmware/i915/adls_dmc_ver2_01.bin for module i915
W: Possible missing firmware /lib/firmware/i915/adlp_dmc_ver2_16.bin for module i915
W: Possible missing firmware /lib/firmware/i915/dg2_dmc_ver2_07.bin for module i915

On the Debian wiki there's a section called Firmware after installation with instructions. Let's try this!

Firmware after installation

First, change `/etc/apt/sources.list` and add `non-free-firmware`.

deb https://deb.debian.org/debian bookworm main non-free non-free-firmware contrib
deb https://deb.debian.org/debian-security bookworm-security main non-free non-free-firmware contrib

Run `apt-update`.

...
Reading state information... Done
1826 packages can be upgraded. Run 'apt list --upgradable' to see them.

Uh, that is surprising. I guess the upgrade isn't done, yet!

Anyway, on with the script:

$ sudo apt-file search skl_guc_70.1.1.bin
firmware-misc-nonfree: /lib/firmware/i915/skl_guc_70.1.1.bin

OK!

$ sudo apt install firmware-misc-nonfree
...
update-initramfs: Generating /boot/initrd.img-6.1.0-13-amd64
...

That seems to have worked!

Time to upgrade another 1826 packages. They have all been "held back". Oh my.

$ sudo apt upgrade zip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 zip : Depends: libc6 (>= 2.34) but 2.28-10+deb10u2 is to be installed
E: Broken packages

This does not bode well.

The solution is the following, I thought. I guess I should have used "full-upgrade" instead of "dist-upgrade". But most of all, I should have kept a terminal window open where I'm logged in as root. I didn't, and the following lost me root access. It was bad.

$ sudo apt dist-upgrade

This is terrifying:

...
Setting up libc6:amd64 (2.36-9+deb12u3) ...
/usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
dpkg: error processing package libc6:amd64 (--configure):
 installed libc6:amd64 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 libc6:amd64
Error: Timeout was reached
needrestart is being skipped since dpkg has failed

Trying to figure out where this is from:

$ sudo apt-file search libcrypt.so.1
sudo: account validation failure, is your account locked?

This is going to be rough.

When I switch to the Linux console, I cannot login. I provide my username, "alex" or "root", and it returns after a second or two with "Login incorrect".

I can no longer use sudo.

$ sudo su
Sorry, try again.
Sorry, try again.
sudo: 3 incorrect password attempts
$ su root
su: Authentication failure

There is a comment involving libcrypt: 5.1.16. Unsupported upgrades from buster fail on libcrypt1.

5.1.16. Unsupported upgrades from buster fail on libcrypt1

The problem description is not the same, unfortunately.

Setting up libc6: (2.36-9) ...
/usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
dpkg: error processing package libc6: (--configure):
installed libc6: package post-installation script subprocess returned error exit status 127

The web page continues to say:

It is however possible to manually recover from this particular
situation by forcibly installing the new libcrypt1.

Sadly, I cannot move the library to to `/lib/` – because I cannot sudo.

# cd $(mktemp -d)
# apt download libcrypt1
# dpkg-deb -x libcrypt1_*.deb .
# cp -ra lib/* /lib/
# apt --fix-broken install

It seems like the only option I have right now is to nuke the system.

On an old Mac, I downloaded "debian-12.2.0-amd64-netinst.iso", plugged in a stick, unmounted it, and now I'm writing the image. Unmounting is necessary otherwise I'm getting a "Resource busy" error.

diskutil umount "NO NAME"
sudo dd if=Download/debian-12.2.0-amd64-netinst.iso \
  of=/dev/disk1 bs=1000000

When it's done, macOS tells you "The disk you inserted was not readable by this computer." This is fine, of couse.

So now I'm plugging that stick into the laptop and hope for the best.

And indeed, perhaps all is not lost! I booted from the USB stick, entered the rescue system, which allowed me to decrypt the disk, and start a shell on the new "/dev/crypt/root" partition (?) and finally to move the libcrypt1 files to the right place! When I rebooted the laptop, I was able to log in.

We'll see how it goes.

$ sudo apt --fix-broken install

This went well. Next step:

$ sudo apt full-upgrade

I should probably search for config files matching "pureos" and figure out what to do with them.

When it was done, I rebooted. There was a problem: no GUI! I used Ctrl Alt F3 to get a console, logged in and installed gdm3, the GNOME Display Manager.

$ sudo apt install gdm3

Now the fans are going crazy and I don't know why, so time to reboot once more. After uninstalling the unnecessary stuff, perhaps.

$ sudo apt auto-remove

Stuff I had to install, too:

$ sudo apt install nautilus evince msmtp mpop libreoffice

I get the feeling that my Firefox GUI (toolbars and all that) use a much larger font. I wonder how to undo that. Apparently this needs user chrome?

@-moz-document url(chrome://browser/content/browser.xul),
               url(chrome://browser/content/browser.xhtml) {
    * { font-size: 10pt }

    /*** Tighten up drop-down/context/popup menu spacing (8 Sep 2021) ***/

    menupopup:not(.in-menulist) > menuitem, 
    menupopup:not(.in-menulist) > menu {
      padding-block: 4px !important; /* reduce to 3px, 2px, 1px or 0px as needed */ 
      min-height: unset !important; /* v92.0 - for padding below 4px */
    }
    :root {
      --arrowpanel-menuitem-padding: 4px 8px !important;
    }
}

Enable it by going to `about:config` and set `toolkit.legacyUserProfileCustomizations.stylesheets` to `true`.

This fixes most stuff.

Microphone input on Firefox also wasn't working. For Audacity I was able to click that Audio setup button and pick ALSA, but there is no such option for Firefox. What I did was start up the "PulseAudio Volume" app, switch off the Microphone and make the Snowball (my external USB microphone that I always use) the default.

Screenshot

I'm not sure how to make it stick, however.

I do feel like the fan is way more active, now. I want my quiet laptop back. 😅 … It's tracker-extarct-3! Oh no. My nemesis.

My nemesis

$ sudo tracker3 daemon --list-processes
Found 0 PIDs…

Since that doesn’t work, and the stuff I had on Laptop Fan doesn’t work, I guess it’s time to think about finding a Nautilus alternative.

For the moment, I used `htop` and filtered for tracker, then killed them all.

On to removing left-over stuff, thanks to people on the Debian IRC channel. This here lists obsolete packages, which I then removed manually.

$ apt list ~o

I didn't want to delete them all! The `minecraft-launcher` stays.

And this one found one last package that wasn't "obsolete" somehow. The bot on the Debian IRC channel said, this would get me a list of installed packages that are not available from any repository in `sources.list`. Right on!

$ aptitude search '?narrow(?not(?archive("^[^n][^o].*$")),?version(CURRENT))'

Finding left-over config files:

$ locate pureos

​#Administration ​#Debian