Failed upgrade on WSL

I ran a sudo apt update && sudo apt upgrade and rebooted WSL. After that I saw this error from flox list

ERROR: environment 'fleimgruber/x86_64-linux.default' not found for system 'x86_64-linux'

I then tried sudo apt --only-upgrade install flox to be sure of the latest version and got this output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
flox is already the newest version (0.1.0-r372-0.0.10-r190).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up flox (0.1.0-r372-0.0.10-r190) ...
tar: This does not look like a tar archive
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
dpkg: error processing package flox (--configure):
 installed flox package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 flox
E: Sub-process /usr/bin/dpkg returned an error code (1)

and the error after flox list remains.

Hi @fleimgruber!
So sorry you ran into this. Would you please send me (here or offline to my email) the details of your temp flox installation log file in /tmp? It should be of the format /tmp/flox-installation.log or /tmp/flox-installation.log.[some long number].

Hi @fleimgruber - we have found the issue: the upgrade automation is tripping over interactions with systemd. This was previously addressed with an installation but not with an update. I will log this internally to get it sorted.

In the meantime, here is a workaround:
→ we need to trick the post-installer into succeeding regardless…

Procedure:

$ sudo mv /var/lib/dpkg/info/flox.postinst /var/lib/dpkg/info/flox.postinst.real
$ sudo ln -s `which true` /var/lib/dpkg/info/flox.postinst
$ sudo dpkg --debug=13 --configure flox
D000001: ensure_diversions: new, (re)loading
D000001: process queue pkg flox:amd64 queue.len 0 progress 1, try 1
Setting up flox (0.1.0-r372-0.0.10-r190) ...
D000002: fork/exec /var/lib/dpkg/info/flox.postinst ( configure 0.0.8-r123 )
D000001: ensure_diversions: same, skipping
$ flox --version
Version: 0.1.0-r372-0.0.10-r190

Please let me know how you get on!

Thanks for the fast fix! I now see this error (should I open a new issue?):

$ flox pull
Everything up-to-date
warning: error: unable to download 'https://cache.nixos.org/nix-cache-info': Timeout was reached (28); retrying in 337 ms
warning: error: unable to download 'https://cache.nixos.org/nix-cache-info': Timeout was reached (28); retrying in 519 ms
warning: error: unable to download 'https://cache.nixos.org/nix-cache-info': Timeout was reached (28); retrying in 1164 ms
warning: error: unable to download 'https://cache.nixos.org/nix-cache-info': Timeout was reached (28); retrying in 2608 ms
warning: unable to download 'https://cache.nixos.org/nix-cache-info': Timeout was reached (28)
error: path '/nix/store/1rd6d355v7kj8fm3zl6vhr17mhr1ii22-jabref-5.6' does not exist and cannot be created
(use '--show-trace' to show detailed location information)

odd. (No, it is fine to keep it in this thread but thanks for asking! :-).
Given it is a timeout, I’m wondering if it is an issue with the other end. I just ran the command and it succeeded so can you run it again and see if you get the same thing?

Yes, very odd. It seems like an issue on my end, but I am able to download from all the other URLs…

Update: there seems to be some SSL issue as I am able to do a plain HTTP:

$ wget -T 5 http://cache.nixos.org/nix-cache-info
--2023-02-24 16:19:46--  http://cache.nixos.org/nix-cache-info
Resolving cache.nixos.org (cache.nixos.org)... 199.232.18.217, 2a04:4e42:41::729
Connecting to cache.nixos.org (cache.nixos.org)|199.232.18.217|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 51 [text/x-nix-cache-info]
Saving to: ‘nix-cache-info’

nix-cache-info                    100%[==========================================================>]      51  --.-KB/s    in 0s

2023-02-24 16:19:46 (21.4 MB/s) - ‘nix-cache-info’ saved [51/51]

but not the HTTPS:

$ wget -T 5 https://cache.nixos.org/nix-cache-info
--2023-02-24 16:19:32--  https://cache.nixos.org/nix-cache-info
Resolving cache.nixos.org (cache.nixos.org)... 199.232.18.217, 2a04:4e42:41::729
Connecting to cache.nixos.org (cache.nixos.org)|199.232.18.217|:443... connected.
Unable to establish SSL connection.

I figured it out. The issue was an activated company VPN, see also e.g.: https://github.com/microsoft/WSL/issues/4698. After disabling company VPN, everything works smoothly.

2 Likes