LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 05-01-2006, 03:37 PM   #1
hisnumber666
Member
 
Registered: Mar 2006
Distribution: Debian Sarge, Windows Server 2003
Posts: 66

Rep: Reputation: 15
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.
 
Old 05-01-2006, 05:50 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
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???

Good luck!
 
Old 05-01-2006, 06:06 PM   #3
hisnumber666
Member
 
Registered: Mar 2006
Distribution: Debian Sarge, Windows Server 2003
Posts: 66

Original Poster
Rep: Reputation: 15
files on my system are not seen. they are not missing.
the details are here:
http://www.linuxquestions.org/questi...99#post2226299
 
Old 05-01-2006, 06:25 PM   #4
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
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.

Sorry I couldn't be more help, good luck.
 
Old 05-01-2006, 06:40 PM   #5
hisnumber666
Member
 
Registered: Mar 2006
Distribution: Debian Sarge, Windows Server 2003
Posts: 66

Original Poster
Rep: Reputation: 15
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?
 
Old 05-01-2006, 06:51 PM   #6
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Quote:
Originally Posted by hisnumber666
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?)
 
Old 05-01-2006, 07:06 PM   #7
hisnumber666
Member
 
Registered: Mar 2006
Distribution: Debian Sarge, Windows Server 2003
Posts: 66

Original Poster
Rep: Reputation: 15
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.
 
Old 05-01-2006, 07:24 PM   #8
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Have you tried chroot /mnt/hda1 /mnt/hda1/bin/bash?
 
Old 05-01-2006, 07:30 PM   #9
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Found this thread. It looks like they're basically copying files from the live CD to the proper directory. http://www.redhat.com/archives/nahan.../msg00043.html
 
Old 05-01-2006, 07:39 PM   #10
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
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
Code:
libncurses.so.5 => /lib/libncurses.so.5 (0xb7fa2000)
	libdl.so.2 => /lib/tls/libdl.so.2 (0xb7f9e000)
	libc.so.6 => /lib/tls/libc.so.6 (0xb7e69000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7fea000)
So from Knoppix (adapted from the link I posted above), try
Code:
[Knoppix ~]# cp /lib/libncurses.so.5 /chroot/lib/libncurses.so.5
[Knoppix ~]# cp /lib/tls/libdl.so.2 /chroot/lib/tls/libd1.so.2
[Knoppix ~]# cp /lib/tls/libc.so.6 /chroot/lib/tls/libc.so.6
[Knoppix ~]# cp /lib/ld-linux.so.2 /chroot/lib/ld-linux.so.2
[Knoppix ~]# chroot /chroot /bin/bash --login
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.
 
Old 05-01-2006, 09:06 PM   #11
hisnumber666
Member
 
Registered: Mar 2006
Distribution: Debian Sarge, Windows Server 2003
Posts: 66

Original Poster
Rep: Reputation: 15
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?
 
Old 05-01-2006, 10:42 PM   #12
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
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...
 
Old 05-01-2006, 11:39 PM   #13
hisnumber666
Member
 
Registered: Mar 2006
Distribution: Debian Sarge, Windows Server 2003
Posts: 66

Original Poster
Rep: Reputation: 15
a distro upgrade... sounds so good.

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.
 
Old 05-02-2006, 01:04 AM   #14
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
Code:
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.
 
Old 05-02-2006, 02:06 AM   #15
hisnumber666
Member
 
Registered: Mar 2006
Distribution: Debian Sarge, Windows Server 2003
Posts: 66

Original Poster
Rep: Reputation: 15
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).

does that answer it?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
broken system. libc6 is missing, dpkg and apt-get not working. help!!! hisnumber666 Linux - Software 3 05-01-2006 07:20 PM
apt-get broken due to jre package pyromania Ubuntu 5 02-08-2006 07:48 PM
Virus or broken system? apt-get install asks to remove kernel image?? rakamaka Linux - Software 6 09-19-2005 09:31 PM
Troubles with dpkg and apt-get - bad package TTL_2 Linux - Software 1 08-13-2005 11:49 PM
apt wont install a single package craigdolson Debian 3 12-16-2003 04:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration