Announcement

Collapse
No announcement yet.

WARNING! Kernel 3.8.3 and above have become paranoid about writing to NVRAM

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    WARNING! Kernel 3.8.3 and above have become paranoid about writing to NVRAM

    Note (2014-01-03):
    The problem described in this thread was fixed during the kernel 3.10 development cycle and has been backported to older supported Ubuntu kernels.




    On one of my spare laptops I've been fiddling with some UEFI stuff on other distributions. I began to notice a major problem: attempts to write to the NVRAM would silently fail. In the worst case scenario, this renders a machine unbootable. It's easy enough to recover -- boot with some kind of live USB and run efibootmgr. But what was really going on?

    A pattern began to emerge: after any updates to a 3.8 series kernel, writes to NVRAM would fail. Booting a USB with an older kernel allowed me create the NVRAM variable that otherwise wouldn't get created.

    I filed a bug against efibootmgr, thinking the problem was with that utility. Then I started Googling a bit, and noticed posts on the forums for Arch, openSUSE, and others. Eventually I found some Launchpad bugs. Turns out the problem actually is with the kernel. See comment #7 in Launchpad Bug 1167622. A commit to the kernel increases paranoia:

    efi: be more paranoid about available space when creating variables

    UEFI variables are typically stored in flash. For various reasons, avaiable
    space is typically not reclaimed immediately upon the deletion of a
    variable - instead, the system will garbage collect during initialisation
    after a reboot.

    Some systems appear to handle this garbage collection extremely poorly,
    failing if more than 50% of the system flash is in use. This can result in
    the machine refusing to boot. The safest thing to do for the moment is to
    forbid writes if they'd end up using more than half of the storage space.
    We can make this more finegrained later if we come up with a method for
    identifying the broken machines.

    Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
    Cc: Josh Boyer <jwboyer@redhat.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Matt Fleming <matt.fleming@intel.com>
    This change is to workaround the buggy Samsung UEFIs that would brick themselves if the NVRAM storage space became more than 50% full.

    So we have a kernel commit to protect a crappy UEFI implementation that ends up borking proper UEFI behavior for everybody. Great. I hope this commit gets reverted sometime.

    Lesson: if you have a UEFI machine, and you like to run the latest kernels, remember to keep a 3.7 kernel around. You'll need this whenever you want to modify your UEFI NVRAM variables.
    Last edited by SteveRiley; Jan 03, 2014, 09:17 PM.

    #2
    Steve, I would strongly encourage you to write to Linus about this. He does control the kernel, and this observation deserves the highest visibility.
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Just found this.

      http://thread.gmane.org/gmane.linux.kernel.efi/1081

      Looks like some work is being done to properly determine the true remaining space, which works around the garbage collection issue.

      Comment


        #4
        Cool.
        Using Kubuntu Linux since March 23, 2007
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Update

          Launchpad bug 1173423 is now the primary bug tracking this problem, and all others have been marked as duplicates.

          Also, folks on the Kubuntu-users mail list have run into the same problem. Here's a recent thread, along with my reply. You'll note that one proposed workaround was to boot the computer into BIOS emulation mode, perform the *buntu install, and then return to UEFI mode. That's really not a decent solution, as you'll see when you read my reply.

          > > I tried several times to install Kubuntu 13.04 64Bit on my desktop
          > > but it always fails on UEFI Grub installation?
          > >
          > > I boot from a DVD with Kubuntu 13.04 64Bit installation installed.
          > > Everything seems to work until the end where it crashes on UEFI Grub
          > > installation?
          > > (I thought UEFI BIOS was better supported by new 13.04?)
          > >
          > > Anyone know how to get this working on above desktop?
          >
          >
          > Try setting the BIOS to "Legacy" boot options instead of "UEFI" for
          > the installation, that should do the trick. At least recent BIOS on
          > Lenovo laptops all have that option (I had to do that yesterday when I
          > reinstalled on an SSD in my laptop) and you can just re-enable it
          > again (setting it to "both") once the installation is done.


          However, that process will leave the installed version of Kubuntu in BIOS emulation mode. It will not boot into UEFI mode.

          Most of the kernels in the 3.8 series have a problem in which they refuse to add UEFI NVRAM variables if the available space is reported to be less than 50%. This is to work around a serious bug in certain implementations that completely break some Samsung laptops.

          http://www.kubuntuforums.net/showthread.php?62470
          https://bugs.launchpad.net/ubuntu/+s...x/+bug/1167622
          https://bugs.launchpad.net/ubuntu/+s...x/+bug/1173423

          As you can tell by reading bug 1167622, commit 68d929862e29a8b52a7f2f2f86a0600423b093cd is the cause of the problem. Kernels built with this commit reverted (http://kernel.ubuntu.com/~jsalisbury/lp1173423/) work fine.

          Commit 31ff2f20d9003e74991d135f56e503fe776c127c is an attempt to get smarter about the 50% space issue. But kernels containing this commit (http://people.canonical.com/~jsalisbury/lp1173423/) are still failing.

          Unfortunately, until this gets fixed in the kernel and the ISOs are updated to include a fixed kernel, UEFI installs are going to break. We have many reports of this on the Kubuntu forum.
          Kubuntu team is tracking this bug.

          Comment


            #6
            For those interested... you can read the discussion about this and other UEFI-releated bugs here:

            http://news.gmane.org/gmane.linux.kernel.efi

            Matthew Garrett continues to work on better code that properly detects the true space remaining without being too paranoid or bricking those silly Samsungs.

            ------------------------------------------------------------------

            Temporary known good workaround

            A new kernel parameter: efi_no_storage_paranoia. This effectively tells the kernel not to worry about storage space and revert to pre-3.8.3 behavior. This will be useful for helping people get Kubuntu installed on UEFI machines until such time the bug is permanently fixed and we get an updated ISO.
            Last edited by SteveRiley; Jun 02, 2013, 12:21 PM.

            Comment


              #7
              OK, I got jsalisbuy's 3.8.0-27-generic #40 (lp1203320v1) loaded and I can boot efi into kubuntu.

              I haven't been able to find any info on any of the other mainline kernels have been patched, ie- the mainline 3.10.5 saucy build. I'm scared to try it.
              I do not personally use Kubuntu, but I'm the tech support for my daughter who does.

              Comment


                #8
                Launchpad bug 1173423 has been tracking this. Updated patches are in the Saucy 3.10 kernels, which you can install on Raring just fine. I've asked the folks monitoring the bug whether the patches have been backported to the other Raring kernels.

                Note that you might not run into this problem with an affected kernel if your UEFI NVRAM free space is greater than 50%.

                Comment


                  #9
                  Yay! It worked! Now to (re)setup wine...
                  I do not personally use Kubuntu, but I'm the tech support for my daughter who does.

                  Comment


                    #10
                    Wow, Steve, you'd doing about everything to fix that paranoia bug except writing the code!! (there's no genuflecting icon in the list)
                    That looks like a tough nut to crack considering that the efi vars are not visible at runtime, so the test code can only be in the loader.
                    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                    – John F. Kennedy, February 26, 1962.

                    Comment


                      #11
                      Well, I really like UEFI quite a lot. So if there's anything I can do (short of writing code) that makes it easier for people to learn and use, I'm on it

                      Comment


                        #12
                        The fix has landed in raring-proposed.

                        https://bugs.launchpad.net/ubuntu/+s...x/+bug/1173423

                        I just tested it for Joseph and I can add additional NVRAM variables now without error. The update will move out of -proposed and into raring-updates soon.

                        Comment

                        Working...
                        X