[SOLVED] sudo update-grub is not working correctly for me

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

[SOLVED] sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Thu Mar 21, 2019 9:04 pm

Hi, This may be a bit of a newbie question but I felt that it belonged here, When I run update-grub I get this:

Code: Select all

Generating grub configuration file ...
Script `/boot/grub/grub.cfg.new' contains no commands and will do nothing
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
done
and the file grub.cfg.new simply contains this:

Code: Select all

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

That's all it has, I'm on mint 18.3 and unfortunately had a bit of a lapse in judgement a while back and used grub customizer, I know it was stupid and I now have seen the error of my ways (thanks to easy linux tips project), I was thinking that maybe I should just reinstall grub if possible? I'm glad I have skipped the kernel updates or I would have been worse off, at the moment I can boot but I don't trust it in this state, I would like to fix this issue if possible.
I can make timeshift backups if needed and I also just made one last night.
The output of inxi -Fxz: https://pastebin.com/raw/nB78ExLp
Thanks & Regards
V1T4MiN
Last edited by V1T4MiN_ on Wed Apr 17, 2019 3:45 pm, edited 1 time in total.

User avatar
Valsodar
Level 4
Level 4
Posts: 226
Joined: Thu Jul 19, 2018 11:30 pm
Location: Sofia, Bulgaria
Contact:

Re: sudo update-grub is not working correctly for me

Post by Valsodar » Thu Mar 21, 2019 9:07 pm

IDK what exactly you've done to grub but here's the right way to fix it:
https://howtoubuntu.org/how-to-repair-r ... tu-live-cd

And if you're gonna use grub-customizer, use version 5.0.6. This is the only version that works best with Mint 18.3 without causing any errors.
AsRock B85M Pro4, Core i3-4170, Palit GTX 1050 Ti 4GB, Corsair CX750 PSU, Corsair 32GB DDR3-1600, Corsair Force LE 120GB, WD Caviar Blue + Green = 1.5TB, Firefox 65+ x64, 5.0.13-arch1-1-ARCH Cinnamon

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Thu Mar 21, 2019 9:21 pm

Wow, first off thanks for the fast response! That looks a bit too complex for my skill level, Is that the only way to fix grub? I can boot into my mint 18.3 system, Is there a safer way to fix it from inside mint?
Regards V1T4MiN

User avatar
kevin987
Level 4
Level 4
Posts: 346
Joined: Fri Dec 11, 2015 12:35 pm

Re: sudo update-grub is not working correctly for me

Post by kevin987 » Thu Mar 21, 2019 9:45 pm

V1T4MiN_ wrote:
Thu Mar 21, 2019 9:21 pm
Wow, first off thanks for the fast response! That looks a bit too complex for my skill level, Is that the only way to fix grub? I can boot into my mint 18.3 system, Is there a safer way to fix it from inside mint?
Regards V1T4MiN
Since I only have one hard drive, I was able to reinstall Grub without giving drive information or using a mount command.

From Live USB of Mint, open the Terminal.

Code: Select all

sudo apt-get update;

Code: Select all

sudo apt-get install grub

Code: Select all

sudo update-grub
Linux Mint 19.1 (Cinnamon)
LMDE 3 (Cinnamon)
GeckoLinux 150 (Cinnamon)

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Thu Mar 21, 2019 9:59 pm

Just to confirm before I try any of these fixes, I cannot just do this?
From help.ubuntu.com Reinstalling GRUB 2 from a Working System

If Ubuntu is operating normally, boot into the working installation and run the following command from a terminal.

X is the drive (letter) on which you want GRUB to write the boot information. Normally users should not include a partition number, which would produce an error message as the command would attempt to write the information to a partition.

sudo grub-install /dev/sdX # Example: sudo grub-install /dev/sda

This will rewrite the MBR information to point to the current installation and rewrite some GRUB 2 files (which are already working). Since it isn't done during execution of the previous command, running sudo update-grub after the install will ensure GRUB 2's menu is up-to-date.
Or

Code: Select all

sudo apt purge grub-pc grub-pc-bin grub2-common grub-common 
&& sudo apt install grub-pc grub-pc-bin grub2-common grub-common
I'm sorry if It seems I'm being difficult, But I'm just a little scared that I will break grub/mint and I want to make sure I'm using the safest and most full-proof solution possible.
Oh and just in case it matters I do have a small Windows 7 partition on my drive.
Thanks & Regards V1T4MiN

User avatar
Pierre
Level 18
Level 18
Posts: 8783
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: sudo update-grub is not working correctly for me

Post by Pierre » Thu Mar 21, 2019 10:28 pm

that method from Ubuntu, should pull in the original Grub Loader Menu from the location,
that is being specified, by that command line.
https://community.linuxmint.com/tutorial/view/245
would be similar to that method, but using an Live media, instead.

whereas the method from kevin987, may be re-using the Modified grub version, still.
- - try both ways & see which one, will restore the older version, which should still exist.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Thu Mar 21, 2019 10:33 pm

Hmmm, I ran the command from ubuntu help and it still has the same issue, should I try one of the other ideas, it may be outside my comfort zone but I can do it :)
Regards V1T4MiN

User avatar
Pierre
Level 18
Level 18
Posts: 8783
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: sudo update-grub is not working correctly for me

Post by Pierre » Thu Mar 21, 2019 10:39 pm

this method from Ubuntu:
https://howtoubuntu.org/how-to-repair-r ... tu-live-cd
should be similar to this method from LinuxMint:
https://community.linuxmint.com/tutorial/view/245

but, the main differences, would be in where, they are pulling the original file from.
& the example from the LinuxMint Community Site, may be the easier example, to follow.

this shouldn't be above-your-pay-grade, but it's also not an "job for an expert", either.
NB: the newly restored, Grub Menu - should also include that win-7, as well.
8)
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.

pbear
Level 6
Level 6
Posts: 1441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: sudo update-grub is not working correctly for me

Post by pbear » Fri Mar 22, 2019 11:20 am

V1T4MiN_ wrote:
Thu Mar 21, 2019 10:33 pm
Hmmm, I ran the command from ubuntu help and it still has the same issue, should I try one of the other ideas, it may be outside my comfort zone but I can do it :)
Haven't had to do any of this stuff (yet, knock wood), but have been researching Grub recently because I want to be prepared. Frankly, I think you're to the point of having to escalate to purge-and-reinstall. This is on the same Ubuntu Help page as you used already, a little further down. By my reading and what I would do in your circumstances, open Terminal and run each of these commands, one line at a time:

Code: Select all

sudo apt-get update
sudo apt-get purge grub-common
sudo apt-get install grub-pc
See the Help page for tips and more info. Notice this is somewhat different from the purge script you posted above, but you didn't indicate whence that came. Whereas this script comes from a trusted source, so it's what I would use if I were in your shoes.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Fri Mar 22, 2019 11:49 am

Yeah, I honestly don't remember where it came from, it was in my clipboard for whatever reason, I will try these ideas, thanks!
Regards V1T4MiN

User avatar
Valsodar
Level 4
Level 4
Posts: 226
Joined: Thu Jul 19, 2018 11:30 pm
Location: Sofia, Bulgaria
Contact:

Re: sudo update-grub is not working correctly for me

Post by Valsodar » Fri Mar 22, 2019 1:21 pm

V1T4MiN_ wrote:
Thu Mar 21, 2019 9:21 pm
Wow, first off thanks for the fast response! That looks a bit too complex for my skill level, Is that the only way to fix grub?
It's not hard at all. Once upon a time I used to think that too but after the first time I tried it, I changed my mind. It only looks hard and complex but it's not. ;)
AsRock B85M Pro4, Core i3-4170, Palit GTX 1050 Ti 4GB, Corsair CX750 PSU, Corsair 32GB DDR3-1600, Corsair Force LE 120GB, WD Caviar Blue + Green = 1.5TB, Firefox 65+ x64, 5.0.13-arch1-1-ARCH Cinnamon

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Fri Mar 22, 2019 1:26 pm

Oh alright, That does seem to be a Linux thing ¯\_(ツ)_/¯
Thanks & Regards V1T4MiN

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Fri Mar 22, 2019 8:48 pm

Hey, Just a bit of an update, I will have to wait for a few weeks to try these ideas as I currently have an important project that needs my main system, So I can't risk not being able to boot into my main system until that project is done, I will just wait to update my kernel for a bit.
Thanks all and cheers for now, I will update this thread in a few weeks when I try to fix grub :D
Regards V1T4MiN

User avatar
catweazel
Level 18
Level 18
Posts: 8936
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: sudo update-grub is not working correctly for me

Post by catweazel » Fri Mar 22, 2019 8:51 pm

V1T4MiN_ wrote:
Thu Mar 21, 2019 9:21 pm
That looks a bit too complex for my skill level
I don't see why it should be. While the commands might look daunting, the only thing you have to work out is the replacement values for /dev/sdXY and /dev/sdX.
¡uʍop ǝpısdn sı buıɥʇʎɹǝʌǝ os ɐıןɐɹʇsnɐ ɯoɹɟ ɯ,ı

hcentaur13
Level 4
Level 4
Posts: 463
Joined: Sat May 18, 2013 5:13 pm

Re: sudo update-grub is not working correctly for me

Post by hcentaur13 » Sat Mar 23, 2019 6:46 am

To be correct, you needs only 2 commands:
sudo grub-install
sudo update-grub

copy and paste! Don't type. The commands above are miserably faulty!
grub-install will replace the currently grub.
update-grub will insert the options to boot other OSes installed on that PC.
PC grub is ONLY for compatoble ionstallation - it will fail on UEFI that has no MBR but a boot partition.

When you can't boot your installed system:
Use the live system and burn supergrub onto a stick.

When yor system is up and running you can install the UEFI-bootmanager named rEfind from launchpad and install it. It will find any installed system even when windows or others have destroyed partially the UEFI bootmenu. With this you can easy boot your linux and rebuild your grub from there.

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Tue Apr 16, 2019 9:17 pm

Hello, I finished the previously mentioned project and I made an interesting discovery, update-grub is still not working, but the issues with the delayed key presses and input issues have been solved, It was my keyboard, I'm now back to using my old SteelSeries Apex 100, The bad keyboard was the "Gaming Keyboard" from my local Lidl I bought about a year ago, I will be returning it under warranty, My "Gaming" mouse and headphones are still working correctly though so I will be holding on to those, As for fixing grub's configs, I went to an internet cafe and downloaded "boot-repair-disk" as per the Ubuntu wiki article, I will try to repair grub from the live USB I flashed after I finish typing this, Thanks for being patient with me :)

EDIT/UPDATE: I'm now thoroughly confused, I tried the boot-repair-disk, The only helpful thing it did was teach me how chroot works to an extent, besides that it kind of falls short, in fact, it is just a wizard that tells you to copy and paste commands, that only made things worse might I add, My windows partition was no longer bootable, On the bright side I got to see how well Timeshift works, Brilliant piece of software, But the thing that is worrying is that my old reliable keyboard will not input anything until mint boots, the same kind of issue that my other keyboard was having if you think about it, Now I need to figure out why my computer is having I/O issues on cold boot?
Send help
Regards V1T4MiN

pbear
Level 6
Level 6
Posts: 1441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: sudo update-grub is not working correctly for me

Post by pbear » Wed Apr 17, 2019 1:18 am

Go back and read the Ubuntu Help article I linked above. Bear in mind you got into this mess by using Grub Customizer. I'm not sure, as I've not had this scenario, but my hunch is that you need to clear out the config files, for which my further hunch is that purge and reinstall is the right answer.

As we say in Linux Land, no warranties whatsoever. All I can say is that this is what I'd do if I were in your shoes. Good luck.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: [SOLVED] sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Wed Apr 17, 2019 3:50 pm

Yay! It's now working perfectly! sudo update-grub works like a charm and it even applied my custom background automatically! :D
Thanks to all of you! And thank you pbear, The command line fix was what did the trick, I apologize as I know I made this harder than it had to be by being overly cautious, I get a little skittish when it comes to bootloader troubleshooting.
Thanks again :D

Cheers V1T4MiN

pbear
Level 6
Level 6
Posts: 1441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: [SOLVED] sudo update-grub is not working correctly for me

Post by pbear » Thu Apr 18, 2019 12:24 am

Congratulations! And now we know how to recover from Grub Customizer. By the way, for future reference, you used purge-and-reinstall, right?
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

User avatar
V1T4MiN_
Level 2
Level 2
Posts: 71
Joined: Wed Oct 31, 2018 6:41 pm
Location: Earth

Re: [SOLVED] sudo update-grub is not working correctly for me

Post by V1T4MiN_ » Thu Apr 18, 2019 1:26 am

Yes, Just for clarity this is exactly what I did, I had to add sudo at the top of everything as I was not in a chroot environment, First came:

Code: Select all

sudo apt-get update
Next, I did:

Code: Select all

sudo apt-get purge grub-common
After hitting TAB to select YES on the prompt about removing the bootloader I ran:

Code: Select all

sudo apt-get install grub-pc lupin-support os-prober
That is where I differ from the article from help.ubuntu.com, I also reinstalled lupin-support & os-prober as I thought they were quite necessary, Then I followed the prompts making sure to chose the hard disk for install, NOT the partition, and Then it was another prompt asking to confirm I think, after that I saw it find my kernels and my windows bootloader, for which it made two entries for, not sure why, After rebooting I ran update-grub just to test and it works like a charm.
I hope this will help future victims of Grub Customizer :D
Please correct me if I have gotten anything wrong :)
Regards V1T4MiN

Post Reply

Return to “Installation & Boot”