News, tips, advice, support for Windows, Office, PCs & more. Tech help. No bull. We're community supported by donations from our Plus Members, and proud of it
Home icon Home icon Home icon Email icon RSS icon
  • Moving to the 5.4 kernel stack in Ubuntu 18.04 derivatives (like Mint 19)

    Posted on Ascaris Comment on the AskWoody Lounge

    Home Forums AskWoody support Non-Windows operating systems Linux – all distros Moving to the 5.4 kernel stack in Ubuntu 18.04 derivatives (like Mint 19)

    • This topic has 3 replies, 1 voice, and was last updated 1 month ago.
    Viewing 1 reply thread
    • Author
      Posts
      • #2266721 Reply
        Ascaris
        AskWoody_MVP

        Ubuntu 18.04 initially came with the 4.15 kernel, and since 4.15 is an Ubuntu LTS kernel, it’s still updated. New features, and new support for different processor architectures, keep getting added to newer releases of the kernel, and that means that over time, the 4.15 kernel will get further and further out of date for brand-new hardware, and there have also been some great improvements in disk performance scheduling that you’d miss with the older kernel.

        Right now, the newest kernel offered for 18.04 by Ubuntu is 5.3, and that can easily be installed by installing the hwe (hardware enablement) stack. Once that’s installed, you will automatically be sent each new kernel as it is released.

        There is a newer Ubuntu kernel, though, and that’s the 5.4 LTS kernel that comes with Ubuntu 20.04 Focal Fossa.  It’s not currently offered for Ubuntu 18.04 and derivative distros, but you can easily fix that.

        It would be possible to download the files needed to install the currently released 5.4 kernel from the Ubuntu repo website and install that, but it wouldn’t be kept up to date.  The updates for 5.4 come from the 20.04 focal repository, so if you want the kernels to update, you will need that repo.  If you just added that repo and did nothing else, you’d get hundreds of files trying to update from their 18.04 versions to the 20.04 versions, in effect trying to upgrade your whole PC to 20.04.

        If you want to upgrade from 18.04 to 20.04 and you’re using an actual Ubuntu release, they have a procedure for that which makes it easy.  If you’re using an Ubuntu derivative like Mint or Neon, it would be best to wait for the distro you use to adopt the new 20.04 LTS base. Just adding the 20.04 repo and letting ‘er rip could mess things up pretty spectacularly. Or maybe it will work… I don’t know. My bet is on it being screwed up by dependency issues, though.

        In order to get the kernel to update from the 20.04 repo but not anything else, we will need to create a configuration file to tell APT, the package manager, what we want it to do.

        If you navigate, using the file manager of your choice, to /etc/apt/preferences.d/, you will need to create a text file in there. In KDE Plasma, you can just copy and paste the below lines into the text editor and save it to /etc/apt/preferences.d, and the editor will automatically ask to elevate to superuser privileges. Other distros, like Mint, would say “access denied,” so in that case, you could navigate to that folder, then right-click the background and select “Open as root.” Enter the password, then it will start a root copy of the file manager.  You can then right click the background and tell it to create a new text file.

        The filename I used is 99-focal-kernel, in the normal UNIX way of using numbers at the start of the filename to establish priority, but I am not sure it matters in this instance.  Into the text file, copy and paste this:

        Package: *
        Pin: release v=20.04
        Pin-Priority: 1

        Package: linux-generic*
        Pin: release v=20.04
        Pin-Priority: 1100

        Package: linux-image-generic*
        Pin: release v=20.04
        Pin-Priority: 1100

        Package: linux-headers-generic*
        Pin: release v=20.04
        Pin-Priority: 1100

        Then save the file.

        That won’t accomplish anything by itself, but I will explain what the stuff means. You should not blindly accept any code that a person on the internet suggests if you don’t know what it does!

        The first entry (each entry being three lines) sets all files in the version (v) 20.04 to a priority of 1, which is very low. That means that even if you enable the 20.04 repo, it will still take packages from any repo with a higher priority, which would be all of them.  That first entry effectively turns off the 20.04 repo.

        The next three entries create exceptions for the files that make up the kernel stack.  That will assign a priority of 1100 to all of the files listed, making it prefer those above the ones it normally would. Note that the asterisk at the end of each (after ‘generic’) allows each of the entries shown to apply to (for example) linux-generic and linux-generic-hwe-18.04, so whichever stack you have installed, it will upgrade either (or both) to the newer kernel stack from 20.04.

        The final step needed is to add the repository from 20.04. With the 99-focal-kernel file (or whatever you decided to call it) in place, you can now do that and have it only upgrade the three files that are listed, and their dependencies, like the actual kernel release that is current at the moment.

        First, get fully up to date on updates if you’re not already. Make a backup too, whether it be with Timeshift, Veeam, or whatever other program you want to use.  This should be quick and easy, but mistakes do happen, so prepare for that by having a backup first. Timeshift makes it easy, and is already preinstalled if you are using Mint.

        If you know the URL of the closest Ubuntu server or mirror, you can use the graphical tool of your choice to add the repo.  Be sure to set the distro to ‘focal’, and the components to ‘main’.

        If you don’t know that URL, look for a file in /etc/apt called sources.list. If it’s not there, look inside /etc/apt/sources.list.d, and one of the files inside should be the one. What you’re looking for is a line like this:

        deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted

        In my sources.list, it was the fourth line.

        Highlight and copy that, then paste it at the bottom of the file, and change ‘bionic’ to ‘focal’.  You can delete the ‘restricted’, ‘multiverse’, or ‘universe’ bits if you wish (only from your copy-pasted line, nor the original) if they are present. Make sure ‘main’ stays.

        If you want an even newer kernel (still 5.4, but a newer Ubuntu revision of it), one that has not been through the full release process yet, paste the line again, but this time change ‘bionic’ to ‘focal-proposed’ instead.  Having both would allow any dependencies required by the proposed repo to be pulled in correctly.

        If you wanted, you could create a new file in /etc/apt/sources.list.d, then paste the extra bits to that file instead, and it would act the same as if you added the text to another file in that directory or to the sources.list file itself.

        If you’re using Neon, there might be a file in /etc/apt/preferences.d called 99-xenial-overrides. That file can make the system upgrade a few files that were not intended, so to prevent that, load the file into the text editor, and search-replace o=Ubuntu with o=Ubuntu v=18.04, then save.

        Once that’s done, you can have your updater look for new updates. Don’t just accept what it proposes, though… be sure that it’s not trying to give you a large number of files. If it’s dozens or more of files, don’t proceed. The same goes if it wants to remove a bunch of stuff.  Something went wrong, and if you continue, things will get messed up.

        If that happens, some troubleshooting will be required.  If you want to leave that for later, I would not advise just leaving it in that state; you might forget that the focal repo is installed, and the next time it wants to install all those extra files, you might let it update things you didn’t want updated.  To prevent that, remove or comment out (put a # before the line in the text editor) the lines you added to sources.list or in any of the files within sources.list.d and save them again, being sure that the save worked and that it didn’t say “access denied’. If you reload the files available again with the package manager or software updater, it should get rid of all of the extra things it was trying to upgrade or remove.

        If all goes well, it should only pull in a few files with names similar to the ones in the stuff you copy-pasted in, just with more stuff added on.  On my Neon, it also wanted to upgrade gcc and some other things… I had already performed a backup, so I let it proceed to see if it would work with those upgrades, and it did.

        If you’re an advanced user, this should be an easy project. If you’re not advanced but you know how to use Timeshift or another program to back up the system files, and you’ve verified that it works, you can proceed with relatively little fear, since you have a way of getting back to where you started. If you’re neither an advanced user nor a backup program user, I would not advise trying this!

        I’ve done this with all three of my Neon installations as well as one test Mint installation, and it worked nicely in all of them.  After this is done, the updater that you use, whichever one that may be, will automatically offer the new updates as they are released.

        If you ever want to undo this and go back to the default setup (which I would advise before a distro upgrade), just use GRUB to boot from the original kernel (either 4.15 or 5.3), then edit the /etc/preferences.d/99-focal-kernel file, or whatever you called it, and remove all but the first three lines, so that the only entry is * with a priority of 1.  Save, then use whatever software update program you use, and tell it to reload or check for updates. It should automatically mark the files that were added for downgrade. Let it proceed if everything looks good, and then you can remove the ‘focal’ entries you added to sources.list or inside sources.list.d. After that, you can remove 99-focal-kernel, or whatever you called it.

        If you use Neon and made the change to 99-xenial-updates, you could revert that also (it won’t change anything for now, but if you ever perform a distro upgrade, the old file being edited might cause it to ask you what to do with it at upgrade time, and that might not be something you know the answer to. The answer would be to use the package maintainer’s version, FWIW!)

         

        Group "L" (KDE Neon User Edition 5.19.3).

        3 users thanked author for this post.
      • #2268750 Reply
        anonymous
        Guest

        I’ll need the Linux Kernel 5.6 for my newest laptop (Ryzen 5 3550H/Radeon RX 560X) or the laptop’s fan will possibly get stuck in quiet mode (low RPM) after boot up and the laptop having to be thermally throttled to a low clock speed.

        So I’m just trying to estimate how long it will take for Linux Mint 20 (Release Scheduled for this month) will progress with Kernel Updates from Kernel 5.4 until 5.6 when that issue with the AMD 3000h series laptop (ASUS) gets fixed and I can dual boot Mint 20/Windows 10.

        • #2268766 Reply
          Ascaris
          AskWoody_MVP

          I’ve been using 5.6 with my Swift on Neon (Ubuntu-based) for a couple of months now.  Ubuntu builds and makes available the mainline kernels (the kernels as released by Linus Torvalds and crew) as soon as they are released, and 5.6 has been stable and quick.

          I know I’ve mentioned that a few times before, but I’ve never seen if you’d mentioned if/why you don’t want to do that.

          I’ve gone back and forth between official 5.4 and 5.6 on the Swift… the battery life seems noticeably better on 5.6, but Veeam (the backup program I use) isn’t compatible with 5.6 yet.  Until a short while ago, I also used 5.6 on my G3 gaming laptop and my desktop too. Now that the Ubuntu 5.4 kernel has finally fixed some issues that were the reason I moved to mainline kernels in the first place, I have gone back to 5.4 on my desktop and G3, while I keep 5.6 on the Swift, as it is the only one I regularly use on battery, and every bit of power savings helps.

          I haven’t found anything that doesn’t work, or that works poorly, as a result of it being a mainline kernel rather than an Ubuntu-modified one.  Veeam has not worked with 5.6, but that’s got nothing to do with it being mainline… it would not work with Ubuntu 5.6 either for the time being, if there was one.  Veeam is just really slow to adapt to new kernels.  So is Ubuntu, for that matter.  The 5.7 kernel was just released yesterday, 5.6 is a mature release, and 5.5 is EOL… and the newest kernel you can get on any Ubuntu is 5.4.  It’s a long-term release from the kernel devs, so for once Ubuntu won’t have to do all of the maintenance themselves, but other distros are using 5.6 now.  It’s really easy to do with Ubuntu too.

          There’s a little program called Ukuu that makes installing mainline kernels easy… unfortunately, its author (Tony George, also the author of Timeshift) has decided to stop developing it as open-source, but the older open-source revisions are still around. That’s what I use to install mainline kernels and to remove unwanted kernels (mainline or Ubuntu).

          It will probably be another 5 months at least before 5.6 or newer makes it to Ubuntu officially.  When a new Ubuntu version is released, it comes with a new kernel, and when it does, you can use a method like what I’ve described in the initial post to install that in your Linux.  Eventually, kernels for newer versions of Ubuntu are backported to the supported LTS editions of Ubuntu as HWE or HWE-edge.

          The next Ubuntu, Groovy Gorilla/20.10, should be out in late October, and the kernel it uses (5.8 perhaps) will presumably find its way back to 20.04 and 18.04 after that (as HWE or HWE-edge).  How long it will take after that is anyone’s guess. The 5.4 kernel still isn’t available officially for 18.04, even though the newest Ubuntu release, the one that uses 5.4, has been out for more than a month.  It could be 2021 before the official Ubuntu channel for 18.04 and derivatives sees 5.6 or newer.

           

          Group "L" (KDE Neon User Edition 5.19.3).

          • #2268997 Reply
            anonymous
            Guest

            But everything that you are talking about is Ubuntu and I’m downstream from that on Mint 19.3 on 4 of my older laptops I’m waiting for the Mint maintainers to get Mint 20 off and running and that’s starting at Mint 20/Kernel 5.4 and I’m not a power Linux User currently so I would have to estimate a Linux Mint  timeline for Linux Mint 20/later getting the Kernel 5.6 offered via the Mint maintainers Update Manager. And really I’m fine with the 4 older laptops staying on Linux Mint 19.3 and I’m only waiting for Linux Kernel 5.6 for the ASUS TUF laptop, my newest laptop that’s currently running Windows 10(1809) Home.

            I can live with My ASUS TUF FX505DY(Ryzen 5 3550H/RX 560X) laptop under Windows 10(1809) Home until at least Nov 2020 and I am fine with that until Linux Mint 20(Releasing sometime in June 2020) begins offering the Kernel 5.6 update with the fix for that laptop’s Fan driver/profile issue. And It may be Mint 20.1 or Mint 20.2 before Kernel 5.6 is offered for Mint 20.

            I do Know that the Kernel for Mint comes via Ubuntu’s mirrors and may try out some Kernel updating outside of the regular channels but I’m just not up to speed with that just yet. And issues with the laptops Western Digital M.2/NVMe SSD and Linux not working with the 256GB WD M.2 NVMe SSD with out this:

            “nvme_core.default_ps_max_latency_us=5500″

            added to the GRUB boot line for that laptop’s WD M.2/NVMe SSD, and really where on the Grub boot line/lines does this go!

            I’m really wishing that the Linux Community starts to take more Notice of AMD’s Ryzen mobile/APU based processors with integrated Vega Graphics and trying to get more resources focused towards not taking more than a year to get the Kernel updated to support AMD’s Ryzen APUs and AMD’s 3000/3000H series APUs where announced/released(late Q1) at CES 2019. But that’s dependent on AMD as well for getting the APU’s driver support up for pulling into the Linux Kernel.

            My particular laptop make/model has had some issues with Linux Kernel laptop deiver support that other laptop makers have avoided having for the most part and WD and their M.2 NVMe drives of that time frame(Q1 2019) have had issues on many makers laptops as far as Linux is concerned. I’m really considering getting a Samsung M.2 NVMe SSD to replace that laptop’s WD M.2 MVMe SSD(256GB) and getting a larger capacity Samsung 500GB M.2/NVMe SSD and moving everything onto that drive for a Windows 10(1809) home/Linux Mint 20 dual boot configuration.

            I am seeing this as well:

            GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nvme_core.default_ps_max_latency_us=5500”

            And it’s discussed on some other websites as far as that NVMe power state latency issue is concerned on the WD, and apparently other makers M.2 NVMe drives from about 3 years ago.

            So in your experience how long does is usually take for any Ubuntu Linux Kernel update to filter downstream into the Mint maintainers update offerings and I’m looking at the time between when latest Ubuntu LTS edition becomes available and that makes it’s way downstream via a new Linux Mint version offering and trying to figure out an ETA for when the Mint maintainers will begin offering Linux Kernel 5.6, And Ill be waiting until that Kernel 5.6 is available before downloading any Mint 20/later ISO and creating a Live USB drive to test that first before doing an install on that newer ASUS laptop.

            And I could not be happier with how easy it’s been to get Linux Mint 19.3 installed on all my older laptops alongside Windows 7/EOL and I’m keeping 7/EOL around for legacy offline only usage with those 4 older laptop booted into Mint when used for any online/daily usage.

            • #2269913 Reply
              Ascaris
              AskWoody_MVP

              With kernels, everything that applies to a given Ubuntu version also applies directly to derivative distros based on that Ubuntu release.  Mint 19.x is based on Ubuntu 18.04, so anything kernel-related for Mint 19 comes directly from Ubuntu 18.04.  Everything I wrote above applies to Mint as much as it does to Ubuntu 18.04.

              The Mint maintainers have nothing at all to do with the kernels.  That part is straight-up Ubuntu, and comes directly from Ubuntu’s servers.  A great deal of Mint, and any other distro based on Ubuntu, comes directly from the Ubuntu servers.  The bits of Ubuntu that the Mint devs changed will come from the Mint repo, but the rest of it comes directly from the Ubuntu servers, not from the Mint servers.

              And issues with the laptops Western Digital M.2/NVMe SSD and Linux not working with the 256GB WD M.2 NVMe SSD with out this: “nvme_core.default_ps_max_latency_us=5500″ added to the GRUB boot line for that laptop’s WD M.2/NVMe SSD, and really where on the Grub boot line/lines does this go!

              In /etc/default/grub, look for the line that starts with GRUB_CMDLINE_LINUX_DEFAULT.  Copy the nvme_core.default_ps_max_latency_us=5500 bit, without the quotation marks, and paste it in right before the trailing quotation mark in the line that begins with GRUB_CMDLINE_LINUX_DEFAULT.  Be sure to put a space between what was there and the stuff you just pasted in.

              So, if right now the line looks like this:

              GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash"

              you would paste that string in from above, and it would then look like this, the same as the line you also mentioned above:

              GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nvme_core.default_ps_max_latency_us=5500”

              There might also be some more stuff in there, and if there is, you would just do the same thing, pasting the nvme line in at the end.

              After that bit is put in, be sure to do a ‘sudo update-grub’ in the terminal to make the changes apply.

              FWIW, I have a NVMe drive in my G3, and I’ve never had any trouble using it with Linux, and I have never seen that line.  Mine’s a Samsung 970 Evo.

              Now, about the mainline kernels… installing them is really quite easy.

              A mainline kernel is one that comes straight from Linus Torvalds’ development team, but it’s not distributed as an installable binary or a .deb package. Their product is source code, which is used by distros to build installable packages for users of their distros.

              An official Ubuntu kernel is that mainline source code with Ubuntu-specific changes added and compiled into the installable kernel packages that Ubuntu distributes.  The kernel updates move pretty quick, while Ubuntu moves slower, especially with LTS releases like 18.04 and 20.04.

              For people who want them, Ubuntu also takes that source code from the kernel devs and builds it as-is for Ubuntu (and therefore Mint too).  These are installable .deb packages, exactly like the packages that the Mint updater, software manager, and the Synaptic package manager use.  These work just as well in Mint as Ubuntu.

              Installing these mainline kernels is easy if you use Ukuu.  You can get it here:

              https://github.com/teejee2008/ukuu/releases
              The file you’re looking for is

              ukuu-v18.9.1-amd64.deb

              Just download that file and double click it, and it will install just like a .msi file in Windows. Then open the Mint menu (start menu) and type ukuu, and launch it from there.

              It will show you a list of all of the kernels available in the mainline PPA. The newest 5.6 will be the one to get. Just highlight it and press Install, and it will install it. Easy peasy!

              It will use the new kernel at the next boot.  If you have a dual boot setup with Windows, you can use the menu that already comes up to select the old kernel if you want at boot time (under the advanced options for Linux Mint selection).

              Ukuu can also remove kernels.  Just make sure you boot using a kernel you do not want to remove, then start Ukuu and find the one you want to remove, highlight that, then press Remove.

              As far as when 5.6 would be available in Mint… the guesses above about when Ubuntu would get it would apply here.  It probably won’t be 5.6, but a newer version.  When the new version of Ubuntu comes out, it will probably be with 5.8 or so, and that version will be made available sometime after that for the LTS versions of Ubuntu, and therefore also Mint.

               

              Group "L" (KDE Neon User Edition 5.19.3).

    Viewing 1 reply thread

    Please follow the -Lounge Rules- no personal attacks, no swearing, and politics/religion are relegated to the Rants forum.

    Reply To: Moving to the 5.4 kernel stack in Ubuntu 18.04 derivatives (like Mint 19)

    You can use BBCodes to format your content.
    Your account can't use Advanced BBCodes, they will be stripped before saving.