更新

更新

我买了一台新笔记本电脑来工作,现在把它毁了,哈哈,我安装了带有 LVM 的 Debian 11 和我需要的一切。

我是如何陷入这种境地的

除了我的扩展坞设置之外,一切都很完美。长话短说:我似乎尝试了所有方法,但我无法让 DisplayLink 设置与我的笔记本电脑和两个外部显示器配合使用,尽管我的同事可以使用相同的硬件。我有一个屏幕只有隔行扫描作为最高分辨率,我发现 DisplayLink 根本不再是必要的,所以我尝试升级到内核版本5.18.0-3-amd64,因为我读到它在这些领域有更多支持。我跟着本指南。它无法让我的第三台显示器正常工作,但现在我可以使用最高分辨率,无需隔行扫描。这对我来说已经足够好了。

不过,我注意到每当我想用 apt 安装某些东西时,它都会引起一些问题。我只是尝试取消注释 Debian 不稳定源,它会起作用,哈哈

但现在? apt 尝试卸载很多。它想删除半千兆字节。我用谷歌搜索了一下,发现不应该是这样,仔细查看了一下,其中有 gnome 和其他重要的东西。我中止了 ofc 并认为这是内核升级(因为 debian 提供的最新版本是5.10.0-16-amd64

我试图找到降级指南。我运行“ apt install --fix-broken”,重新启动到仍然安装的旧内核,我发现自己处于控制台,而不是桌面环境中。所有这些软件包都被卸载了:) 现在我无法安装任何东西,即使使用 dpkg 也无法安装。 dpkg的数据库会被破坏吗?

另外:我linux-headers-5.18.0-3-common_5.18.14-1_all.deb使用 dpkg 手动安装了它的所有依赖项,因为它们对于 VirtualBox 是必需的,而且我无法让它与 apt 一起工作,所以我只是尝试了这个,它起作用了。我不知道这是否会以某种方式干扰。

错误

我搜索、尝试等等,但完全不知道现在该怎么办。我在安装/升级方面尝试的任何操作都会导致以下结果:

The following packages have unmet dependencies:
 libtext-charwidth-perl: Depends: perlapi-5.34.0 but it is not installable
 libtext-iconv-perl: Depends: perlapi-5.34.0 but it is not installable
 perl: Breaks: perl-modules-5.24 but 5.24.1-3+deb9u7 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

说实话,我甚至不明白这是什么意思。我研究得越多,就越困惑。我甚至不知道现在该用 Google 查什么。

我尝试过的

降级。我想这就是我必须做的,但我不知道该怎么做。我寻找了一些可以将所有软件包降级为可安装版本的东西(例如,降级为 Debian 11 发布的标准),但找不到任何接近它的东西。我只能找到都说“package=version”的教程。我用谷歌搜索了这些软件包,perlapi 是虚拟包来自 perl-base,所以我尝试通过 apt 和 wget 安装版本 5.34.0https://packages.debian.org/sid/amd64/perl-base/download和 dpkg -i

但阿特说:

E: Version '5.34.0' for 'perl-base' was not found

我的意思是...它说无法安装它,但一些论坛解决方案说只需手动安装它。我什至不知道为什么它想要这个版本。我正在使用带有标准 apt 源的内核 5.10(尝试了添加和删除额外源的所有内容):

deb http://packages.hs-regensburg.de/debian/ bullseye main contrib non-free
deb-src http://packages.hs-regensburg.de/debian/ bullseye main contrib non-free

deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free

deb http://deb.debian.org/debian unstable main contrib non-free
deb-src http://deb.debian.org/debian unstable main contrib non-free

dpkg 说:

dpkg: regarding perl-base_5.34.0-5_amd64.deb containing perl-base:
 perl-base breaks libfile-spec-perl (<< 3.8000)
  perl provides libfile-spec-perl and is present and installed.

dpkg: error processing archive perl-base_5.34.0-5_amd64.deb (--install):
 instaling perl-base would break perl, and
 deconfiguration is not permitted (--auto-deconfigure might help)
Errors were encountered while processing:
 perl-base_5.34.0-5_amd64.deb

--自动解除配置没有帮助

我现在不确定问题是什么。我完全迷失了。请帮助 <:C 请记住,我无法安装任何东西,并且“重新安装 Debian”也不是一个选项。我并不总是只是再做一次。如果您需要任何东西,请询问,我会尽力提供

更新

我设法在 Windows 上通过 SSH 和 putty 发送文本(之前输入了所有内容)。

以下是附加信息: https://pastebin.com/XNKLMRkB

更新2

我想出了这个未完成的 apt 命令,试图解决这些依赖问题:

apt install libtext-charwidth-perl=0.04-10+b1 perl-base=5.32.1-4+deb11u2 libtext-iconv-perl=1.7-7+b1 perl=5.32.1-4+deb11u2 perl-modules-5.32=5.32.1-4+deb11u2

这就是我得到的:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
perl is already the newest version (5.32.1-4+deb11u2).
perl-modules-5.32 is already the newest version (5.32.1-4+deb11u2).
perl-modules-5.32 set to manually installed.
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 perl : Breaks: perl-modules-5.24 but 5.24.1-3+deb9u7 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

它以某种方式认为它需要 Debian 9 的 5.24(就像 Stephen Kitt 已经指出的那样。谢谢)。我尝试简单地使用较新的版本,堵塞这个版本,搞定负优先级,卸载或者以某种方式旁路它。什么都没用:C 我想我落后了一步。我只需要知道如何前进。

尝试卸载时出现 dpkg 错误:

dpkg: dependency problems prevent removal of perl-modules-5.24:
 libmailtools-perl depends on libnet-perl; however:
  Package libnet-perl is not installed.
  Package perl-modules-5.24 which provides libnet-perl is to be removed.
  Package perl which provides libnet-perl is not configured yet.
 libmailtools-perl depends on libtest-simple-perl; however:
  Package libtest-simple-perl is not installed.
  Package perl-modules-5.24 which provides libtest-simple-perl is to be removed.
  Package perl which provides libtest-simple-perl is not configured yet.
 libmailtools-perl depends on libnet-perl; however:
  Package libnet-perl is not installed.
  Package perl-modules-5.24 which provides libnet-perl is to be removed.
  Package perl which provides libnet-perl is not configured yet.
 libmailtools-perl depends on libtest-simple-perl; however:
  Package libtest-simple-perl is not installed.
  Package perl-modules-5.24 which provides libtest-simple-perl is to be removed.
  Package perl which provides libtest-simple-perl is not configured yet.
 libhttp-date-perl depends on libtime-local-perl (>= 1.28); however:
  Package libtime-local-perl is not installed.
  Package perl-modules-5.24 which provides libtime-local-perl is to be removed.
  Package perl which provides libtime-local-perl is not configured yet.

dpkg: error processing package perl-modules-5.24 (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 perl-modules-5.24

当我尝试配置所有丢失的包时:

dpkg: dependency problems prevent configuration of perl:
 perl depends on perl-base (= 5.32.1-4+deb11u2); however:
  Version of perl-base on system is 5.34.0-5.
 perl-base (5.34.0-5) breaks perl (<< 5.34.0~) and is installed.
  Version of perl to be configured is 5.32.1-4+deb11u2.

dpkg: error processing package perl (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 perl

答案1

我设法把事情弄清楚了。

就像许多不同论坛中所建议的那样,我必须通过指定特定版本来手动降级软件包(就像我预期的那样)。幸运的是,在这种情况下,数量并不算太多。
但有一个包仍然出现问题:perl-modules-5.24

由于这些原因,apt 和 dpgk 拒绝升级甚至删除任何软件包。 perl-模块-5.24实际上属于 Debian 9 所以删除是安全的,但它不允许我删除。
我无法因此而降级,也无法因此而升级。
我陷入了循环,但幸运的是,我可以强制 dpkg。

这就是我设法解决它的方法:

第一步:祈祷
下一步:在……的帮助下这个答案,我设法卸载了那个愚蠢的软件包:

dpkg -r --force-depends perl-modules-5.24

我确保我的 /etc/apt/sources.list 是正确的:

deb http://packages.hs-regensburg.de/debian/ bullseye main
deb-src http://packages.hs-regensburg.de/debian/ bullseye main

deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main

# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://packages.hs-regensburg.de/debian/ bullseye-updates main
deb-src http://packages.hs-regensburg.de/debian/ bullseye-updates main

然后我可以安装:

apt install libtext-charwidth-perl=0.04-10+b1 perl-base=5.32.1-4+deb11u2 libtext-iconv-perl=1.7-7+b1 perl=5.32.1-4+deb11u2 perl-modules-5.32=5.32.1-4+deb11u2

(我并不完全需要所有这些软件包,因为我之前已经被告知,其中一些软件包已经安装在这些版本中,但在这个阶段,我只是确定)
并通过我的已卸载软件包的备份列表,安装了他们又回来了:

apt install $(cat apt-autoremove-list | awk 'BEGIN {ORS=" "}; {for(i=0;i<=NF;i++){print $i}}')

幸运的是,apt 和 dpkg 现在不再为该死的 debian 9 软件包而烦恼了。我不知道是什么让他们陷入了这种境地……

我可以重新启动回到我的桌面环境...“我的”
我必须重新安装 gnome,但某些软件包再次出现问题。
这一次,他们并没有“破坏”,他们只是仍然拥有来自不稳定的“太新”的软件包。所以我通过手动安装正确的版本解决了这些问题:

apt policy <package>
apt install <package>=<stable version>

尽管通过 Putty 会话重新安装 gnome,安装后它会直接跳到我的笔记本电脑上。
胡里。 8个小时后,终于可以睡觉了。我花了几天时间来配置一切。值得。 :)

感谢大家的贡献和快速回复!

编辑:

我编写了一个尝试安装最新版本的软件包的脚本。将来可能需要调整,但它已经完成了它的工作。

#!/bin/bash

installations=$(apt list --installed)
i="null"
packagesToInstall="";


# changable variables (don't change the ones above here)
debug=0

echo "Notice: Analyze this script's doings first, before you install anything, as apt still claims their CLI interface is not stable"
echo -e "\tAdjust this script if something goes wrong!!!\n\n"

getPackage() {
    parray=(${1//// }) # replace slashes with spaces to convert it into an array

    echo "${parray[0]}"
}

echo "collecting packages to install..."

for attribute in $installations; do
    # skip "Listing... Done"
    if [ "$i" == "null" ]; then
           i=0
           continue
    fi       

    i=$(($i + 1))

    # apt's output pattern upon developing this script:
    #
    # zlib1g-dev/stable,stable-security,now
    # 1:1.2.11.dfsg-2+deb11u1
    # amd64
    # [installed]
    # zlib1g/stable,stable-security,now
    # 1:1.2.11.dfsg-2+deb11u1
    # amd64
    # [installed]


    case "$i" in
        "1")
            package=$(getPackage "$attribute")
            ;;
        "2")
            oldVersion=$attribute
            ;;
        "3")
            architecture=$attribute
            ;;
        "4")
            status=$attribute
            ;;
        "5")
            i=1
            unset "newVersion"
            unset "correctVersion"
            unset "correctVersions"


            # get correct version

            # https://serverfault.com/questions/1073939/debian-11-security-updates-deb-or-security-which-to-choose
            # https://www.linuxheld.de/2021/11/08/upgrade-debian-buster-10-auf-debian-bullseye-11/
            correctVersions=$(apt policy "$package" 2>/dev/null | grep " $(lsb_release -cs)/" -B 1)
            correctVersion=$(echo "$correctVersions" | awk '{print $1}')

            # if a version was found
            if [[ "$correctVersion" != "*"* ]]; then
                #echo "?$correctVersion?"
                correctVersion=($correctVersion) # toArray
                #echo "!$correctVersion!"
                newVersion=${correctVersion[0]}
            fi

            
            if [ "$debug" == 1 ]; then
                echo "package: $package"
                echo "installed version: $oldVersion"
                echo "architecture: $architecture"
                echo "status: $status"
                echo -e "new version: $newVersion\n"
                #echo "$correctVersions"
            fi




            # do actions (install)

            # if there is a new version available to install
            if ! [ -z "$newVersion" ] && [ "$oldVersion" != "$newVersion" ]; then
                packagesToInstall="$packagesToInstall"' '"'$package=$newVersion'"
            fi

            # continue
            package=$(getPackage "$attribute") # 1 from case statement only gets executed the first time
            unset "oldVersion"
            unset "newVersion"
            unset "correctVersion"
            unset "correctVersions"
            continue
            ;;
    esac
    #echo $install | awk '{print $2}'
done

echo -e "installing following packages with versions:\n"

for pti in $packagesToInstall; do
    parray=(${pti//=/ })

    if [ -z "$parray" ]; then
        echo "$pti"
    else
        package="${parray[0]}"
        version="${parray[1]}"

        package=${package#*"'"}
        version=${version%"'"*}

        printf "$package:\t"

        if [ "${#package}" -lt 7 ]; then
            printf "\t\t\t\t"
        elif [ "${#package}" -lt 15 ]; then
            printf "\t\t\t"
        elif [ "${#package}" -lt 23 ]; then
            printf "\t\t"
        elif [ "${#package}" -lt 31 ]; then
            printf "\t"
        fi

        echo "$version"
    fi
done

echo ""
read -p "Install all of these? [Y/n] " userWantsToInstall
userWantsToInstall=${userWantsToInstall,,} # https://stackoverflow.com/questions/1728683/case-insensitive-comparison-of-strings-in-shell-script

# ask before installation
if [ "$userWantsToInstall" == "y" ] || [ -z "$userWantsToInstall" ] || [ "$userWantsToInstall" == "yes" ]; then
    if [ $(whoami) == "root" ]; then
        echo "apt install --yes --force-yes $packagesToInstall"
    else
        echo "sudo apt install --yes --force-yes $packagesToInstall"
    fi
else
    echo -e "\nAborted"
    exit
fi

相关内容