~$ sudo apt install git
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
gitweb git-cvs git-mediawiki git-svn
The following packages will be REMOVED:
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
6 not fully installed or removed.
Need to get 0 B/5,464 kB of archives.
After this operation, 28.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database … 285007 files and directories currently installed.)
Removing linux-image-5.8.0-38-generic (5.8.0-38.43~20.04.1) …
update-initramfs: Deleting /boot/initrd.img-5.8.0-38-generic
Generating grub configuration file …
Script `/boot/grub/grub.cfg.new’ contains no commands and will do nothing
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-5.8.0-38-generic (–remove):
installed linux-image-5.8.0-38-generic package post-removal script subprocess r
eturned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
~$ sudo apt install git
It seems like you made some changes to grub.cfg file. Did you? What’s that grub.cfg.new file? Perhaps move it out of the /etc/grub.d directory.
From the looks of it, it seems that you have been messing a lot with your kernel and other files which you should not have.
Perhaps a restart could help but it may also run into issues because of messy grub config file.
I agree with @Abishek - installing git shouldn’t touch anything else…
If this was my system - I’d probably be looking at a re-install of the O/S from scratch… I’m lucky I keep ALL my data in the Cloud… An operating system install is the least of my pain…
The last time I saw anything like this (it wasn’t with “git”) - was when I tried to get an RPi4 to run BOTH arm64 and armhf - installed one package that only had armhf - and apt/dpkg decided I wanted to remove EVERYTHING that was arm64 (that included my kernel)…
Ended up flashing a new image to that SD Card - nobodies got time to trouble shoot stuff like this - you’re in for a world of hurt with no solution in sight mate - sorry - and as for RPi 4 - I’ll keep running armhf until arm64 is mature (anecdotally - I find Raspbian armhf is “snappier” than arm64 on BOTH 4 GB and 8 GB RAM models).
TL;DR : if I was in your shoes, I’d probably bite the bullet and re-install from scratch - maybe boot from an ISO USB and copy your data off onto something else - and re-install the OS…
Indeed was thinking that too, but I did not want to repeat myself…
Also if you need to muck around with the grub file, then watch these videos.
Howto Change Linux Boot Options and Splash Screen - YouTube
Grub Rescue - Complete Re-install of GRUB 2 from Live USB - YouTube
Flush and reload. Keep all data somewhere else. D.M.Tripp is right again.
It seems you’ve edited grub.cfg and replaced with grub.cfg.new. Try grub-install /dev/sdX (X is your hard drive letter) as root. Hope you understand.