Linux kernel old version

How can I boot with an older kernel version?

The latest kernel is causing problems with my sound, which worked fine with an older version. As I have only Ubuntu installed, Grub is not getting displayed while booting. How can I manually choose my kernel version while booting?

10 Answers 10

The simplest way to display your Grub is to press and hold the SHIFT button while booting.

As an alternative, you can always display Grub without it booting any particular kernel:

gksudo gedit /etc/default/grub 

change GRUB_TIMEOUT to -1 and comment out GRUB_HIDDEN_TIMEOUT

Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. I commented GRUB_HIDDEN_TIMEOUT and set GRUB_TIMEOUT=0

Mmm, looks like GRUB_HIDDEN_TIMEOUT doesn’t seem to exist anymore on 2.04-1ubuntu47 . Setting GRUB_TIMEOUT=-1 works fine.

Holding down the shift key while booting, will display the Grub menu. You can now select an older kernel version.

For selecting an older kernel as the default kernel, please see this post

what if the older kernels are not shown in grub (they were removed)? Does this mean these kernels are not accessible?

If you have a few Kernels in your system you can set manually what Kernel version will start:

GRUB start page

  1. Reboot your PC with pressed Shift button for display GRUB after BIOS will start. You will see something like:
  2. Select «Advanced options for Ubuntu» and memorize index of this menu line(count starts from 0) On the picture index is 1

Select concrete Kernel

  1. Select concrete kernel for boot and also memorize index of this menu line(count starts from 0) On the picture index of chosen Kernel is 2
  2. Start system. This action is for one boot on concrete kernel. If you want to start from concrete Kernel all time you should do next steps:

4.1. Open and edit GRUB setup file:

4.2. Find line GRUB_DEFAULT=. (by default GRUB_DEFAULT=0) and sets in quotes menu path to concrete Kernel(Remember menu indexes from steps 2 and 3). In my system first index was 1 and second was 2. I set in to GRUB_DEFAULT

4.3. Update GRUB information for apply changes:

4.4. After reboot you automatically boot on Kernel by chosen menu path. An example on my machine 1 -> 2

4.5. Check Kernel version after reboot:

I first used GRUB_DEFAULT=»Advanced options for Ubuntu > Ubuntu, with Linux x.x.x-xx-generic» but that didn’t work. Your version with GRUB_DEFAULT=»1>2″ did work! 🙂

Get the currently installed kernel menu entries using below command.

ubuntu:~$ sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '' 0 : menuentry 'Ubuntu, with Linux 5.4.0-80-generic' --class ubuntu 1 : menuentry 'Ubuntu, with Linux 5.4.0-80-generic (recovery mode)' 2 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic' --class ubuntu 3 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic (recovery mode)' 4 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic' --class ubuntu 5 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic (recovery mode)' 

Modify the GRUB_DEFAULT=0 value as per your need.

Читайте также:  Canon lbp 2900 драйвер линукс

currently my server booted with 5.4.0-80-generic

ubuntu:~# uname -srn Linux ubuntu 5.4.0-80-generic 

so i want to boot my system with 4.15.0-45-generic which is menu entry 4

modified GRUB_DEFAULT=»1>4″ value in /etc/default/grub executed below command to regenerate a grub config file with modified GRUB_DEFAULT settings.

rebooted the ubuntu system.

post reboot my ubuntu server booted with old kernel 4.15.0-45-generic

ubuntu:~# uname -srn Linux ubuntu 4.15.0-45-generic 

While booting when GRUB appears with entries select the second entry i.e., Advanced options for Ubuntu there you can see different older kernel versions which was installed previously, you can select one among them which works good for you. Otherwise you go to the grub.cfg and paste your required kernel version on top of currently installed kernel entry. In both ways it works

Please install the previous kernel with the following command:

sudo apt-get install linux-image-3.0.0-12-generic linux-headers-3.0.0-12-generic 

Then reboot. You will be prompted to choose your kernel.

16.04 and later

  1. Immediately after the motherboard / computer manufacturer logo splash screen appears when the computer is booting, with BIOS, quickly press and hold the Shift key, which will bring up the GNU GRUB menu. (If you see the Ubuntu logo, you’ve missed the point where you can enter the GRUB menu.) With UEFI press (perhaps several times) the Esc key to get to the GRUB menu. Sometimes the manufacturer’s splash screen is a part of the Windows bootloader, so when you power up the machine it goes straight to the GRUB screen, and then pressing Shift is unnecessary.
  2. From the GRUB screen select Advanced options for Ubuntu and press Enter .

