LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   apt corrupt ? (https://www.linuxquestions.org/questions/debian-26/apt-corrupt-4175486841/)

anotherniceday 12-04-2013 10:40 AM

apt corrupt ?
 
Before I begin, I'd just like to say hello to you all as this is my first post. I hope I can contribute something to the forum in future.

Background:
I have a VM that has been running happily for the last couple of years running various services (mail, web, etc). A few months ago I decided to install a DNS server so I could redirect sub-domains to my home server. I ran into an issue with apt and can more or less no longer use the apt-get. I exceeded my time window and basically left it as is for the last few months.

Observations (Issues with apt / versioning ?) :
1. I attempt to add or remove a package (any package)
Code:

root@myhost:~# apt-get remove bind9
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 krb5-user : Depends: libkrb5-3 (= 1.8.3+dfsg-4squeeze7) but 1.8.3+dfsg-4squeeze6 is to be installed
 libgssapi-krb5-2 : Depends: libkrb5-3 (= 1.8.3+dfsg-4squeeze7) but 1.8.3+dfsg-4squeeze6 is to be installed
 libkrb5-3 : Depends: libkrb5support0 (= 1.8.3+dfsg-4squeeze6) but 1.8.3+dfsg-4squeeze7 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

2. I follow apts recommendation
Code:

root@myhost:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  bind9 libkrb5-3
The following packages will be upgraded:
  bind9 libkrb5-3
2 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
38 not fully installed or removed.
Need to get 0 B/734 kB of archives.
After this operation, 127 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Preconfiguring packages ...
(Reading database ... 38196 files and directories currently installed.)
Preparing to replace libkrb5-3 1.8.3+dfsg-4squeeze6 (using .../libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb) ...
Unpacking replacement libkrb5-3 ...
dpkg: error processing /var/cache/apt/archives/libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb (--unpack):
 unable to install new version of `./usr/lib/krb5': No such file or directory
configured to not write apport reports
                                      Preparing to replace bind9 1:9.7.3.dfsg-1~squeeze8 (using .../bind9_1%3a9.7.3.dfsg-1~squeeze11_amd64.deb) ...
Unpacking replacement bind9 ...
dpkg: error processing /var/cache/apt/archives/bind9_1%3a9.7.3.dfsg-1~squeeze11_amd64.deb (--unpack):
 unable to install new version of `./etc/apparmor.d/force-complain': No such file or directory
configured to not write apport reports
                                      dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb
 /var/cache/apt/archives/bind9_1%3a9.7.3.dfsg-1~squeeze11_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

3. My apt policy:
Code:

root@myhost:~# apt-cache policy
Package files:
 100 /var/lib/dpkg/status
    release a=now
 500 http://security.debian.org/ squeeze/updates/non-free amd64 Packages
    release v=6.0,o=Debian,a=oldstable,n=squeeze,l=Debian-Security,c=non-free
    origin security.debian.org
 500 http://security.debian.org/ squeeze/updates/contrib amd64 Packages
    release v=6.0,o=Debian,a=oldstable,n=squeeze,l=Debian-Security,c=contrib
    origin security.debian.org
 500 http://security.debian.org/ squeeze/updates/main amd64 Packages
    release v=6.0,o=Debian,a=oldstable,n=squeeze,l=Debian-Security,c=main
    origin security.debian.org
 500 http://ftp.debian.org/debian/ squeeze/non-free amd64 Packages
    release v=6.0.8,o=Debian,a=oldstable,n=squeeze,l=Debian,c=non-free
    origin ftp.debian.org
 500 http://ftp.debian.org/debian/ squeeze/contrib amd64 Packages
    release v=6.0.8,o=Debian,a=oldstable,n=squeeze,l=Debian,c=contrib
    origin ftp.debian.org
 500 http://ftp.debian.org/debian/ squeeze/main amd64 Packages
    release v=6.0.8,o=Debian,a=oldstable,n=squeeze,l=Debian,c=main
    origin ftp.debian.org
Pinned packages:
root@myhost:~

4. Debian version
Code:

root@myhost:~# cat /etc/debian_version
6.0.8

5. Kernel
Code:

root@myhost:~# uname -a
Linux myhost.mydomain 2.6.32-042stab078.26 #1 SMP Wed Jun 19 11:05:34 MSK 2013 x86_64 GNU/Linux

6. Something weird while doing some investigation
Code:

root@myhost:~# ls -alhtr  /usr/lib/ | less
d?????????  ? ?    ?        ?            ? krb5

root@myhost:/var/log/apt# rmdir /usr/lib/krb5
rmdir: failed to remove `/usr/lib/krb5': No such file or directory
root@myhost:/var/log/apt# cd /usr/lib/krb5
-su: cd: /usr/lib/krb5: No such file or directory
root@myhost:/var/log/apt# ls /usr/lib/krb5
ls: cannot access /usr/lib/krb5: No such file or directory

I hope someone can help shed some light on whats wrong with my system.

Thanks.

273 12-04-2013 10:53 AM

Have you tried running "apt-get clean" before your "apt-get -f install"? The second listing suggests that the packages you have cached might be corrupt.

anotherniceday 12-04-2013 10:59 AM

Quote:

Originally Posted by 273 (Post 5075304)
Have you tried running "apt-get clean" before your "apt-get -f install"? The second listing suggests that the packages you have cached might be corrupt.

Hello 273. Yes I've tried running apt-get clean but sadly the same result.
Code:

root@myhost:~# apt-get clean
root@myhost:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  bind9 libkrb5-3
The following packages will be upgraded:
  bind9 libkrb5-3
2 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
38 not fully installed or removed.
Need to get 734 kB of archives.
After this operation, 127 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://ftp.debian.org/debian/ squeeze/main libkrb5-3 amd64 1.8.3+dfsg-4squeeze7 [374 kB]
Get:2 http://ftp.debian.org/debian/ squeeze/main bind9 amd64 1:9.7.3.dfsg-1~squeeze11 [360 kB]
Fetched 734 kB in 0s (4,434 kB/s)
Preconfiguring packages ...
(Reading database ... 38196 files and directories currently installed.)
Preparing to replace libkrb5-3 1.8.3+dfsg-4squeeze6 (using .../libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb) ...
Unpacking replacement libkrb5-3 ...
dpkg: error processing /var/cache/apt/archives/libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb (--unpack):
 unable to install new version of `./usr/lib/krb5': No such file or directory
configured to not write apport reports
                                      Preparing to replace bind9 1:9.7.3.dfsg-1~squeeze8 (using .../bind9_1%3a9.7.3.dfsg-1~squeeze11_amd64.deb) ...
Unpacking replacement bind9 ...
dpkg: error processing /var/cache/apt/archives/bind9_1%3a9.7.3.dfsg-1~squeeze11_amd64.deb (--unpack):
 unable to install new version of `./etc/apparmor.d/force-complain': No such file or directory
configured to not write apport reports
                                      dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb
 /var/cache/apt/archives/bind9_1%3a9.7.3.dfsg-1~squeeze11_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


273 12-04-2013 11:02 AM

Does the clean definitely clear out /var/cache/apt/archives?

anotherniceday 12-04-2013 11:04 AM

Quote:

Originally Posted by 273 (Post 5075310)
Does the clean definitely clear out /var/cache/apt/archives?

Yes.
Code:

root@myhost:~# ls /var/cache/apt/archives/
bind9_1%3a9.7.3.dfsg-1~squeeze11_amd64.deb  libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb  lock  partial
root@myhost:~# apt-get clean
root@myhost:~# ls /var/cache/apt/archives/
lock  partial


273 12-04-2013 11:06 AM

Sorry, was worth a try.
I'm sure somebody else will have some ideas.

anotherniceday 12-04-2013 11:10 AM

Quote:

Originally Posted by 273 (Post 5075314)
Sorry, was worth a try.
I'm sure somebody else will have some ideas.

No bother, thanks for your help. This isn't a hugely pressing matter... but still quite annoying as I can't install any packages nor redirect sub domains to my home server.

It's probably also worth nothing that I do not have physical access to this server.

Dutch Master 12-04-2013 01:30 PM

The problem is that apt wants to install packages that aren't there anymore. Try
Code:

apt-get -f
No arguments, just on its own. If it doesn't get you anywhere, you could try the following. I must say I haven't tried it myself, so YMMV!
Code:

aptitude --get-selections > selections.txt
aptitude --set-selections < selections.txt
dselect install

This depends on the dselect package, hopefully you have it installed.

Alternatively, you can get the oldstable package (Debian 6 is oldstable) via this link: http://packages.debian.org/squeeze/dselect Choose a mirror near you for the correct arch, fetch it with wget then use dpkg to install it.

I noticed the errors you get are about missing paths too. You may want to create the required directories manually (use mkdir for that).

Also, consider the --reinstall option of apt-get and run apt-get --check to see if the cache is consistent with what's on the system.

anotherniceday 12-05-2013 03:53 AM

Quote:

Originally Posted by Dutch Master (Post 5075399)
The problem is that apt wants to install packages that aren't there anymore. Try
Code:

apt-get -f
No arguments, just on its own. If it doesn't get you anywhere, you could try the following. I must say I haven't tried it myself, so YMMV!
Code:

aptitude --get-selections > selections.txt
aptitude --set-selections < selections.txt
dselect install

This depends on the dselect package, hopefully you have it installed.

Alternatively, you can get the oldstable package (Debian 6 is oldstable) via this link: http://packages.debian.org/squeeze/dselect Choose a mirror near you for the correct arch, fetch it with wget then use dpkg to install it.

I noticed the errors you get are about missing paths too. You may want to create the required directories manually (use mkdir for that).

Also, consider the --reinstall option of apt-get and run apt-get --check to see if the cache is consistent with what's on the system.

Hello Dutch_Master

Thank you for your reply, but I didn't have any success with these commands.


Code:

root@myhost:~# apt-get -f
apt 0.8.10.3 for amd64 compiled on Apr 15 2011 07:35:31
Usage: apt-get [options] command
      apt-get [options] install|remove pkg1 [pkg2 ...]
      apt-get [options] source pkg1 [pkg2 ...]

apt-get is a simple command line interface for downloading and
installing packages. The most frequently used commands are update
and install.

Commands:
  update - Retrieve new lists of packages
  upgrade - Perform an upgrade
  install - Install new packages (pkg is libc6 not libc6.deb)
  remove - Remove packages
  autoremove - Remove automatically all unused packages
  purge - Remove packages and config files
  source - Download source archives
  build-dep - Configure build-dependencies for source packages
  dist-upgrade - Distribution upgrade, see apt-get(8)
  dselect-upgrade - Follow dselect selections
  clean - Erase downloaded archive files
  autoclean - Erase old downloaded archive files
  check - Verify that there are no broken dependencies
  markauto - Mark the given packages as automatically installed
  unmarkauto - Mark the given packages as manually installed

Options:
  -h  This help text.
  -q  Loggable output - no progress indicator
  -qq No output except for errors
  -d  Download only - do NOT install or unpack archives
  -s  No-act. Perform ordering simulation
  -y  Assume Yes to all queries and do not prompt
  -f  Attempt to correct a system with broken dependencies in place
  -m  Attempt to continue if archives are unlocatable
  -u  Show a list of upgraded packages as well
  -b  Build the source package after fetching it
  -V  Show verbose version numbers
  -c=? Read this configuration file
  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp
See the apt-get(8), sources.list(5) and apt.conf(5) manual
pages for more information and options.
                      This APT has Super Cow Powers.
root@myhost:~#



Everything checks out fine.
Code:

root@myhost:~# apt-get -f check
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done

Code:

root@myhost:~# aptitude --get-selections > selections.txt
aptitude: unrecognized option '--get-selections'
root@myhost:~# cat selections.txt
aptitude 0.6.3
Usage: aptitude [-S fname] [-u|-i]
      aptitude [options] <action> ...
  Actions (if none is specified, aptitude will enter interactive mode):

 install      - Install/upgrade packages.
 remove      - Remove packages.
 purge        - Remove packages and their configuration files.
 hold        - Place packages on hold.
 unhold      - Cancel a hold command for a package.
 markauto    - Mark packages as having been automatically installed.
 unmarkauto  - Mark packages as having been manually installed.
 forbid-version - Forbid aptitude from upgrading to a specific package version.
 update      - Download lists of new/upgradable packages.
 safe-upgrade - Perform a safe upgrade.
 full-upgrade - Perform an upgrade, possibly installing and removing packages.
 build-dep    - Install the build-dependencies of packages.
 forget-new  - Forget what packages are "new".
 search      - Search for a package by name and/or expression.
 show        - Display detailed information about a package.
 clean        - Erase downloaded package files.
 autoclean    - Erase old downloaded package files.
 changelog    - View a package's changelog.
 download    - Download the .deb file for a package.
 reinstall    - Download and (possibly) reinstall a currently installed package.
 why          - Show the manually installed packages that require a package, or
                why one or more packages would require the given package
 why-not      - Show the manually installed packages that lead to a conflict
                with the given package, or why one or more packages would
                lead to a conflict with the given package if installed.

  Options:
 -h            This help text.
 --no-gui      Do not use the GTK GUI even if available.
 -s            Simulate actions, but do not actually perform them.
 -d            Only download packages, do not install or remove anything.
 -P            Always prompt for confirmation or actions.
 -y            Assume that the answer to simple yes/no questions is 'yes'.
 -F format      Specify a format for displaying search results; see the manual.
 -O order      Specify how search results should be sorted; see the manual.
 -w width      Specify the display width for formatting search results.
 -f            Aggressively try to fix broken packages.
 -V            Show which versions of packages are to be installed.
 -D            Show the dependencies of automatically changed packages.
 -Z            Show the change in installed size of each package.
 -v            Display extra information. (may be supplied multiple times).
 -t [release]  Set the release from which packages should be installed.
 -q            In command-line mode, suppress the incremental progress.
                indicators.
 -o key=val    Directly set the configuration option named 'key'.
 --with(out)-recommends Specify whether or not to treat recommends as.
                strong dependencies.
 -S fname      Read the aptitude extended status info from fname.
 -u            Download new package lists on startup.
                  (terminal interface only) -i            Perform an install run on startup.
                  (terminal interface only)
                  This aptitude does not have Super Cow Powers.
root@myhost:~#


Dutch Master 12-05-2013 07:02 AM

My bad, replace aptitude with apt-get in those commands. Apols!

anotherniceday 12-05-2013 08:26 AM

Quote:

Originally Posted by Dutch Master (Post 5075946)
My bad, replace aptitude with apt-get in those commands. Apols!


Still no success with this one.
Code:

root@myhost:/# apt-get --get-selections > selections.txt
E: Command line option --get-selections is not understood


I tried updating libkrb5 using a downloaded .deb. But again errors with no such file or directory.

Code:

root@myhost:/# dpkg -i libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb
(Reading database ... 38165 files and directories currently installed.)
Preparing to replace libkrb5-3 1.8.3+dfsg-4squeeze6 (using libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb) ...
Unpacking replacement libkrb5-3 ...
dpkg: error processing libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb (--install):
 unable to install new version of `./usr/lib/krb5': No such file or directory
Errors were encountered while processing:
 libkrb5-3_1.8.3+dfsg-4squeeze7_amd64.deb

Would this have anything to do with this? Has anyone seen anything similar on Debian?

Code:

root@myhost:/# ls -alhtr /usr/lib/ | less
ls: cannot access /usr/lib/krb5: No such file or directory

Code:

root@myhost:/# ls -alhtr /usr/lib/ | less
d?????????  ? ?    ?        ?            ? krb5


Dutch Master 12-05-2013 10:06 AM

Right, I now see I've made a typo: the --get-selection is w/o the s on the end :( (so is --set-selection) Sorry!

As for the strange results for ls, I suspect you're on a shared server, right? In which case you probably have a chroot jail for your system and the sys-admin didn't install it proper, there may be sym-links missing. Inform your host.

anotherniceday 12-05-2013 10:33 AM

Quote:

Originally Posted by Dutch Master (Post 5076047)
Right, I now see I've made a typo: the --get-selection is w/o the s on the end :( (so is --set-selection) Sorry!

As for the strange results for ls, I suspect you're on a shared server, right? In which case you probably have a chroot jail for your system and the sys-admin didn't install it proper, there may be sym-links missing. Inform your host.

Hello still no success with the --get-selection arg (for both apt-get and aptitude. I don't think there is a chroot jail. It's a VM & I don't know what hyper-visor it's running on.

Dutch Master 12-05-2013 11:58 AM

S**t, I messed this one up quite badly. Really, really sorry, you need dpkg instead:
Code:

dpkg --get-selections > selections.txt
dpkg --set-selections < selections.txt

That'll teach me doing this from the top of my head :(

/me feels very stupid now

descendant_command 12-05-2013 02:28 PM

Quote:

Originally Posted by anotherniceday (Post 5075995)
Would this have anything to do with this? Has anyone seen anything similar on Debian?

Code:

root@myhost:/# ls -alhtr /usr/lib/ | less
ls: cannot access /usr/lib/krb5: No such file or directory

Code:

root@myhost:/# ls -alhtr /usr/lib/ | less
d?????????  ? ?    ?        ?            ? krb5


Yes.
This is the guts of your problem.
Fix this and you can then install your package.

As to how ..... not sure.
Check 'mount' to be sure nothing wierd is mounted on it.
Check it from a live environment or such (is there a "recovery console" or such?).
Maybe fsck the disk.


All times are GMT -5. The time now is 08:32 PM.