PDA

View Full Version : how remove last kernel (4.12.11) from grub2 ?



sajjads24
15th September 2017, 11:18 PM
hi
how remove last kernel (4.12.11) from grub2 on fedora 26 ?

[sajjad@localhost ~]$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
[sudo] password for sajjad:
Sorry, try again.
[sudo] password for sajjad:
Sorry, try again.
[sudo] password for sajjad:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.12.11-300.fc26.x86_64
Found initrd image: /boot/initramfs-4.12.11-300.fc26.x86_64.img
Found linux image: /boot/vmlinuz-4.12.9-300.fc26.x86_64
Found initrd image: /boot/initramfs-4.12.9-300.fc26.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-e34e000cc1014d17921fbc789eb6e65a
Found initrd image: /boot/initramfs-0-rescue-e34e000cc1014d17921fbc789eb6e65a.img
Found Windows 7 on /dev/sda1
done
[sajjad@localhost ~]$ rpm -q kernel
kernel-4.12.9-300.fc26.x86_64
[sajjad@localhost ~]$ su
Password:
[root@localhost sajjad]# dnf remove kernel-4.12.11-300.fc26.x86_64
No match for argument: kernel-4.12.11-300.fc26.x86_64
Error: No packages marked for removal.
[root@localhost sajjad]# uname -r
4.12.9-300.fc26.x86_64
[root@localhost sajjad]# rpm -q kernel
kernel-4.12.9-300.fc26.x86_64
[root@localhost sajjad]# rpm -e kernel-4.12.11-300.fc26.x86_64
error: package kernel-4.12.11-300.fc26.x86_64 is not installed
[root@localhost sajjad]#

how fix grub2 ?

nonamedotc
15th September 2017, 11:36 PM
You can try


dnf remove kernel*4.12.11*

Notice the wildcard. Careful inspect what dnf wants to do before hitting yes!

After this, you can run grub2-mkconfig again (if needed). But, might I ask why you want to remove the latest kernel?

antikythera
15th September 2017, 11:53 PM
if you use dnf to remove the four kernel files related specifically to 4.12.11 then grub will be updated automatically during the cleanup. but proceed with caution.

anyhow, 4.12.12 has been pushed stable so try updating to that if you are experiencing problems with 4.12.11

sajjads24
16th September 2017, 12:51 AM
You can try


dnf remove kernel*4.12.11*

Notice the wildcard. Careful inspect what dnf wants to do before hitting yes!

After this, you can run grub2-mkconfig again (if needed). But, might I ask why you want to remove the latest kernel?


[sajjad@localhost ~]$ su
Password:
[root@localhost sajjad]# dnf remove kernel*4.12.11*
No match for argument: kernel*4.12.11*
Error: No packages marked for removal.
[root@localhost sajjad]#

nonamedotc
16th September 2017, 12:54 AM
ok, what is the output of


rpm -qa | grep -i kernel | sort

sajjads24
16th September 2017, 08:42 AM
fixed with command :

dnf -C remove "kernel*-4.12.11-300.fc26.x86_64"

[sajjad@localhost ~]$ rpm -qa | grep -i kernel | sort
abrt-addon-kerneloops-2.10.3-1.fc26.x86_64
kernel-4.12.9-300.fc26.x86_64
kernel-core-4.12.9-300.fc26.x86_64
kernel-cross-headers-4.12.11-300.fc26.x86_64
kernel-devel-4.12.11-300.fc26.x86_64
kernel-devel-4.12.9-300.fc26.x86_64
kernel-headers-4.12.11-300.fc26.x86_64
kernel-modules-4.12.9-300.fc26.x86_64
kernel-modules-extra-4.12.9-300.fc26.x86_64
kernel-tools-4.12.11-300.fc26.x86_64
kernel-tools-libs-4.12.11-300.fc26.x86_64
libreport-plugin-kerneloops-2.9.1-2.fc26.x86_64
[sajjad@localhost ~]$

dodona
16th September 2017, 09:58 PM
1. rpm -q kernel 2. dnf remove kernel- 3. rm /boot/ 4. vi /boot/grub2/grub.cfg