Ubuntu: Switching from OVH kernel to default kernel without reinstalling Ubuntu



Question:

I have a dedicated server hosted by OVH.

When installing the server I must have left the default choice of kernel which is to use the stable/tested OVH kernel rather than the distribution's native kernel.

I have recently switched to using APF firewall rather than UFW and after setting up APF with all my rules and starting it with apf -s I get an output that looks like this:

apf(11291): {glob} flushing & zeroing chain policies apf(11291):  {glob} firewall offline apf(11328): {glob} activating firewall  libkmod: ERROR ../libkmod/libkmod-module.c:1655  kmod_module_new_from_loaded: could not open /proc/modules: No such  file or directory Error: could not get list of modules: No such file  or directory apf(11368): {glob} kernel version not equal to 2.4.x or  2.6.x, aborting. apf(11328): {glob} firewall initalized  

I changed a setting in APF called MONOKERN which is described as "Support Monolithic kernel builds [no LKM's]" after finding a forum post explaining that this is needed due to the kernel some hosts use.

Restarting APF with apf -r then produced this output:

apf(22524): {glob} flushing & zeroing chain policies apf(22524):  {glob} firewall offline apf(22599): {glob} activating firewall  libkmod: ERROR ../libkmod/libkmod-module.c:1655  kmod_module_new_from_loaded: could not open /proc/modules: No such  file or directory Error: could not get list of modules: No such file  or directory apf(22703): {glob} determined (IFACE_UNTRUSTED) eth0 has  address 158.69.123.46 apf(22703): {glob} loading preroute.rules  //carries on printing out the firewall rules it is setting up...  apf(22599): {glob} firewall initalized  

OVH have said that I can always change the kernel during a re-installation, but I really don't want to do that.

I host a somewhat popular game on my server with around 100 users online at any given time. To take the server offline for a few hours to reinstall the distribution and set everything up again really isn't practical.

Is it possible to switch back to the native distribution kernel for Ubuntu 16.04 without performing a reinstallation, and if so how?


Solution:1

# cd /etc/grub.d  # mv 06_OVHkernel 96_OVHkernel  # update-grub  

It will list the kernels, with the OVH one last. You should have a distribution kernel first, but if you don't, follow @James answer above.

# reboot  


Solution:2

For anyone else who stumbles across this, here's how I solved it:

I ran apt-cache search --names-only linux-image to search available images.

Choosing the most up to date Linux image I ran:

apt-get install linux-image-4.4.0-59-generic  

I then rebooted the server and ran update-grub.

This swapped the kernel out for a general Linux one without losing me any data or requiring a reinstallation.


Solution:3

I did a combination of of the answers of James and Bryan. I had a new ovh machine with Ubuntu 16.04 (currently 16.04.3) and had an ovh kernel 4.9.58.

First installed the latest hwe kernel (rolling stable kernel release for lts) like in this answer https://askubuntu.com/a/944955 which installed Kernel 4.10.0-37-generic

apt install linux-generic-hwe-16.04  

then rebooted (not sure if needed) and then applied the answer from Bryan

cd /etc/grub.d  mv 06_OVHkernel 96_OVHkernel  update-grub  

and rebooted again. Now I have Kernel 4.10.0-37 enabled.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »