How To: Upgrade your kernel, painlessly.

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
soldier1st

Re: How To: Upgrade your kernel, painlessly.

Post by soldier1st »

TheOne wrote:The new easy way is:

Menu --> Update Manager ---> Edit ---> Preferences ---> Mark everything, including Level 4 and 5

Reload updates and update kernel.
Is that a safe thing to do? i would assume anything over lv 3 was to be avoided unless there is a specific reason to enable them?
User avatar
tdockery97
Level 14
Level 14
Posts: 5058
Joined: Sun Jan 10, 2010 8:54 am
Location: Mt. Angel, Oregon

Re: How To: Upgrade your kernel, painlessly.

Post by tdockery97 »

soldier1st wrote:Is that a safe thing to do? i would assume anything over lv 3 was to be avoided unless there is a specific reason to enable them?
The update levels are there to make it easy for less experienced individuals to keep applications updated while basically leaving the underlying system the same, thus less chance of suffering breakage.

Doing all available updates won't make your pc explode. Everyone (millions) running regular Ubuntu do complete updates all the time. Granted, once in a great while you may have to seek help here if something breaks. Another thing to keep in mind is that when a kernel is updated, the old kernel is still kept in the system, and at the Grub Boot Screen you can "drop back" to the previous kernel if the new one causes problems.
Mint Cinnamon 20.1
thkang

Re: How To: Upgrade your kernel, painlessly.

Post by thkang »

Code: Select all

#!/usr/bin/python
# -*- coding: utf-8 -*-

import urllib2
import collections
import datetime
import lxml.html
import re
import os
import argparse
import subprocess
from pkg_resources import parse_version

arch='amd64'
use_rc_versions=False
kernelurl="http://kernel.ubuntu.com/~kernel-ppa/mainline/"
kinfo=collections.namedtuple('KernelInfo', ['datetime', 'version', 'link'])

def dl_file(url):
    f = urllib2.urlopen(url)
    with open(os.path.basename(url), "wb") as dlf:
        dlf.write(f.read())

def fetch_latest(kernelurl, use_rc_versions):

    r = urllib2.urlopen(kernelurl)
    doc=lxml.html.document_fromstring(r.read())
    content=doc.text_content()

    reg_ex=re.compile(r'v([\d.]+)(-rc[\d]+)?-([^/]+)/(.+?)\s\s')
    d=[]

    for m in (m for m in (reg_ex.match(x) for x in content.split('\n') if x) if m):
        version, isrc, code, date = m.groups()
        if (not use_rc_versions) and isrc: continue
        version = '%s%s' %(version, (isrc or ''))
        date = datetime.datetime.strptime(date, '%d-%b-%Y %H:%M')
        d.append(kinfo(date, parse_version(version), 'v%s-%s/' %(version, code)))
    
    return max(d, key=lambda x:x.version)

def dl_debs(url, arch, no_download):
    r2 = urllib2.urlopen(url)
    doc2=lxml.html.document_fromstring(r2.read())
    content=doc2.text_content()
    reg_ex2=re.compile('linux-(headers|image)-(.+?)_(amd64|i386|all)\.deb')

    for line in content.split('\n'):
        m=reg_ex2.match(line)
        if m:
            if m.group(1)=='headers':
                if m.group(3)=='all':
                    headers_all=m.group(0)
                elif m.group(3)==arch:
                    headers_arch=m.group(0)
            elif m.group(1)=='image' and m.group(3)==arch:
                image_arch=m.group(0)

    for f in [headers_all, headers_arch, image_arch]:
        print 'downloading: %s' %f
        if not no_download:
            dl_file(url+f)
    
    return [headers_all, headers_arch, image_arch]

if __name__ == '__main__':
    
    parser = argparse.ArgumentParser()
    parser.add_argument('-m', '--machine',
                        help="use this kernel machine, default: %s" %arch,
                        action="store",
                        default=arch)

    parser.add_argument('--kernel-ppa-url', 
                        help="where to fetch ubuntu kernels, default: %s" %kernelurl,
                        action="store",
                        default=kernelurl)
    parser.add_argument('--use-rc',
                        help="allow updating to rc versions",
                        action="store_true")
    parser.add_argument('--no-download',
                        help="do not download(list only) files",
                        action="store_true")
    parser.add_argument('--install',
                        help="install the downloaded kernels. note: run with root privileges",
                        action="store_true")

    args=parser.parse_args()
    os.chdir('/tmp')

    latest = fetch_latest(args.kernel_ppa_url, args.use_rc)
    print 'the latest linux kernel version is : \n\t%s\n' %latest.link.strip('/')
    debs=dl_debs(args.kernel_ppa_url + latest.link, args.machine, args.no_download)
    if args.install:
        subprocess.call(['dpkg', '-E', '--install'] + debs)
here's script that automates this:

it just search http://kernel.ubuntu.com/~kernel-ppa/mainline/ for the latest version and downloads it.

you need to specify your cpu machine architecture to run(default is amd64), with -m amd64 or -m i386
with --use-rc flag, you can update to rc versions(release candidates).
you need --install flag, to install the kernels downloaded.
with --no-download flag, it does not download anything.
requires lxml and distribute to run.

save above as 'update-kernel.py'.
then do

Code: Select all

chmod +x update-kernel.py
sudo ./update-kernel.py -m amd64 --use-rc --install
tested on my machine. for now it updates to 3.10.3 / 3.11rc2
styson464

Re: How To: Upgrade your kernel, painlessly.

Post by styson464 »

I upgrade Mint 15 Cinnamon to 3.10 doing the following:

Code: Select all

wget -c kernel.ubuntu.com/~kernel-ppa/mainline/v3.10-saucy/linux-headers-3.10.0-031000_3.10.0-031000.201306301935_all.deb
wget -c kernel.ubuntu.com/~kernel-ppa/mainline/v3.10-saucy/linux-headers-3.10.0-031000-generic_3.10.0-031000.201306301935_amd64.deb
wget -c kernel.ubuntu.com/~kernel-ppa/mainline/v3.10-saucy/linux-image-3.10.0-031000-generic_3.10.0-031000.201306301935_amd64.deb

Code: Select all

sudo dpkg -i *.deb
After I reboot and login, it takes a long time for the desktop to come up and when it finally does the icon theme is different and the GNOME theme looks like some kind of default (very square and blocky) and I cannot use tools such as Display, it just runs then disappears. I cannot change the desktop them so something is broken. I'm upgrading the kernel so I can use my Displaylink USB Video adapter and 3.9+ kernels have support for it. Any ideas?
Lvcoyote

Re: How To: Upgrade your kernel, painlessly.

Post by Lvcoyote »

Just used the method described in the first post and it worked perfectly to update the kernel to 3.12.9 in Mint 16 Cinnamon.
lodhi022

Re: How To: Upgrade your kernel, painlessly.

Post by lodhi022 »

Simple and excellent method :P
Lvcoyote

Re: How To: Upgrade your kernel, painlessly.

Post by Lvcoyote »

I used this method again this morning to update to 3.12.10, no problems again.
charlieg
Level 2
Level 2
Posts: 50
Joined: Tue Dec 31, 2013 8:02 am

Re: How To: Upgrade your kernel, painlessly.

Post by charlieg »

Be warned; with the 3.16 kernel there are issues for laptop users and backlight adjustment. I have to keep rebooting to the 3.13 official mint kernel in order to get my brightness back.

More information: https://bugs.launchpad.net/ubuntu/+sour ... ug/1341108
JeremyB
Level 21
Level 21
Posts: 13724
Joined: Fri Feb 21, 2014 8:17 am

Re: How To: Upgrade your kernel, painlessly.

Post by JeremyB »

With LM 17, updating the kernel to official Ubuntu 14.04/LM 17 kernels is very easy through Mint Update(Update Manager). Click on 'View' and then 'Linux Kernels' and it will display the kernels that are available and installed and all you have to do is click on the install button below the kernel number. If you updated to a 3.15, it will let you uninstall those also
misGnomer

Re: How To: Upgrade your kernel, painlessly.

Post by misGnomer »

Looking after a bunch of Intel systems of last few generations I've for some time downloaded a single copy of latest Liquorix' amd64 kernel release and installed it locally.

The Liquorix guys openly said they don't support Ubuntu (which the non-LMDE ''mainstream' Mint is based on) but only just recently the config changes in their 3.16.5 release broke compatibility with Mint 17 LTS.

It was great as long as it lasted!

Still, the combined Mint 17 + buntu 14.04 LTS userbase is not insignificant and many might benefit from running something newer than 3.13 from early 2014.

I'm now testing waters with manually downloaded kernel (3.17.1) from the Ubuntu kernel-ppa mainline branch (no probs so far) but is there anything that is built specifically for the LTS base?
darvems

Re: How To: Upgrade your kernel, painlessly.

Post by darvems »

Thanks for the Tutorial it worked like a charm :)
lint

Re: How To: Upgrade your kernel, painlessly.

Post by lint »

I'm not sure what kernel I would need or if I should even upgrade or not. I have a 64 bit machine with a duo and 1G of RAM, but running a Mint 17.3 32 bit. :?:
Dr G

Re: How To: Upgrade your kernel, painlessly.

Post by Dr G »

lint wrote:I'm not sure what kernel I would need or if I should even upgrade or not. I have a 64 bit machine with a duo and 1G of RAM, but running a Mint 17.3 32 bit. :?:
The short answer is, if nothing is amiss, you really do not need to change kernels. OTOH, if you're feeling adventuresome, people seem to learn best by trying something new.

IMHO, a far more useful step than changing kernels would be to increase your RAM. :)
lint

Re: How To: Upgrade your kernel, painlessly.

Post by lint »

Dr G wrote:
IMHO, a far more useful step than changing kernels would be to increase your RAM. :)
I'm doing that as well; for about 15 $ with shipping too. So, the 64 bit won't make my machine "powerful" as a friend of mine has claimed? :shock:
Dr G

Re: How To: Upgrade your kernel, painlessly.

Post by Dr G »

lint wrote:
Dr G wrote:
IMHO, a far more useful step than changing kernels would be to increase your RAM. :)
I'm doing that as well; for about 15 $ with shipping too. So, the 64 bit won't make my machine "powerful" as a friend of mine has claimed? :shock:
Powerful? Not really, but that assessment depends upon what you are doing with it. The extra memory should yield a noticeable improvement in the system's responsiveness. If you're adding a *lot* of memory, 64 bit could be a wise additional step. But, I'm guessing you won't be adding that much. :mrgreen:
lint

Re: How To: Upgrade your kernel, painlessly.

Post by lint »

Dr G wrote:
lint wrote:
Dr G wrote:
IMHO, a far more useful step than changing kernels would be to increase your RAM. :)
I'm doing that as well; for about 15 $ with shipping too. So, the 64 bit won't make my machine "powerful" as a friend of mine has claimed? :shock:
Powerful? Not really, but that assessment depends upon what you are doing with it. The extra memory should yield a noticeable improvement in the system's responsiveness. If you're adding a *lot* of memory, 64 bit could be a wise additional step. But, I'm guessing you won't be adding that much. :mrgreen:
You are correct; the 2G RAM stick is the maximum for what I have. I thank you for confirming that the 32 bit is the better option at present.
fruitkiller

Re: How To: Upgrade your kernel, painlessly.

Post by fruitkiller »

Hello Gentlemen,

I have a pretty short question and before I embark on the risky adventure full of cliffs and traps knowns as kernel installation. I use LM 17.3 x64, when I go to the update Manager and click on View then Linux Kernels, the one I am seeing as being loaded is 3.19.0-32. I see there's a lot of guides for installing kernel 3.19.1, 3.19.2, 3.19.3, I've seen this because in the Update Manager, they do not appear after kernel 3.19.0-61, it jumps to kernel 4.2.0-18 and has a dozen more 4.x.x kernels.

So what is one to do (a higher kernel means being able to install higher versions of certain software is my understanding, tell me if I'm wrong). I don't feel safe at jumping from Kernel 3.x.x to version 4 just now, certainly when the system does not seem to want me to particularly do so (not appearing in the updates ever, and I have all 5 levels of updates allowed to appear.

Should I install 3.1, 3.2, 3.3 or these are useless if I can install a version 4 kernel ? Please help this seasoned but not yet professional Linux user :)
User avatar
Moem
Level 22
Level 22
Posts: 16193
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: How To: Upgrade your kernel, painlessly.

Post by Moem »

Good day, madam,
fruitkiller wrote:So what is one to do (a higher kernel means being able to install higher versions of certain software is my understanding, tell me if I'm wrong).
You're wrong. :wink:
Mostly a newer kernel means better hardware support. If all is going well with your machine right now, you do not experience crashes or freezes, and all your hardware is supported, a newer kernel will not bring you any noticeable advantages. If there are no problems to solve, you don't need to upgrade your kernel.
So before you ask: How to upgrade my kernel, the question to ask is: Why to upgrade my kernel.
fruitkiller wrote: the system does not seem to want me to particularly do so (not appearing in the updates ever, and I have all 5 levels of updates allowed to appear.)
From my understanding, and I too may be wrong, in Mint 17.X newer kernels are not shown as an update, no matter which levels you have made visible.

By the way, it's better to start your own thread for a new question. This one is pretty old and part of it is very outdated.
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!
don250r

Re: How To: Upgrade your kernel, painlessly.

Post by don250r »

Here is an old article, that still applies today:

http://www.makeuseof.com/tag/5-reasons- ... nel-linux/
brut2333

Re: How To: Upgrade your kernel, painlessly.

Post by brut2333 »

but it doesnt tell you HOW to do it!!!!
Post Reply

Return to “Tutorials”