Skip to content

Instantly share code, notes, and snippets.

@mark-sch
Last active June 19, 2019 15:10
Show Gist options
  • Save mark-sch/ce129f3cd20f49980f3c5af2712b0b34 to your computer and use it in GitHub Desktop.
Save mark-sch/ce129f3cd20f49980f3c5af2712b0b34 to your computer and use it in GitHub Desktop.
Grub2: Set default kernel on CentOS7 while in Ubuntu recovery mode
Server4you customer web login -> Boot into Recvery mode (Ubuntu)
SSH connect and execute on recovery terminal:
> fdisk -l
> mdadm --assemble --scan
> mount /dev/md1 /mnt
> mount /dev/md0 /mnt/boot
> mount -t proc proc /mnt/proc
> mount -t sysfs sys /mnt/sys
> mount -o bind /dev /mnt/dev
> mount -t devpts pts /mnt/dev/pts/
> chroot /mnt
Now the Grub2 maintenance commands can be applied to CentOS:
> awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
> grub2-editenv list
> grub2-set-default 2
> vim /etc/default/grub
> grub2-mkconfig -o /boot/grub2/grub.cfg
Alternatively:
> yum list kernel
> yum remove kernel-3.10.0-693.17.1.el7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment