how to manually install a package when dpkg, apt-get are broken and system wont boot.
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
how to manually install a package when dpkg, apt-get are broken and system wont boot.
my libc6 was removed ignoring dependencies, now i cant execute any commands.
since i have restarted i cant boot and now i am trying to install the package from knoppix.
partition is mounted, chroot is not working.
dpkg returns errors
apt-get needs root changed prior, uses dpkg to install. so wont work.
i need to know how to manually "inject" the package.
You might try typing linux rescue at the boot prompt of your installation CD.
If that doesn't work, try:
1) use the first CD ( or netinstaller CD, same thing)
2) At the begining of installation ( when the partitions are loaded) switch to the shell (ctrl+alt+F2)
3) mkdir /mnt/mydir
4) mount your root partition (example -- /dev/hda1) on directory (/mnt/mydir)
5) chroot /mnt/mydir
That should let you be root on your debian box. And hopefully you can recover. You can try running apt-get -f dist-upgrade and see if that will try to repair the install.
Or maybe try using dselect to reinstall libc6? Or try running base-config to reinitialize your install???
Yikes! Well, I'm afraid I may not be much help then. I've never had to recover from something that bad, and if I did, I just made a backup of important config files and reinstalled, I see where you don't want to do that.
All I can recommend is the above which if you can make them run might help make all the files be "seen" again. If it helps at all, it looks like apt-get and dpkg are under /usr/bin.
unfortinately apt-get does not allow to change root on its own, it is also dependent on dpkg which does not see pre/post install scripts. until the system can see the files again, attempting to install packages is useless. thanks for the help though.
anyone else?
unfortinately apt-get does not allow to change root on its own
Sorry, I guess I don't understand what you mean by this? You are not able to get to root? Or you are not able to change the root filesystem? (No expert, but I thought both of these were things chroot did?)
if you are not in the right root filesystem you are installing packages into the wrong system. yes chroot is the right tool to use, and it doesnt work. dpkg has its own --root option. dpkg fails to install or uninstall packages because it cannot access pre/post install scripts (programs just dont see external files anymore).
here:
root@ttyp0[bin]# chroot /mnt/hda1
chroot: cannot run command `/bin/bash': No such file or direct
basically the system just does not see the designated shell binary that it supposed to run when it changes root.
So if you can mount the old drive from Knoppix at say /mnt/chroot, then copy the right shared libraries over to the /mnt/chroot directories. On my Debian box, the command ldd /bin/bash gives
Or look through those directories and see if those files exist and only copy the ones that aren't there (presumably the libc.so.6)... Sorry, not sure if it will work or whether I'm just blowing smoke. I just can't resist a good problem.
good job indeed. you rule. in fact it was only a couple of files i was missing. which turned out to be critical. i guess programmers that wrote linux programs are not up to the same standards i am. my programs are just a bit more verbose.
the binaries and scripts were not missing, but rather the libraries needed to run the binaries were. instead of giving output of the binary, bash just craps out saying something in "does not exist" manner.
i ended up copying entire contents of /lib/ on knoppix onto my system, after that i installed the stable libc6 package and booted without issues.
i still have 47 broken packages... i guess ill wait till libc6 2.4.x comes out for stable.
thanks alot. speaking of which, i am writing a mini guide for installing WineX from CVS (for debian mostly). be on the lookout for it when its done.
is there any way i can help you?
You sound like a pretty tech savvy guy, so the only thing you can help me with right now is to every now and again search the zero reply threads and see if there's anyone you can help out (who knows, it might be me sometime!) That's the thing I like the most about linux is the community. Even people who don't know much about linux can help out other people, even if it is just googling and modifying other people's solutions. Sometimes all it takes is a little bit of translation.
As for the broken packages, you might try apt-get -f dist-upgrade when you're feeling brave again. It should try to fix all the broken packages. Not sure if copying all the /lib directory will cause you problems in the future or not...
29 upgraded, 0 newly installed, 1206 to remove and 1 not upgraded.
Need to get 19.9MB of archives.
After unpacking 2409MB disk space will be freed.
You are about to do something potentially harmful
To continue type in the phrase 'Yes, do as I say!'
?]
i dont think im quite brave enough for that. ill just wait for newer packages to come out to meet dependecies. this is what you get when you mix in testing packages. sometimes you have to do that though... some hardware drivers require those packages to meet dependecies.
im not a linux guru - been an occasional linux user for the last 4 years or so. lack of hardware support/drivers mostly kept me away from it. its getting better these days though. i am sorta handy with computers since i am a certified pc technician and a software developer for Microchip PIC based robot microcontrollers.
up until bugs come, most of os maintenance is no rocket science really. but sometimes you hit a bad one and they can be quite misleading.
29 upgraded, 0 newly installed, 1206 to remove and 1 not upgraded.
Need to get 19.9MB of archives.
After unpacking 2409MB disk space will be freed.
You are about to do something potentially harmful
To continue type in the phrase 'Yes, do as I say!'
?]
The code above look like you were using testing or unstable and you try to downgrade to sarge. The libc6 package and other importants packages could not have been uninstalled without warning you first. Usually what i did when having that problem was using the chroot method.
i had to add a testing repository to my sources to match a dependecy for a hardware driver.
then i installed another package, apt-get installs newest version. newest version of that package triggered updates for a few more packages. a total of 5 or 6 critical packages were installed as testing.
now when i attempt any kind of upgrades i wants to remove all the programs that depend on later version libc. basically you can get a stable version of a program which will require a version of another package that is not yet stable. you will just have to choose. since it was a matter of either having it or not having it i chose to go ahead and install a few testing packages. hopefully as support for Debian Etch gonna start in a couple of weeks there will be packages that will new packages released into stable(and hopefully well working by that time).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.