Score:1

Can't remove package on Raspberry Pi - File name too long

bb flag

When I try to remove linux-raspi-headers-5.4.0-1032 to upgrade it, dpkg gives a weird error about a file name being too long:

(Reading database ... 237046 files and directories currently installed.)
Removing linux-raspi-headers-5.4.0-1032 (5.4.0-1032.35) ...
dpkg: error processing package linux-raspi-headers-5.4.0-1032 (--purge):
 unable to securely remove '/usr/src/linux-raspi-headers-5.4.0-1032/arch/arm/include/asm/mach/p��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������': File name too long
Errors were encountered while processing:
 linux-raspi-headers-5.4.0-1032

How do I get past this?

Score:1
ir flag

Big picture here is first show inode of file we wish to delete then specify that inode when we run the delete command

sudo -i  #  become root to remove root owned file

#   get into dir of file we wish to delete
cd /usr/src/linux-raspi-headers-5.4.0-1032/arch/arm/include/asm/mach/

ls -la -i # parm -i says to show inode values 

now look at output of above to identify inode value of chosen file which is shown as left most column ... lets say 6561977 is inode value for the file you wish to delete ... then to delete that file specify using its inode as per

find . -maxdepth 1 -type f -inum    6561977 -delete

in above replace 6561977 with actual inode value shown ... notice first parm of find command is the directory of action ... here we gave it a period which indicates current directory which is OK since we issued cd command to get into parent dir of file in question

ls -la -i #  list directory again to confirm file has been zapped
bb flag
Even removing the whole `mach` directory still causes the same error to appear when doing `sudo apt-get autoremove -y` with the exact same file name problem.
Scott Stensland avatar
ir flag
@Jamesking56 I updated answer to suggest you first become root
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.