systemd 从 impish 升级到 jelly fish 时出现问题(WSL2)

systemd 从 impish 升级到 jelly fish 时出现问题(WSL2)

我正在尝试将我的 WSL2 发行版从 Impish 升级到 Jammy Jellyfish,但遇到了我认为是 systemd 的问题。我刚刚从 Windows 商店安装了新的 wsl 版本以启用 systemd 支持,不确定这是否相关。不知道接下来该怎么做。

运行sudo do-release-upgrade结果为:

Checking for a new Ubuntu release
Your Ubuntu release is not supported anymore.
For upgrade information, please visit:
http://www.ubuntu.com/releaseendoflife

运行“sudo apt upgrade”会导致:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libnss-systemd : Depends: systemd (= 248.3-1ubuntu8.6) but 248.3-1ubuntu8.2 is installed
 libpam-systemd : Depends: systemd (= 248.3-1ubuntu8.6) but 248.3-1ubuntu8.2 is installed
 systemd : Depends: libsystemd0 (= 248.3-1ubuntu8.2) but 248.3-1ubuntu8.6 is installed
 systemd-sysv : Depends: systemd (= 248.3-1ubuntu8.6) but 248.3-1ubuntu8.2 is installed
 systemd-timesyncd : Depends: systemd (= 248.3-1ubuntu8.6) but 248.3-1ubuntu8.2 is installed
 udev : Breaks: systemd (< 248.3-1ubuntu8.6) but 248.3-1ubuntu8.2 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

运行sudo apt --fix-broken install结果:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  systemd
Suggested packages:
  systemd-container
The following packages will be upgraded:
  systemd
1 upgraded, 0 newly installed, 0 to remove and 126 not upgraded.
4 not fully installed or removed.
Need to get 0 B/4405 kB of archives.
After this operation, 4096 B disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 45441 files and directories currently installed.)
Preparing to unpack .../systemd_248.3-1ubuntu8.6_amd64.deb ...
Unpacking systemd (248.3-1ubuntu8.6) over (248.3-1ubuntu8.2) ...
dpkg: error processing archive /var/cache/apt/archives/systemd_248.3-1ubuntu8.6_amd64.deb (--unpack):
 unable to make backup link of './usr/lib/tmpfiles.d/tmp.conf' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/systemd_248.3-1ubuntu8.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

在几个不同但半相关的问题之间找到了答案。简单来说,我认为只需要重新安装 systemd。以下方法对我有用:

# Reverting to old sources:
sudo sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

# Reinstall systemd:
sudo apt install --reinstall systemd

#Update distro:
sudo apt update && sudo apt upgrade

# Upgrade to new version:
sudo do-release-upgrade

相关内容