9

My system is not dual boot just single OS UBUNTU 16.04. Prior to making the following changes, the Grub screen would not appear at start-up (OK).

After following these steps from How can I hibernate on Ubuntu 16.04? to enable hibernate in the system menu:

  1. Open terminal and enter;

    sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
    
  2. add the lines into the empty file;

    [Re-enable hibernate by default in upower]
    Identity=unix-user:*
    Action=org.freedesktop.upower.hibernate
    ResultActive=yes
    
    [Re-enable hibernate by default in logind]
    Identity=unix-user:*
    Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
    ResultActive=yes
    
  3. ^X then Y to save (a filename was suggested and I accepted without taking note).

  4. Reboot for the changes to take effect.

hibernate now works and appears in the menu (OK) but whenever I reboot I now get a Grub menu at start up with a full 30 second timeout (NOK). I tried playing around with the Grub menu timeout settings but still get the full 30 sec timeout. How do I stop the Grub menu from appearing and reduce my boot time to what it was before I made these changes.

Current Grub settings;

GRUB_DEFAULT="0"
GRUB_HIDDEN_TIMEOUT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="1"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
David Foerster
  • 36,264
  • 56
  • 94
  • 147
MitchB
  • 91
  • 1
    Have you tried according to this link, https://help.ubuntu.com/community/Grub2/Setup#A.2Fetc.2Fdefault.2Fgrub to modify a variable and after that run sudo update-grub – sudodus Oct 23 '17 at 04:22
  • Thanks sudodus, yes I had tried modifying as suggested in the article. I have noticed that the grub menu appears on some boots and not on others, for this reason it seems like a bug. I am going to continue testing to see if I can isolate the circumstances that contribute to this behaviour. – MitchB Oct 25 '17 at 11:45
  • If the grub menu appears on some boots and not on others, it can be caused by a mechanism, that causes it to appear because something went wrong during the previous boot (an emergency setting). – sudodus Oct 25 '17 at 13:54
  • There is a bug report for Ubuntu: https://bugs.launchpad.net/grub/+bug/1475620 and grub bugtracker:https://savannah.gnu.org/bugs/?56603 – Cas May 03 '20 at 12:04

2 Answers2

5

I had a 30s Timeout after hibernating, the undocumented setting GRUB_RECORDFAIL_TIMEOUT worked for me:

GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT

See this Answer for more Details.

  • 1
    This is what I was looking for with this question https://askubuntu.com/questions/1090266/grub-alternating-between-configurations – Stewart Nov 14 '18 at 20:41
  • 1
    While this answer superficially solves the problem, it creates other problems. See my answer. – ysalmon Apr 29 '20 at 19:01
3

I am sorry to downvote the other answer, but the advice there given is unsound as it will change the timeout for when booting failed (due to hardware outage or whatever).

Grub has a special file where it records whether the last boot succeeded or not : initially it records the boot as having failed using a recordfail bit, and the main OS removes that bit when it takes over. That way, if booting failed, on next boot, Grub can detect that its recordfail is still present and give the user more time to check what happens.

But when thawing from hibernation, the OS does not remove that bit. So we have to tell it to by writing a script. A solution would be to put a file /lib/systemd/system-sleep/10_grub with content :

#!/bin/sh

case $1 in post) grub-editenv - unset recordfail ;; esac

Then make it executable with sudo chmod +x 10_grub

Another way is to use a systemd service, as explained there.

ysalmon
  • 200