enter image description here

  1. A new purple screen will appear showing a list of kernels. Use the ↑ and ↓ keys to select which entry is highlighted. Press Enter to boot the selected kernel, ‘e’ to edit commands before booting or ‘c’ for a command line. Press Esc to return to the previous menu.

enter image description here

Prevent Ubuntu from uninstalling an old kernel version

If you have determined that you can successfully boot Ubuntu by using an older kernel version, the next thing to do is to prevent Ubuntu from automatically uninstalling that kernel version by following the instructions in this answer. If you want autoremove to not remove a specific kernel version package, you can mark it as installed manually with a command of the form sudo apt-mark manual package-name . For more information about which Linux kernel packages to mark as manually installed please read the linked answer.

Although the same as this much shorter answer: askubuntu.com/a/584738/307523 Your answer goes much further with screenshots and Shift key to bring up grub in the first place.

GRUB_HIDDEN_TIMEOUT=0

This setting determines how long a screen without the GRUB 2 menu will be displayed. While the screen is blank, the user can press any key to display the menu.

The default behavior is to hide the menu if only one operating system is present. If a user with only Ubuntu wishes to display the menu, place a # symbol at the start of this line to disable the hidden menu feature.

Jackkobec’s Answer describes a method of viewing grub.cfg and scrolling through source code to find a menu number. An easier way is with this script:

Grub Version: 2.02~beta2-36ubuntu3.22 ┌───────────┤ Use arrow, page, home & end keys. Tab toggle option ├────────────┐ │ Menu No. ----------- Menu Name ----------- │ │ │ │ 1>3 Ubuntu, with Linux 4.15.0-55-generic ↑│ │ 1>6 Ubuntu, with Linux 4.15.0-54-generic ▒│ │ 1>9 Ubuntu, with Linux 4.14.134-0414134-generic ▒│ │ 1>12 Ubuntu, with Linux 4.14.120-0414120-generic ▮│ │ 1>15 Ubuntu, with Linux 4.14.114-0414114-generic ▒│ │ 1>18 Ubuntu, with Linux 4.14.110-0414110-generic ▒│ │ 1>21 Ubuntu, with Linux 4.14.98-041498-generic ▒│ │ 1>24 Ubuntu, with Linux 4.14.89-041489-generic ▒│ │ 1>27 Ubuntu, with Linux 4.14.78-041478-generic ▒│ │ 1>30 Ubuntu, with Linux 4.14.70-041470-generic ▒│ │ 1>33 Ubuntu, with Linux 4.4.0-157-generic ▒│ │ 1>36 Ubuntu, with Linux 3.16.60-031660-generic ▒│ │ 1>36 Ubuntu, with Linux 3.16.60-031660-generic ▒│ │ 2 Ubuntu 18.04.1 LTS (18.04) (on /dev/nvme0n1p10) ▒│ │ 3 Advanced options for Ubuntu 18.04.1 LTS (18.04) (on /dev/nvme0n1p10) ▒│ │ 3>0 Ubuntu (on /dev/nvme0n1p10) ↓│ │ │ │ │ │ [Display Grub Boot] Exit │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ 

Note: In this example grub-menu.sh short was used to call the script. The short parameter suppresses these lines:

 │ 1>10 Ubuntu, with Linux 4.14.134-0414134-generic (upstart) ▒│ │ 1>11 Ubuntu, with Linux 4.14.134-0414134-generic (recovery mode) ▒│ 

Control keys

After scrolling through entries (you can use the mouse scroll wheel or arrow keys) press Escape to return to the command line.

Читайте также:  Linux как поменять дистрибутив

If you press Enter the associate grub commands for the entry are displayed:

menuentry 'Ubuntu, with Linux 4.14.134-0414134-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.14.134-0414134-generic-advanced-b40b3925-70ef-447f-923e-1b05467c00e7' < recordfail savedefault load_video gfxmode $linux_gfx_mode insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_gpt insmod ext2 if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root b40b3925-70ef-447f-923e-1b05467c00e7 else search --no-floppy --fs-uuid --set=root b40b3925-70ef-447f-923e-1b05467c00e7 fi echo 'Loading Linux 4.14.134-0414134-generic . ' linux /boot/vmlinuz-4.14.134-0414134-generic root=UUID=b40b3925-70ef-447f-923e-1b05467c00e7 ro noplymouth fastboot acpiphp.disable=1 pcie_aspm=force vt.handoff=7 i915.fastboot=1 nopti nospectre_v2 nospec mem_sleep_default=deep echo 'Loading initial ramdisk . ' initrd /boot/initrd.img-4.14.134-0414134-generic >Press to continue 

