0

I got a new laptop for work and now destroyed it lol I installed Debian 11 with LVM and everything I needed.

How I ended up in this situation

Everything was perfect, except for my docking station setup. Very long story short: I tried seemingly everything, but I couldn't get the DisplayLink setup to work with my laptop and two external monitors, even though my co-worker could, using the same exact hardware. I had one screen only having interlaced as the highest resolution and I found out, that DisplayLink shouldn't be necessary at all anymore, so I tried upgrading to Kernel version 5.18.0-3-amd64, because I read it has more support in these fields. I followed this guide. It didn't get my third monitor to work, but now I could use the highest resolution without interlaced. That was good enough for me.

Though, I noticed whenever I wanted to install something with apt, it caused some issues. I just tried to uncomment the Debian unstable sources and it would work lol

But now? apt tried to uninstall a LOT. It wanted to remove half a giga byte. I googled, found out it shouldn't be, looked a bit through and among it was gnome and other essential stuff. I aborted ofc and figured it's the kernel upgrade (since the newest supplied from debian was 5.10.0-16-amd64)

I tried to find a guide to downgrade. I ran "apt install --fix-broken", rebooted into the old kernel that was still installed and I found myself in a console, not a desktop environment. All of theses packages got uninstalled :) Now I can't install anything, not even with dpkg. Could dpkg's database be broken?

Also: I installed linux-headers-5.18.0-3-common_5.18.14-1_all.deb and all its dependencies manually with dpkg, because they were necessary for VirtualBox and I couldn't get it to work with apt whatsoever, so I just tried this and it worked. I don't know if that could interfere somehow.

The error

I searched, tried, etc. but absolutely no clue what to do now. Anything I try in terms of installing/upgrading results in this:

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).

I honestly don't even get what that's supposed to mean. The more I research, the more I get confused. I don't even know what to Google at this point.

What I tried

downgrading. I think that's what I have to do, but idk how. I looked for something that downgrades all packages into an installable version (e.g. to Debian 11 released standards), but couldn't find anything close to it. I can only find tutorials that all say "package=version". I googled the packages and perlapi is a virtual package that comes from perl-base, so I tried to install the version 5.34.0 via apt and also via wget of https://packages.debian.org/sid/amd64/perl-base/download and dpkg -i

But apt says:

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

I mean... it said it couldn't install it, but some forum solutions said to just manually install it. I don't even know why it wants this version to begin with. I am using kernel 5.10 with standard apt sources (tried everything with added and removed extra sources):

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

And dpkg says:

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

--auto-deconfigure didn't help

I'm not sure anymore what even the problem is at this point. I am utterly lost. Please help <:C Please keep in mind, that I can't install anything and "re-installing Debian" is not an option. I didn't all the time to just do it again. If you need anything, ask and I'll try to provide

Update

I managed to send text via SSH and putty on Windows (typed everything before).

Here is additional information: https://pastebin.com/XNKLMRkB

Update 2

I came up with this unfinished apt command, trying to resolve these dependency issues:

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

This is what I get:

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).

It somehow thinks it needs 5.24 from Debian 9 (like Stephen Kitt already pointed out. Thank you). I tried to simply use the newer version, block this version, make it negative priority, uninstall or somehow bypass it. Nothing worked :C I guess I'm one step behind. I Just need to know how to step forward.

dpkg error when tryin to uninstall:

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

