LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-09-2010, 10:08 AM   #1
Mlippert
LQ Newbie
 
Registered: Sep 2004
Location: Waltham, MA
Distribution: Linux Mint KDE (and playing w/ sidux)
Posts: 4

Rep: Reputation: 0
Question Help cleaning up apt/dpkg after deleting installed files


OK,
I know now that I shouldn't have deleted the installed files, I should have run "apt-get remove", but it's too late now.

I'd like to clean up apt/dpkg so that it doesn't think the package whose files I've deleted is still installed, but when I run:

Code:
apt-get remove --purge linux-image-2.6.32-2.slh.4
I get the following:
Code:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package linux-image-2.6.32-2.slh.4
The package does show up in the list when I run the command:

Code:
dpkg -l "linux-image*"
with "ii" in the 1st column, whatever that means.

Should I just rm the matching files in /var/lib/dpkg/info?

Thanks,
Mike
 
Old 03-09-2010, 01:06 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
If you look at the top of the full dpkg -l listing you'll see...
Code:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                         Version                              Description
+++-============================-====================================-============================================
So "ii" would mean "Desired=Install, Status=Installed". You can probably remove the package by forcing a re-installation of it then doing a normal remove --purge or a forced remove.
 
1 members found this post helpful.
Old 03-09-2010, 08:15 PM   #3
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Please post the output of
Code:
dpkg -l 'linux-image*' | grep ^ii
So, that we (readers) can see that it is really installed, and exactly what the package name is.


Evo2.
 
Old 03-10-2010, 09:57 AM   #4
Mlippert
LQ Newbie
 
Registered: Sep 2004
Location: Waltham, MA
Distribution: Linux Mint KDE (and playing w/ sidux)
Posts: 4

Original Poster
Rep: Reputation: 0
Here's the output:
Code:
$ dpkg -l "linux-image*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                      Version                   Description
+++-=========================-=========================-==================================================================
un  linux-image               <none>                    (no description available)
un  linux-image-2.6           <none>                    (no description available)
un  linux-image-2.6-sidux-686 <none>                    (no description available)
ii  linux-image-2.6.32-2.slh. 2.6.32-16                 Linux 2.6.32 image on PPro/Celeron/PII/PIII/P4
ii  linux-image-2.6.32-6.slh. 2.6.32-30                 Linux 2.6.32 image on PPro/Celeron/PII/PIII/P4
ii  linux-image-2.6.32-6.slh. 2.6.32-31                 Linux 2.6.32 image on PPro/Celeron/PII/PIII/P4
ii  linux-image-2.6.32-7.slh. 2.6.32-32                 Linux 2.6.32 image on PPro/Celeron/PII/PIII/P4
ii  linux-image-2.6.32-7.slh. 2.6.32-36                 Linux 2.6.32 image on PPro/Celeron/PII/PIII/P4
ii  linux-image-2.6.32-7.slh. 2.6.32-38                 Linux 2.6.32 image on PPro/Celeron/PII/PIII/P4
ii  linux-image-2.6.32-8.slh. 2.6.32-40                 Linux 2.6.32 image on PPro/Celeron/PII/PIII/P4
ii  linux-image-2.6.33-0.slh. 2.6.33-3                  Linux 2.6.33 for modern PCs
ii  linux-image-2.6.33-0.slh. 2.6.33-4                  Linux 2.6.33 for modern PCs
And here's what's in /boot:
Code:
$ ls -l /boot
total 53543
-rw-r--r-- 1 root root   105491 Feb 12 21:04 config-2.6.32-8.slh.2-sidux-686
-rw-r--r-- 1 root root   110178 Feb 25 13:40 config-2.6.33-0.slh.3-sidux-686
-rw-r--r-- 1 root root   110178 Feb 27 17:08 config-2.6.33-0.slh.4-sidux-686
drwxr-xr-x 3 root root     6144 Mar  3 16:43 grub
-rw-r--r-- 1 root root 10179043 Feb 18 12:01 initrd.img-2.6.32-8.slh.2-sidux-686
-rw-r--r-- 1 root root 10603791 Mar  3 15:57 initrd.img-2.6.33-0.slh.3-sidux-686
-rw-r--r-- 1 root root 10598704 Mar  8 19:33 initrd.img-2.6.33-0.slh.4-sidux-686
-rw-r--r-- 1 root root 10601783 Mar  3 16:43 initrd.img-2.6.33-0.slh.4-sidux-686.bak
drwx------ 2 root root    12288 Jan 26 16:06 lost+found
-rw-r--r-- 1 root root   160284 Jan 27 12:33 memtest86+.bin
-rw-r--r-- 1 root root   162464 Jan 27 12:33 memtest86+_multiboot.bin
lrwxrwxrwx 1 root root       10 Nov 10 19:58 message -> message.hd
-rw-r--r-- 1 root root   370688 Oct 29 18:45 message.hd
-rw-r--r-- 1 root root   370688 Oct 29 18:45 message.live
-rw-r--r-- 1 root root  1234552 Feb 12 21:04 System.map-2.6.32-8.slh.2-sidux-686
-rw-r--r-- 1 root root  1253858 Feb 25 13:40 System.map-2.6.33-0.slh.3-sidux-686
-rw-r--r-- 1 root root  1251277 Feb 27 17:08 System.map-2.6.33-0.slh.4-sidux-686
-rw-r--r-- 1 root root  2465088 Feb 12 21:04 vmlinuz-2.6.32-8.slh.2-sidux-686
-rw-r--r-- 1 root root  2493696 Feb 25 13:40 vmlinuz-2.6.33-0.slh.3-sidux-686
-rw-r--r-- 1 root root  2495904 Feb 27 17:08 vmlinuz-2.6.33-0.slh.4-sidux-686
 
Old 03-10-2010, 03:22 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Please with the '|grep ^ii' (two reasons: only shows installed packages, ensures we can see the whole package name).

Evo2.
 
Old 03-10-2010, 03:55 PM   #6
Mlippert
LQ Newbie
 
Registered: Sep 2004
Location: Waltham, MA
Distribution: Linux Mint KDE (and playing w/ sidux)
Posts: 4

Original Poster
Rep: Reputation: 0
Well I didn't bother w/ the grep before because I didn't think showing the extra 3 lines which didn't start w/ ii would matter much.

OK, here's the results piped to grep, but now you've got to explain this to me!

How is it that the output is different? How did the package name get truncated? I expect grep to get the same lines written to the console and filter those, but that obviously didn't happen!?

Code:
$ dpkg -l "linux-image*" | grep ^ii
ii  linux-image-2.6.32-2.slh.4-sidux-686     2.6.32-16                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-6.slh.3-sidux-686     2.6.32-30                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-6.slh.4-sidux-686     2.6.32-31                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-7.slh.1-sidux-686     2.6.32-32                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-7.slh.5-sidux-686     2.6.32-36                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-7.slh.7-sidux-686     2.6.32-38                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-8.slh.2-sidux-686     2.6.32-40                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.33-0.slh.3-sidux-686     2.6.33-3                        Linux 2.6.33 for modern PCs
ii  linux-image-2.6.33-0.slh.4-sidux-686     2.6.33-4                        Linux 2.6.33 for modern PCs
Now that I see that the package name is different than what I was trying to remove, I'll try again.

That seemed to work.

Code:
# apt-get remove --purge linux-image-2.6.32-2.slh.4-sidux-686
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-2.6.32-2.slh.4-sidux-686*
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 83.5MB disk space will be freed.
(Reading database ... 234959 files and directories currently installed.)
Removing linux-image-2.6.32-2.slh.4-sidux-686 ...
Running postrm hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.33-0.slh.4-sidux-686
Found initrd image: /boot/initrd.img-2.6.33-0.slh.4-sidux-686
Found linux image: /boot/vmlinuz-2.6.33-0.slh.3-sidux-686
Found initrd image: /boot/initrd.img-2.6.33-0.slh.3-sidux-686
Found linux image: /boot/vmlinuz-2.6.32-8.slh.2-sidux-686
Found initrd image: /boot/initrd.img-2.6.32-8.slh.2-sidux-686
Found memtest86+ image: /memtest86+_multiboot.bin
done
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 2.6.32-2.slh.4-sidux-686 /boot/vmlinuz-2.6.32-2.slh.4-sidux-686
Purging configuration files for linux-image-2.6.32-2.slh.4-sidux-686 ...
Running postrm hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.33-0.slh.4-sidux-686
Found initrd image: /boot/initrd.img-2.6.33-0.slh.4-sidux-686
Found linux image: /boot/vmlinuz-2.6.33-0.slh.3-sidux-686
Found initrd image: /boot/initrd.img-2.6.33-0.slh.3-sidux-686
Found linux image: /boot/vmlinuz-2.6.32-8.slh.2-sidux-686
Found initrd image: /boot/initrd.img-2.6.32-8.slh.2-sidux-686
Found memtest86+ image: /memtest86+_multiboot.bin
done
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 2.6.32-2.slh.4-sidux-686 /boot/vmlinuz-2.6.32-2.slh.4-sidux-686
rmdir: failed to remove `/lib/modules/2.6.32-2.slh.4-sidux-686': Directory not empty
# dpkg -l "linux-image*" | grep ^ii
ii  linux-image-2.6.32-6.slh.3-sidux-686     2.6.32-30                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-6.slh.4-sidux-686     2.6.32-31                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-7.slh.1-sidux-686     2.6.32-32                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-7.slh.5-sidux-686     2.6.32-36                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-7.slh.7-sidux-686     2.6.32-38                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.32-8.slh.2-sidux-686     2.6.32-40                       Linux 2.6.32 image on PPro/Celeron/PII/PIII/
ii  linux-image-2.6.33-0.slh.3-sidux-686     2.6.33-3                        Linux 2.6.33 for modern PCs
ii  linux-image-2.6.33-0.slh.4-sidux-686     2.6.33-4                        Linux 2.6.33 for modern PCs
Thanks,
Mike
 
Old 03-10-2010, 07:34 PM   #7
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
In a terminal dpkg checks how many columns there are and tries to adjust the output. This type of thing does not happen when you pipe to grep. You can also set the COLUMNS env variable (NB. this just my understanding, not a definitive statement).

For example compare the output from the following two commands.

Code:
COLUMNS=49 dpkg -l 'linux-image-*'
COLUMNS=99 dpkg -l 'linux-image-*'
Alternatively you can just resize your terminal emulator to make it very wide.

Cheers,

Evo2.

Last edited by evo2; 03-10-2010 at 07:37 PM. Reason: typo
 
1 members found this post helpful.
  


Reply

Tags
apt, cleanup, uninstall



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
apt-get dpkg error: files list file ... missing final newline PBSchmidt Debian 13 04-29-2023 05:55 PM
APT/dpkg errors! /var/lib/dpkg/status bassclarinet Debian 16 12-01-2011 09:24 AM
apt/dpkg List of all installed packages jmoschetti45 Linux - Software 2 02-12-2010 04:20 PM
Cleaning Slackware. Deleting unnecesary things. glore2002 Slackware 20 06-09-2008 10:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:41 PM.

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