GrubHack grub2 boot screen config

So you have written that new, must have program. Let us see it here.
Post Reply
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

GrubHack grub2 boot screen config

Post by BruceSteers »

GrubHack by Bruce Steers

This is a simple app i made because i like to experiment with
operating systems and am often effecting my grub2 menu and wishing
to edit it easily, or change the default boot disk etc.

It reads the /boot/grub/grub.cfg file and lists all the menu entries

it allows you to re-order the items
delete entries
edit menu text
change menu timeout
set default menu entry

it also has options for...
running update-grub to do an OS probe and rebuild a new grub.cfg file
running grub-install to install the grub2 bootloader to a chosen disk
running "fdisk -l" to list all disk drives (i plan to make this an internal function)

It can also modify some things in the /etc/default/grub file
Set default resolution for the grub boot screen
Set the background image.
If chosen background image does not show on boot it's likely an incompatible format.
So theres a 'Convert' option that will convert it to a 1024x768 .png image and
save it in /usr/share/backgrounds/Edits/ (this has so far worked on every image i've
tried it with that initially would not show)

Note. MUST be run from a terminal/shell as root initially to configure pkexec if you have not
configured pkexec yourself to allow the Gambas runtime 'gbr3', after that you can
create menu items / launchers or just double click the application file, but not before.

Usage:
At launch it reads the grub configuration file and lists the menu items, finds the default and
the timeout.
Menu entries can be deleted, moved up or down and the default can be set. As can the Timeout.
Operation/buttons are self explainitory.


TO SAVE CHANGES YOU MUST RUN THIS PROGRAM AS ROOT

Disclaimer..
This program works fine as is and has for me for 9 years when it was only a Gambas2 app
but if the grub configuration format has a major change it may stop functioning as
expected and could cause boot faliure.
In the 9 years I've been using it the only format change i had to deal with was the Timeout time
setting moved somewhere else and the one i was setting didn't change it anymore. no big problem
and was soon resolved.
GrubHack-qt.zip
updated , changed from gtk to qt to stop layout errors
Last edited by BruceSteers on Friday 18th September 2020 1:07am, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
PJBlack
Posts: 184
Joined: Tuesday 9th June 2020 10:26pm
Location: Florstadt, Hessen, Germany

Re: GrubHack grub2 boot screen config

Post by PJBlack »

really nice that one ... but so much buggy ...

$ sudo gbr3 GrubHack.gambas
[sudo] Passwort für **********:

(GrubHack.gambas:4500): Pango-WARNING **: 01:16:28.365: pango_layout_set_markup_with_accel: Fehler in Zeile 2, Zeichen 29: Element »markup« wurde geschlossen, aber das derzeit offene Element ist »i«

(GrubHack.gambas:4500): Pango-WARNING **: 01:16:28.498: pango_layout_set_markup_with_accel: Fehler in Zeile 2, Zeichen 29: Element »markup« wurde geschlossen, aber das derzeit offene Element ist »i«

(GrubHack.gambas:4500): Pango-WARNING **: 01:17:01.709: pango_layout_set_markup_with_accel: Fehler in Zeile 2, Zeichen 29: Element »markup« wurde geschlossen, aber das derzeit offene Element ist »i«
FMain.?.0: #13: Null object
FMain.?.0 FMain.?.0
FMain.?.0: #13: Null object
FMain.?.0 FMain.?.0
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: GrubHack grub2 boot screen config

Post by BruceSteers »

PJBlack wrote: Thursday 17th September 2020 11:19pm really nice that one ... but so much buggy ...
aah those gtk layout errors eh.
The Pango errors are gtk bugs more than my app and out of my hands.
Here's a qt version that doesn't do that.

As for the other FMain erorrs i'm not sure, i could not produce them as you did,
it had compatibility set for gambas 3.8 so i've removed it, it's compiled on 3.12 so will work on 3.12+
Last edited by BruceSteers on Friday 18th September 2020 1:16am, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: GrubHack grub2 boot screen config

Post by BruceSteers »

only error i'm getting now is this..

bonus@bonus-pc:~$ sudo /media/bonus/Elements/LinuxStuff/GrubHack/GrubHack.gambas
[sudo] password for bonus:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
bonus@bonus-pc:~$

I think thats my linux config though not the app
If at first you don't succeed , try doing something differently.
BruceS
User avatar
PJBlack
Posts: 184
Joined: Tuesday 9th June 2020 10:26pm
Location: Florstadt, Hessen, Germany

Re: GrubHack grub2 boot screen config

Post by PJBlack »

ok ... i'm also getting this

$ sudo gbr3 GrubHack.gambas
[sudo] Passwort für ***:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root
'

but i'm also getting this
GrubHack Error.png
GrubHack Error.png (12.8 KiB) Viewed 5796 times
and after OK getting blank menu entries
GrubHack Error 2.png
GrubHack Error 2.png (26.34 KiB) Viewed 5796 times
and ... trying to convert a background png gets me this

libpng warning: keyword "EPSON Standard RGB - Gamma 1.8": bad character '0x20'
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: GrubHack grub2 boot screen config

Post by BruceSteers »

Right.. lol

Firstly thank you for the bug reports , please don't let my "Grrrr ffs!!" attitude seemed aimed at you in any way, that's just me venting lol.

I've gone back to gtk as the layout looked better than with qt.
Have got rid of the Pango error messages (buggyness) from gtk. How?
I loaded up my other linux and compiled the App on Gambas 3.15 :-\ that's all it took. compiling on a newer gambas, no code/layout changes but the warning messages have now gone. (so i'm blaming those bugs on Gambas ;) )

The error you were getting on load seemed to be i was giving an Integer a string value, but for some strange reason errors on your machine but on mine worked okay :-\ Well i added a Val() command to properly set the Integer. Hopefully should fix.
(Blame that one on me ;) )

As for the converting error, again not sure what that's about as the routine failing is taking the image from a PictureBox control and using the Image.Save(path) , The error you were getting 0x20 sounds like it's complaining about the Spaces in the filename. A file path shouldn't need quoting when used that way) i just tried using Quote(path) and it didn't like it. Maybe it will work better now i've compiled with 3.15?

I have just tested the convert command on a file with spaces in the name with no problems.

Question..
Have you hand-customised your grub.conf file in any way?
This could possibly cause an issue
Many thanks :)
Bruce
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: GrubHack grub2 boot screen config

Post by BruceSteers »

I've made a big layout change to this.
I've removed the ScrollView on the 2nd TabStip and put the image stuff on a different tab.
Now it doesn't give any layout warnings even if compiled on 3.12.

I also added my MakeIcon module to it and gave it a make desktop icon or menu item buttons (on the About page)

Curious to know if you got it to work PJBlack ?
If not i'd be curious to know why. maybe send me your grub.conf file?
If at first you don't succeed , try doing something differently.
BruceS
Post Reply