Wednesday, August 22, 2018

Upgrade / Remove Ubuntu kernel

* Build kernel from upstream
* reference
   https://wiki.ubuntu.com/KernelTeam/GitKernelBuild

---
git clone https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git/
---
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cp /boot/config-`uname -r` .config
make oldconfig
make clean
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-custom
cd ..
sudo dpkg -i linux-image-xxx-custom_xxx-custom-10.00.Custom_i386.deb
sudo dpkg -i linux-headers-xxx-custom_xxx-custom-10.00.Custom_i386.deb
sudo reboot
---
* trouble shooting
linux$ make oldconfig
/bin/sh: 1: flex: not found
Makefile:557: recipe for target 'oldconfig' failed
---> linux$ sudo apt install flex

/bin/sh: 1: bison: not found
---> linux$ sudo apt install bison
---
* To change default boot kernel
sudo cp /etc/default/grub /etc/default/grub.bak
Look up exact kernel strings
    sudo grub-mkconfig | less

submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-0a503b88-6195-4a3e-8c26-e0e037801d64' {
        menuentry 'Ubuntu, with Linux 5.1.0-poh' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.:

sudo -H gedit /etc/default/grub
Find the line that contains GRUB_DEFAULT
You then combine those two strings with > and set GRUB_DEFAULT to them as:
    from
    GRUB_DEFAULT=0
    to
    GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.1.0-poh"
Save it, then build the updated grub menu.
sudo update-grub
reboot
---
Open the Ubuntu kernel list. Go to http://kernel.ubuntu.com/~kernel-ppa/mainline/

Select a kernel version

Find the kernel for your computer.

Download the kernel files.

v4.18.4 mainline build

These binary packages represent builds of the mainline or stable Linux kernel tree at the commit below:

  v4.18.4 (28b2837b7236a273c2c776c06b7eaca971fc381c)


linux-headers-4.18.0-041800_4.18.0-041800.201808122131_all.deb
linux-headers-4.18.4-041804-generic_4.18.4-041804.201808220230_amd64.deb
linux-image-unsigned-4.18.0-041800-generic_4.18.0-041800.201808122131_amd64.deb
linux-modules-4.18.0-041800-generic_4.18.0-041800.201808122131_amd64.deb

Type sudo dpkg -i *.deb and wait for installation
** Installation order:
1. linux-modules
2. linux-headers
3. linux-headers-generic
4. linux-image
(linux-headers-4.18.4-041804-generic has dependency on linux-headers-4.18.0-041800_4.18.0, hence install linux-headers-4.18.0-041800_4.18.0 before linux-headers-4.18.0-041800_4.18.0-generic)

Verify kernel version: uname -sr

*** trouble shooting
ERROR (dkms apport): kernel package linux-headers -xxxx is not supported
Consult /var/lib/dkms/bcmwl/6.30.223.141+bdcom/build/make.log for more information.
-->
remove bcmwl source and then re-install deps
sudo apt-get purge bcmwl-kernel-source

* appstreamcli abort issue
sudo apt-get purge libappstream3

*
 linux-headers-4.18.4-041804-generic depends on libssl1.1 (>= 1.1.0); however:
  Package libssl1.1 is not installed.
peter$ sudo apt-get install libssl1.1
* If no libssl1.1 found, add "deb http://security.ubuntu.com/ubuntu bionic-security main" to
/etc/apt/sources.list

*  List all kernels excluding the current booted:
dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)
dpkg -l | grep 'linux-image'

* remove old kernel
Using Apt
sudo apt-get autoremove --purge

If you want to purge one specific kernel providing package you can do so via the following command in a terminal:
sudo apt-get purge linux-image-4.12.0-12-generic
sudo dpkg --purge linux-headers-4.12.0-12 linux-headers-4.12.0-12-generic

* another method
sudo apt install byobu
sudo purge-old-kernels

* look up installed kernel sources
$ apt-cache search linux-sourc

* download ubunt sources
** kernel source is supposed to be located under /usr/src/

http://people.canonical.com/~kernel/info/kernel-version-map.html

1. check release name
lsb_release -a
Codename: xenial
2. git clone
git clone http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-xenial.git
git tag -l Ubuntu-*

* manual installation
tar jxf /usr/src/linux-source-3.13.0.tar.bz2

No comments:

Post a Comment