maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Troubleshooting (https://talk.maemo.org/forumdisplay.php?f=6)
-   -   Solution: apt database tweaking when apt-get fails to remove/reinstall/install (https://talk.maemo.org/showthread.php?t=18080)

yabbas 2008-03-19 13:20

Solution: apt database tweaking when apt-get fails to remove/reinstall/install
 
ok - not so much a solution as a pointer. [hmm, perhaps I need a better title for this?]

The problem I had was with tetex-base. Partial installation became corrupt as I ran out of space on the device, no post or preinstall script in the deb, I was fubared. apt-get couldn't remove the temporary install, no amount of forcing worked, application manager wouldn't continue, dpkg stuff failed, etc

If you're at the end of your tether like I was; and simply need to get your system to install applications again without a reflash - it's not nice but a solution is to manually edit the apt-database.

It's a text file:
/var/lib/dpkg/status

Try making a safety copy, and then manually snipping out the offending package's entry with a text editor. Worked for me.


Whilst we're on the subject, here are a few more pointers:

The apt-repo list is a text file at:
/etc/apt/sources.list.d/hildon-application-manager.list

It's easy enough to edit this to remove any duplicate entries that apt complains about.

Also see the solution on fixing GPG warnings on the ITT forums here.


apt-get clean - is useful for cleaning out:
/var/cache/apt/
/var/cache/apt/partial/
archived files to regain some space.

GronMayer has an excellent website with a list of all known maemo repos here: http://www.gronmayer.com/it/


Any other tips we should have here?

m_stolle 2008-03-19 15:02

Re: Solution: apt database tweaking when apt-get fails to remove/reinstall/install
 
did you try "dpkg --purge <packagename>" ? Just removing the entry from the status file doesn't remove the files that were installed... dpkg also has a bunch of --force-X entries for having it override safety concerns if your system is really foobared. However, After running Debian for 10 years, I've almost never had to resort to --force options, certainly not when an install failed due to lack of space (happens quite frequently on my older machines...)

Martin

yabbas 2008-03-19 15:39

Re: Solution: apt database tweaking when apt-get fails to remove/reinstall/install
 
Nokia-N810-50-2:~# apt-get install tetex-base
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
texinfo
Suggested packages:
tetex-extra tetex-bin
Recommended packages:
tetex-doc
The following NEW packages will be installed:
tetex-base texinfo
0 upgraded, 2 newly installed, 0 to remove and 56 not upgraded.
Need to get 12.5MB of archives.
After unpacking 52.2MB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
texinfo tetex-base
Install these packages without verification [y/N]? y
Get:1 http://repository.maemo.org chinook/free texinfo 4.7-2.2 [853kB]
Get:2 http://repository.maemo.org chinook/free tetex-base 2.0.2c+maemo2-8osso3 [11.6MB]
Fetched 12.5MB in 1m14s (168kB/s)
Selecting previously deselected package texinfo.
(Reading database ... 22106 files and directories currently installed.)
Unpacking texinfo (from .../texinfo_4.7-2.2_armel.deb) ...
Selecting previously deselected package tetex-base.
Unpacking tetex-base (from .../tetex-base_2.0.2c+maemo2-8osso3_all.deb) ...
dpkg (subprocess): unable to execute new pre-installation script: No such file or directory
dpkg: error processing /var/cache/apt/archives/tetex-base_2.0.2c+maemo2-8osso3_all.deb (--unpack):
subprocess pre-installation script returned error exit status 2
dpkg (subprocess): unable to execute new post-removal script: No such file or directory
dpkg: error while cleaning up:
subprocess post-removal script returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/tetex-base_2.0.2c+maemo2-8osso3_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

=============
Nokia-N810-50-2:~# apt-get remove tetex-base
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
tetex-base
0 upgraded, 0 newly installed, 1 to remove and 56 not upgraded.
2 not fully installed or removed.
Need to get 0B of archives.
After unpacking 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: error processing tetex-base (--remove):
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
Errors were encountered while processing:
tetex-base
localepurge: checking system for new locale ...
localepurge: processing locale files ...
localepurge: Disk space freed in /usr/share/locale: 1031K
E: Sub-process /usr/bin/dpkg returned an error code (1)

============

Nokia-N810-50-2:~# dpkg --purge tetex-base
dpkg: error processing tetex-base (--purge):
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
Errors were encountered while processing:
tetex-base

============



Just tried a purge since I can't remember doing it before...it didn't work.

I don't know too much about Debian packaging - do the above errors help at all? Only way I saw fit to get apt back was to edit the database manually.

You can easily replicate it :) Just: apt-get install tetex-base

m_stolle 2008-03-20 14:19

Re: Solution: apt database tweaking when apt-get fails to remove/reinstall/install
 
Yikes... I guess I never ran into that problem with Debian because I kept /var on a separate partition from /usr ... so even if /usr was filled up, /var (with the pre/pos scripts) still had space.

Martin

yabbas 2008-03-23 01:21

Re: Solution: apt database tweaking when apt-get fails to remove/reinstall/install
 
/var in a separate partition you say :) hmmmm


Initially I thought it was down to a lack of space, but looking at the errors, that may be debatable...

Wonder what's going on!


All times are GMT. The time now is 04:20.

vBulletin® Version 3.8.8