bookworm (= will be Debian 12 once it's released) repository to Debian 10 would have been a bad idea, since you can't skip over releases when upgrading: you must first upgrade to Debian 11 "bullseye" before going for "bookworm".
Fortunately your first attempt (without
sudo) would have failed because
/etc/apt/sources.list requires root access to write.
Your remembered version of the second command should not have caused any major problems either, assuming that you were not already root and in
/usr/bin when executing it.
sudo echo 'deb http://ftp.de.debian.org/debian bookworm main' >> sudo /etc/apt/sources.list
This command actually means "use root privileges to write the text in single quotes to standard output, then (as a regular user) append it to a file named "sudo" in the current directory (creating the file if it doesn't exist). So this should not have caused any major harm either, unless your memory was wrong.
Without (successfully) using
sudo or otherwise having root access, you won't be able to use
apt or other package management commands, as those require root privileges to work.
I would suggest checking several things:
What is the actual status of
less /etc/apt/sources.list to view it. You should be able to do it as a regular user without any special permissions.
What did you actually do?
history command to view the command history, instead of relying on your memory.
What is happening now?
You could run
type sudo to see what is actually being run when you use the
sudo command. Normally it should respond with:
sudo is /usr/bin/sudo
sudo is hashed (/usr/bin/sudo)
If it tells you something different, you either have something non-standard named
sudo in your $PATH before the
/usr/bin directory, or you have managed to define a shell alias or function with the name
sudo and it is getting executed instead of the real
If that is the problem, you should be able to use the real
sudo command by specifying it by full path, i.e.
/usr/bin/sudo instead of just
It looks like you managed to add
bookworm repository to
/etc/apt/sources.list. If you also have
unattended-upgrades package installed, the system may have begun attempting to upgrade itself from Debian 10 "buster" straight to "bookworm" (future Debian 12, still in testing phase), skipping over Debian 11... which is not going to work.
By trying to install
python3.10 after adding
bookworm repository you may also have caused a dependency cascade which triggered an upgrade of many (but not all) system libraries.
Effectively, you may have made a FrankenDebian: a freakish combination of packages from different releases that were never promised to work together.
/var/log/dpkg.log is a low-level package management log that should record all recent package management operations, whether manual or automatic. It should be readable by a regular user. Do you see anything recorded in there at about the time the problem started?
Each line should begin with a timestamp, followed by a word that describes the particular action. The interesting lines should have the action word as
After the action word, there should be the package name, then old version (or
<none> if not applicable) and a new version (or
If you take the lines with timestamps after adding the bookworm repository (check the modification time of
/etc/apt/sources.list), these lines should tell you exactly which packages have been replaced, most likely with corresponding packages from
Unfortunately, since you apparently have only RDP access to the system, gaining root access and downgrading the packages back to
buster-appropriate versions might not be possible to you without help from someone who can access the bootloader of the system.
To recover, it might be necessary to boot the system to rescue mode from an external media, then activate network interfaces and
chroot into the damaged system as root. Then it should be possible to downgrade the mis-upgraded packages, by reversing the install/update/remove actions listed in the
/var/log/dpkg.log file at or after the point of you adding the