Updating grub to boot previous kernel

A set of grub commands exist for each menu entry. The compiled entries are all stored in /boot/grub/grub.cfg file.

In this example we want menu number `1>9> set as the default so we use:

sudo -H gedit /etc/default/grub 

Then save the file and run

Источник

How do I install an old kernel?

I am running an instance of Ubuntu 15.10. I need to install the latest kernel used by Ubuntu 14.10, which I think is 3.16.0-28-generic. Entering sudo apt-get install linux-image-3.16.0-28-generic returns an error message stating that it’s not available and may have been obsoleted or whatever. I think if I add something to sources.list it will be able to get it. But what do I add to it? And before anyone goes on about the troubles this may produce, it doesn’t matter to me.

4 Answers 4

In Ubuntu, use browser to navigate to > http://kernel.ubuntu.com/~kernel-ppa/mainline/ Scroll to the bottom of the list; choose your kernel. Download the following files (xxxxxx will be replaced with numbers indicating the kernel version. Assuming you have a 64bit OS):

linux-headers-xxxxxx-generic-xxxxxx_amd64.deb

linux-headers-xxxxxx_all.deb

linux-image-xxxxxx-generic-xxxxxx_amd64.deb

Move all these files to a folder. cd into it. Install all these packages by running

Читайте также:  Очистить арп таблицу линукс

Choose new kernel from grub menu.

Update: Since its an ubuntu instance you can manually get the links and and use wget to download the packages

I wrote this answer thinking of a ubuntu desktop, in which u will get each entry for each kernel, for a server instance, u can just restart the server then it will boot automatically to latest kernel.. Or u can edit the config for a specific kernel

@Sijin Krishnan Should we manually edit grub menu before reboot to «choose new kernel from grub menu»?

The grub will boot with the latest version of kernel from the installed ones by default.. you only need to touch the config, if you want to boot with any other lower version s.

You will also need to download linux-modules-version_amd64.deb and the order of installation requires that the modules be installed before the kernel image. Tony George manages a private ppa which releases a Ubuntu Kernel Update Utility (ukuu) which looks promising though I was unable to install it on 18.04.2 today. It seems to have been released for other Ubuntu versions and I may attempt to fix the packaging for 18.04.2 on launchpad.

If you know the exact version you want, e.g. 5.4.0-26-generic, just run

sudo apt install linux-image-5.4.0-26-generic 

The dependencies will be installed automatically. Then in the next boot, select it in the grub menu.

For me this installed (in my case) the linux-modules-5.19.0-32-generic package too but I ‘felt’ something in missing (as i usually remove 3 packages when ‘uninstalling’ a kernel). System booted indeed but Xorg/gnome was not running, just tty. I also needed to run sudo apt install linux-modules-extra—yourversion-generic for gnome to work.

If you want the official Ubuntu stock kernel (not a mainline kernel) from an unsupported version, see below.

For differences between Mainline and Stock kernels see https://askubuntu.com/a/91374/555474

I had to install an even older kernel (2.6.32.21-generic) for stock modules to work with a custom kernel. No hardware was working, so I had to download manually.

Here is how to obtain the discontinued kernels manually from http://old-releases.ubuntu.com/ubuntu/

Essentially you will need the kernel’s headers for your processor, common (all) headers, and the kernel image for your processor.

  1. In the steps below, replace x.x.xx-xx with your kernel version and amd64 with your processor type. Note this is for the generic kernel and not using extra features such as PAE.
  2. Go to http://old-releases.ubuntu.com/ubuntu/pool/main/l/linux/ (I believe this lists most if not all the old kernel packages)
  3. In the page CTRL+F find headers-x.x.xx-xx-generic and download the
    1. linux-headers-x.x.xx-xx-generic_x.x.xx-xx.yy_amd64.deb
    2. linux-headers-x.x.xx-xx-generic_x.x.xx-xx.yy_all.deb
    1. linux-image-2.6.32-21-generic_2.6.32-21.32_amd64.deb
    1. sudo dpkg -i *.deb

    Источник

Оцените статью
Adblock
detector