[SOLVED] I broke my package system on linux mint 20
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was building a script to automate something with apt, and to put it shortly, I ended up interrupting the script, which stopped apt mid-way through an operation.
The package system is now broken due to a single broke package, so now every time I try to run any command with apt or dpkg, it tries to fix it or something, resulting in a massive trainwreck of errors every time i try to use the package system.
The package was bluez, but I don't think it matters exactly which one.
I've tried a whole bunch of ways to remove or reinstall the damaged package.
Code:
sudo dpkg --remove --force-remove-reinstreq bluez
sudo apt-get -f install
sudo apt-get update
sudo apt-get autoremove
sudo dpkg --configure -a
sudo apt-get clean
sudo apt purge bluez
sudo apt remove bluez
tried to fix it from apt
tried to fix it from apt-get
tried to fix it from dpkg
tried to fix it from synaptic
a whole bunch more...
Nothing worked.
Here's the errors:
Code:
user@User-Box:~$ sudo dpkg --remove bluez
[sudo] password for user:
(Reading database ... 331226 files and directories currently installed.)
Removing bluez (5.53-0ubuntu3.6) ...
/usr/sbin/invoke-rc.d: 1: /sbin/runlevel: Exec format error
/usr/sbin/invoke-rc.d: 290: systemctl: Exec format error
invoke-rc.d: could not determine current runlevel
/usr/sbin/invoke-rc.d: 491: systemctl: Exec format error
/usr/sbin/invoke-rc.d: 512: systemctl: Exec format error
/usr/sbin/invoke-rc.d: 521: systemctl: Exec format error
invoke-rc.d: initscript bluetooth, action "stop" failed.
dpkg: error processing package bluez (--remove):
installed bluez package pre-removal script subprocess returned error exit status 1
/usr/bin/systemctl: 3: Syntax error: EOF in backquote substitution
/usr/sbin/invoke-rc.d: 1: /sbin/runlevel: Exec format error
/usr/sbin/invoke-rc.d: 290: systemctl: Exec format error
invoke-rc.d: could not determine current runlevel
/usr/sbin/invoke-rc.d: 491: systemctl: Exec format error
/usr/sbin/invoke-rc.d: 512: systemctl: Exec format error
/usr/sbin/invoke-rc.d: 518: systemctl: Exec format error
invoke-rc.d: initscript bluetooth, action "start" failed.
/usr/sbin/invoke-rc.d: 563: systemctl: Exec format error
dpkg: error while cleaning up:
installed bluez package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
bluez
Which as far as I can tell, happens exactly the same way every time I try to do anything with any package manager, it doesn't stop me from editing other packages, but it does slow everything down because while trying to do something else, it tries to fix bluez every time as well.
When you say that you "tried to fix if from Synaptic" and the other package management tools, what exactly did you do?
that is irrelevant at this point, i simply want to know what the error messages mean and how to fix them, also how to finally remove this broken package.
/usr/sbin/invoke-rc.d is a script. The numbers look like line numbers in the script where calls are causing the exec format errors from trying to read missing or corrupt file(s). This could be caused by the incomplete installation of bluez and its relationship with other packages with startup scripts in /etc/init.d/. I would look for a bluez and/or bluetooth or other files there with (a) timestamp(s) of when the problem began instead of timestamps of files in the .debs they came from, which would indicate incomplete or corrupt file. I would have expected dpkg -r bluez (aka --remove) or apt-get remove -f bluez to have removed bluez.
/usr/sbin/invoke-rc.d is a script. The numbers look like line numbers in the script where calls are causing the exec format errors from trying to read missing or corrupt file(s). This could be caused by the incomplete installation of bluez and its relationship with other packages with startup scripts in /etc/init.d/. I would look for a bluez and/or bluetooth or other files there with (a) timestamp(s) of when the problem began instead of timestamps of files in the .debs they came from, which would indicate incomplete or corrupt file. I would have expected dpkg -r bluez (aka --remove) or apt-get remove -f bluez to have removed bluez.
No luck!
This happened in 2023, as you can see, the dates end at 2021.
that is irrelevant at this point, i simply want to know what the error messages mean and how to fix them, also how to finally remove this broken package.
I don't think so. If you give us more details we can better help you to solve this issue. But anyway:
exec format error means you wanted to execute a file but the format of the file is invalid, incorrect, corrupted or just incompatible with the current environment. Probably this helps: https://ostechnix.com/fix-exec-forma...parts-command/
I don't think so. If you give us more details we can better help you to solve this issue. But anyway:
exec format error means you wanted to execute a file but the format of the file is invalid, incorrect, corrupted or just incompatible with the current environment. Probably this helps: https://ostechnix.com/fix-exec-forma...parts-command/
The details are just trying commands to remove the package, and fix apt by cleaning or something, pretty much everything I wrote already.
Synaptic says bluez is installed, but trying to remove it from various package managers command line and gui-based, all results in it not being apparently removed.
Is there a way i can remove bluez manually or force an overwriting reinstallation of some kind?
Last edited by bobIsHere244; 02-10-2023 at 11:58 AM.
update: i managed to remove the broken package, and when i restarted my system a bunch of other things are now broken, yay, and now the problem spread to another package, and now dpkg is completely crippled and does not even work anymore.
Code:
user@User-Box:~/Desktop$ sudo dpkg --configure -a
[sudo] password for user:
Setting up initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
/usr/sbin/mkinitramfs: 75: modprobe: Exec format error
/usr/sbin/mkinitramfs: 76: modprobe: Exec format error
/usr/sbin/mkinitramfs: 75: modprobe: Exec format error
/usr/sbin/mkinitramfs: 76: modprobe: Exec format error
^Cdpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess was interrupted
Errors were encountered while processing:
initramfs-tools
is there a rebuild-everything-and-replace-corrupted-files command?
Last edited by bobIsHere244; 02-14-2023 at 10:39 AM.
update: i managed to remove the broken package, and when i restarted my system a bunch of other things are now broken, yay, and now the problem spread to another package, and now dpkg is completely crippled and does not even work anymore.
Code:
user@User-Box:~/Desktop$ sudo dpkg --configure -a
[sudo] password for user:
Setting up initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
/usr/sbin/mkinitramfs: 75: modprobe: Exec format error
/usr/sbin/mkinitramfs: 76: modprobe: Exec format error
/usr/sbin/mkinitramfs: 75: modprobe: Exec format error
/usr/sbin/mkinitramfs: 76: modprobe: Exec format error
^Cdpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess was interrupted
Errors were encountered while processing:
initramfs-tools
is there a rebuild-everything-and-replace-corrupted-files command?
Yes, it is: rebuild-everything-and-replace-corrupted-files-especially-for-you
The easy way is to reinstall the system, but I'm afraid you will corrupt your system just the same way. So would be better to tell us how did you manage to reach this situation.
Probably you installed some incompatible packages. Or ?
Exec format error means your system tried to execute some binaries, but failed because the format of the executable is incompatible (with the current system).
Yes, you can restore the original files, if you know what did you make, what do you need to restore and you have a backup. (this is not a problem with the package manager itself, but you have some useless/corrupted executable files somewhere which are used by modprobe, systemctl and probably other tools too). And probably you destroyed some other files, not only binaries (but config files).
https://www.linuxquestions.org/quest...94#post6411294
is more of the story, which was initially a separate problem, as i thought i was done with the package system being broken, and that the device issues were just a remaining side effect of the battle i had with apt, and that they could be fixed separately and it would all be over.
but then that wasnt fixed so easily, and it became clear the 2 problems were actually just the same one getting worse.
this all happened because i interrupted a python script designed to take a list of packages and install them, because i just went from linux mint 18, to linux mint 20, i had to install new because i wanted to move my os to an ssd instead of hdd.
i saved the list of packages to be installed by the script, so that i can get back up to speed on the new os.
the script got interrupted, not sure why i did that, but it interrupted a "sudo apt install ___" somewhere in the middle of some operation, and then the package bluez got corrupted.
every time i used apt after that, every operation was slowed down by apt trying to fix bluez at the same time.
i tried to remove bluez by force in various ways, and removed and probably purged some other packages that used it, to try and free it from being depended on, these other packages appeared to be other bluetooth systems, i dont even have bluetooth on this machine so i didnt need them anyway.
Edit /var/lib/dpkg/info/srvadmin-hapi.prerm, and insert set -x as the second line (i.e. immediately after the #! line). Editing this script will need to be done as root.
and opted for
Quote:
just insert exit 0 as the second line of the .prerm script.
and it appeared to allow apt to continue past the screwed up point, and it did infact remove the package or atleast appeared to do so.
then i restarted the computer and now theres no sound, mouse and keyboard dont work unless i plug them out and back in, so device management is damaged too, its possible something else was unintentionally removed or damaged, and so now its quite unfixed.
at this point i concluded that something was uninstalled, and i found a list of default packages for linux mint 20, and set the script to install those, so i could undo the damage. it did get stuck on bluez again, so i stopped it, fixed that AGAIN, and continued, then apt got stuck on a diff package, and when i tried to deal with this, i ended up having dpkg get completely stuck on a loop every time i try to use it.
so i think it doesnt help that i dont even know what got damaged or corrupted when apt was interrupted in the first place, and also that even after searching i cant find any kind of debug or verbose mode so dpkg or apt really tells me what its doing in a useful way.
i just wanted to reinstall my old packages, go ahead and laugh at me lmfao.
Last edited by bobIsHere244; 02-14-2023 at 01:28 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.