None of the solutions showed here helped me, so I'll explain what happened to me and what I did to fix it:
I was trying to install Insync in my Q4OS System and I wasn't able because the app requires libc6 >= 2.32 and the Q4OS uses 2.31. I found a libc6 deb of 2.32 and then the nightmare started. It has been broken my entire system.
apt-get stopped to work and it says the system needs libc6 2.31 to work properly. At that time I didn't know how to downgrade the version. So, after a restart, the system simply didn't start and hung up with the message on boot:
A start job is running for Hold until boot process finishes up (Xmin Xs/no limit)
I tried to change the terminal without success. Hopefully my Linux was running under the VMWare and I was able to connect in the machine using the SSH.
VM -> SSH -> Connect to SSH...
After that, I tried a lot of stuff without success. I tried to upgrade with:
sudo apt install upgrade
and the message says I had to run:
sudo apt --fix-broken install
But when I tried to run that, it said a lot of packages would be removed, including
q4os-desktop itself. Well, I accept the conditions and tried. What more could I lost?
After that, the thing gets too worse. I wasn't able to run anything. I got a similar error of the question:
Preconfiguring packages ...
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: error: 2 expected programs not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)
But the problem wasn't the PATH itself but the ldconfig is part of libc6 and it was removed. I couldn't do anything because almost everything depends of libc6 and ldconfig. I tried to compile libc6 from source, but without success. It has a lot of dependencies and when I tried to install a dependency, the lib tried to use something of libc6. A kind of dependency loop.
So, I reboot the system with the Q4OS live CD and just copy the binary ldconfig to
/usr/sbin/ldconfig. Fine! Now, the
apt-get started to work again (not perfectly, but...). So I discovered how to downgrade the lib:
sudo apt install libc6=2.31-13+deb11u3
If you are not sure which version to use, run:
apt list --installed | grep libc6
inside the Live CD. The output should be something like:
libc6/stable,now 2.31-13+deb11u3 amd64 [installed]
After that, I was able to install the Q4OS again:
sudo apt install q4os-desktop
After a reboot, everything was back to normal!
But now when I run the Insync, the app crashes after 5 seconds.