When I try to configure all missing packages:

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
Zio
  • 1
  • 2
  • 1
    installing a header file pulls a whole development environment. With that done I doubt trying to downgrade to stable is still a possible choice if not understanding all it entails. You should have used [`bullseye-backports`](https://backports.debian.org/Instructions/) and/or use an LXC container to build in an separate and isolated environment. At this step I wouldn't write an answer because trying to follow it could result in a worse state. Either upgrade everything to bookworm and stick to it until it becomes Debian 12 (in 2023?) , or reinstall. – A.B Aug 07 '22 at 17:42
  • 1
    Unfortunately, you’ve partially upgraded to unstable, and then nuked most of your system. Given that their tutorial got you into this mess, have you tried asking the people at LinuxCapable for help? I know you don’t want to do this, but I strongly suspect that it would take you less time to re-install than to fix your current setup. Starting with a clean Debian 11, you could install version 5.18 of the kernel [from backports](https://unix.stackexchange.com/a/420682/86440) without breaking your system by partially upgrading to unstable. – Stephen Kitt Aug 07 '22 at 17:44
  • @StephenKitt while the tutorial isn't that great, that's the additional action from OP ("Also: I installed linux-headers-5.18.0-3-common_5.18.14-1_all.deb and all its dependencies manually with dpkg, because they were necessary for VirtualBox ") that probably made everything go South. – A.B Aug 07 '22 at 17:46
  • @A.B right, there’s some additional stuff going on (the headers package doesn’t have any dependencies). However the tutorial would have been much safer if it used backports instead of unstable; it’s also a bit of a mishmash (see the reference to elementary OS at the end) which suggest it wasn’t written with much care. – Stephen Kitt Aug 07 '22 at 17:54
  • @Zio if you do re-install, you can also [take care of Virtual Box with backports](https://unix.stackexchange.com/a/286937/86440). – Stephen Kitt Aug 07 '22 at 17:55
  • @StephenKitt ah no dependencies my bad (but I suspect though OP didn't write it, linux-headers-5.18.0-3-amd64 could have been needed and depends on gcc 11) and anyway I agree a tutorial telling to mix versions rather than talking about backports can't be good. – A.B Aug 07 '22 at 17:58
  • I feared this would be the case :/ Can't I just manually install the earlier versions of these header packages and then revert somehow? If I can go forward, I should be able to go backwards as well, right? – Zio Aug 07 '22 at 18:02
  • @Zio unfortunately your Perl packages are messed up (with packages from Debian 9, which is weird), and that’s difficult to recover from. It’s possible to fix, and if it were my system I might try it; but helping someone remotely through a Q&A system makes it quite a bit more complex, and the added delay from the back-and-forths just makes it even more advantageous to re-install. In the 53 minutes since your comment, you’d have had time to re-install ;-). – Stephen Kitt Aug 07 '22 at 18:55

1 Answers1

0

I managed to clear things up.

Like suggested in a bunch of different forums, I had to manually downgrade the packages (like I anticipated), by specifying the specific version. Luckily, in this case, it wasn't too many.
But one package still made problems: perl-modules-5.24

apt and dpgk refused to upgrade and even remove any packages, because of these. perl-modules-5.24 actually belongs to Debian 9 So it was safe to remove, but it wouldn't let me.
I couldn't downgrade because of it and I couldn't upgrade because of it.
I was stuck in a loop, but thankfully, I could force dpkg.

This is how I managed to resolve it:

First step: Pray
Next steps: With the help of this answer, I managed to uninstall that stupid package:

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

I made sure my /etc/apt/sources.list was correct:

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

Then I could install:

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

(I didn't exactly need all of these packages, as I was already informed before, that some of these are already installed at these versions, but at this stage, I just made sure)
And through my backup list of uninstalled packages, installed them back again:

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

Luckily, apt and dpkg now aren't crying about a damn debian 9 package anymore. Idk what got caught them up in that...

And I could reboot back into my desktop environment... "my"
I had to install gnome back, but some packages had problems again.
This time, they didn't "break" tho, they simply still had the "too new" packages from unstable. So I resolved these by manually installing the correct version:

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

And while installing gnome back via the Putty session, it jumped right into it on my laptop after installation.
Hoory. Finally, after 8 hours, some sleep. It took me days to configure everything. Worth it. :)

Thank you all for your contribution and quick responses!

Edit:

I wrote a script that tries to install the latest versions of the packages. It may need to be adjusted in the future, but it does its job.

#!/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
Zio
  • 1
  • 2