unable to securely remove linux headers

Asked by Rajinder Sandhu

The question was put up earlier also but since then it is in open state only, There were many old headers all were removed except for these two. Now system is unable to upgrade other pkg files also it seems first it wants to remove then only install which is not happening please help me to fix the problem.........

My question is pasted below for quick reference:

unable to securely remove '/usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile': Not a directory

   1. Ubuntu
   2. “apt” package
   3. Questions
   4. Question #139582

Asked by Rajinder Sandhu on on 2010-12-30

Dear Sir,
I am using ubuntu 10.10 and removed old headers for freeing disk space except for the following two headers , the system output is shown below. I am unable to unmark it with synaptic nor able to remove it, Pl guide me to come out of this problem.
Thanks
Rajinder Sandhu

he following packages will be REMOVED:
  linux-headers-2.6.31-16 linux-headers-2.6.31-20
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 147MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 285741 files and directories currently installed.)
Removing linux-headers-2.6.31-16 ...
dpkg: error processing linux-headers-2.6.31-16 (--remove):
 unable to securely remove '/usr/src/linux-headers-2.6.31-16/drivers/pci/pcie/aer/Makefile': Not a directory
Removing linux-headers-2.6.31-20 ...
dpkg: error processing linux-headers-2.6.31-20 (--remove):
 unable to securely remove '/usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile': Not a directory
Errors were encountered while processing:
 linux-headers-2.6.31-16
 linux-headers-2.6.31-20
E: Sub-process /usr/bin/dpkg returned an error code (1)
dads@dads-desktop:~$

regards,
Rajinder Sandhu

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Rajinder Sandhu
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

file /usr/src/linux-headers-2.6.31-16/drivers/pci/pcie/aer/Makefile

Thanks

Revision history for this message
Rajinder Sandhu (sandy744) said :
#2

Sir
for taking output, which command to be typed in terminal ?
is it

dads@dads-desktop:~$ LANG=C;/usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile
bash: /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile: Not a directory
dads@dads-desktop:~$
==================================

dads@dads-desktop:~$ sudo su
[sudo] password for dads:
root@dads-desktop:/home/dads# LANG=C;/usr/src/linux-headers-2.6.31-16/arch/mips/fw/sni/Makefile
bash: /usr/src/linux-headers-2.6.31-16/arch/mips/fw/sni/Makefile: Permission denied
root@dads-desktop:/home/dads#

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Please don't use:

sudo su

It is not the advised method. Instead use:

sudo -i

Thanks

Revision history for this message
Rajinder Sandhu (sandy744) said :
#4

Dear Actionparsnip,
OK from now on we will use sudo -i
but do we havve any choice other than reinstalling OS ? as presently I am unable to update upgrade and install any new pkg though system is working fine.
Thanks
Rajinder

Revision history for this message
Rajinder Sandhu (sandy744) said :
#5

and here is the output after using sudo -i
dads@dads-desktop:~$ sudo -i
[sudo] password for dads:
root@dads-desktop:~# dads@dads-desktop:~$ LANG=C;/usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile
could not open file '/etc/apt/sources.list.d/ddebs.list'
dads@dads-desktop:~$: command not found
-bash: /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile: Not a directory
root@dads-desktop:~#

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

Can you give the output of:

file /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile

Thanks

Revision history for this message
Rajinder Sandhu (sandy744) said :
#7

what i need to type in terminal to take output ....
dads@dads-desktop:~$ cat /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile
cat: /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile: Not a directory
dads@dads-desktop:~$

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#8

run the command I give. I am giving the EXACT command so you can copy and paste.

You ran:
cat /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile
I told you to run:
file /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile

Why are you changing the command I give. You can damage your OS by running incorrect commands....

Revision history for this message
Rajinder Sandhu (sandy744) said :
#9

here is the output....
dads@dads-desktop:~$ file /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile
/usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile: ERROR: cannot open `/usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile' (Not a directory)
dads@dads-desktop:~$

Revision history for this message
Rajinder Sandhu (sandy744) said :
#10

can we block these two files from removing process, because until unless these are not getting removed other packages can not be upgraded so it seems.
Because i am unable to untick them with synaptic and whenever we give upgrade then these two are the first one to be removed then can not be removed after that nothing.
regards
Rajinder

Revision history for this message
Rajinder Sandhu (sandy744) said :
#11

Dear All,
Problem solved by moving the error files from the location and then making directory which is supposed to be removed by the update manager.
for example
/usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile
was not existing because fw is a file in the above path so whole path becomes irrelevent, i moved the fw from the mips folder to src folder then created the dir by
$sudo mkdir -p /usr/src/linux-headers-2.6.31-20/arch/mips/fw/sni/Makefile
there after ran sudo apt-get autoremove to see the result...and it came out on top...Thanks Actionparsnip who gave the idea of creating the file but it was not getting created that was the little hiccup as two same names can not coexist in the same folder in the above path fw file name and folder name which was cause of the problem.
Thanks again
Rajinder