linuxmint / mintupgrade

42 stars 16 forks source link

mintupgrade Fails to Upgrade when Tailscale is Installed #109

Open tech31842 opened 2 months ago

tech31842 commented 2 months ago

This is a refile of https://github.com/linuxmint/linuxmint/issues/666

This is still an issue with the upgrade to Mint 22.0.

Original text follows:

When trying to do a major Mint upgrade using mintupgrade, if Tailscale is installed, it fails with the error:

Package repositories The following problems were found: https://pkgs.tailscale.com/stable/ubuntu does not support jammy

I also found this forum post from July 2023 describing the same symptoms: https://forums.linuxmint.com/viewtopic.php?t=400691

The current workaround requires deinstalling Tailscale and removing the apt repository, then reinstalling after the Mint upgrade.

Replication Steps

I did a fresh install of Mint 20.3 Cinnamon in a VirtualBox VM. For good measure I ran apt update/upgrade to catch up on packages, and rebooted.

I installed the Tailscale software using (as directed by the Tailscale web site): curl -fsSL https://tailscale.com/install.sh | sh It doesn't matter if Tailscale is actually configured or running, or even actually installed. The problem has to do with the Tailscale repository.

I installed mintupgrade version 2024.01.12 and ran it with sudo. After going through the process for a while, I eventually got the noted error.

Diagnosis

I was able to track down the problem to /usr/lib/linuxmint/mintupgrade/checks.py. In the APTRepoCheck class, method do_run(), section "Check the base repos can handle destination codename", it's checking that a particular URL exists by calling the get_url_last_modified() method and verifying that a timestamp was returned. The Python libraries in use take the timestamp from the Last-Modified: HTTP header.

But it turns out that the repos on tailscale.com don't serve the Last-Modified: header, so even though the URL that the script is trying to locate does exist, it gets a false negative because of the missing timestamp.

This is confirmed with either F12 tools in Firefox or using the last-modified.com site to check https://pkgs.tailscale.com/stable/ubuntu/dists/jammy/Release

This is technically a violation of RFC 2616, section 14.29:

HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.

However, it does specify no-cache so the freshness shouldn't ever matter with this URL.

But in this case, the freshness is irrelevant: The code seems to be using this method only as a lazy shortcut to check for existence.