You are not logged in.

#1 2024-06-11 16:18

seb3773
Member
Registered: 2023-11-01
Posts: 146

Add recovery menus to grub

Hello, last week I had to repair a broken ubuntu os, and while I ++really++ dislike ubuntu, there was something I found interesting: the recovery menu. It's a menu you have in recovery mode to allow you to perform some maintenance if needed.
Of course, you can do everything that is proposed in the menu directly in command prompt, but it's more user friendly.

Based on this idea, I decided to write something similar for our Q4os installations ^^
I ended up with two main scripts: one that can be run at emergency target and another at rescue target:
"Emergency target" is, let's say, a minimal root shell mode, whithout base services. This mode allows you to perform operations like fsck the root partition for example; and other let's say "low level" operations because very few processes are launched at this stage (that's why it's the 'emergency' target, it have more chances to work even if the system is partially damaged).
If the emergency mode don't boot properly, then you will have no choice but to use an external device to boot an os live in order to do repairs...

"Rescue target" is a more "advanced" runlevel, with base services, which allow internet connection and usb storage mounting for example.So it can be usefull to backup some things on an external storage in case of problem, you can even install packages with apt or access the web with the w3m terminal browser. Of course this mode is more "sensible" to damages, so there may be cases where only the emergency mode will work.


I attached screenshots of the menus so you can have an idea of what it looks like. There are way more entries & tools than in the ubuntu one by the way ^^

The aim of all this is to be able to repair things more easily if, for example, the desktop cannot start or you can't log with your account; so you can track the errors and correct them, or manage users from the root account.

To install these grub entries & related scripts, simply download the attached script, set it executable :
sudo chmod +x setup_recov.sh
and launch it in root:
sudo ./setup_recov.sh

The script will take care of installing the recovery menus, and allow you to add 'Clonezilla live' entry too (and will download the iso if needed). It will try to install some packages (w3m, inxi, ncdu, mc etc...) which are needed for all the menu functions to be available (and are very usefull at my opinion, not only for these recovery menus). You can optionnaly setup a password too for the menus as it will give you full root access without asking for password by default, which can be ok if you're the single user of a computer, but not at all if it's a shared computer. (this can be done in grub config too, but it's a bit tricky/risky, that's why I added this feature).

Don't hesitate to tell me if it's usefull for you smile // tell me if you have ideas to improve it  smile

Last edited by seb3773 (2024-06-20 16:49)


Attachments:
png recovtools.png, Size: 40.63 KiB, Downloads: 62
sh setup_recov.sh, Size: 81.86 KiB, Downloads: 53

My Q4OS scripts: win10/osx theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#2 2024-06-11 17:05

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,436
Website

Re: Add recovery menus to grub

Wow, that looks really cool. Do the scripts work on both UEFI and legacy Bios systems the same way ?

Offline

#3 2024-06-11 17:07

seb3773
Member
Registered: 2023-11-01
Posts: 146

Re: Add recovery menus to grub

Yes, it should (tested it on x64 EFI installs; and it works too in VirtualBox which sould be legacy bios based, as I haven't ticked the "EFI" option).
It should not depends on EFI or legacy by the way, because it only use the appropriates systemd targets, with just a little 'hack' to launch the  menu instead of a simple root shell when the corresponding recovery menu entry is selected.

The main use of these recovery menus is to help to repair things if, for example, the desktop cannot start or you can't log with your account (or other specific cases)... I think I will add a submenu entry to easily manage users too smile

Last edited by seb3773 (2024-06-11 18:14)


My Q4OS scripts: win10/osx theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#4 2024-06-11 18:44

seb3773
Member
Registered: 2023-11-01
Posts: 146

Re: Add recovery menus to grub

I added some more informations in the first post smile
Please note too that if you test it in virtualbox, there are great chances you won't be able to access internet in rescue mode, because of the way virtualbox is "providing" network access to the guest OS I think... Need to do more tests. But it works in a "real" system, you can access internet, even configure a new  connection profile with nmtui.

Last edited by seb3773 (2024-06-11 18:51)


My Q4OS scripts: win10/osx theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#5 2024-06-12 15:19

seb3773
Member
Registered: 2023-11-01
Posts: 146

Re: Add recovery menus to grub

seb3773 wrote:

Please note too that if you test it in virtualbox, there are great chances you won't be able to access internet in rescue mode, because of the way virtualbox is "providing" network access to the guest OS I think... Need to do more tests. But it works in a "real" system, you can access internet, even configure a new  connection profile with nmtui.

Silly me, it was because I didn't started dbus service before launching NetworkManager, it should be ok now. Users management added to the options too smile


My Q4OS scripts: win10/osx theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#6 2024-06-15 00:48

Germ
Member
From: Bushyhead, Oklahoma
Registered: 2023-06-30
Posts: 18

Re: Add recovery menus to grub

Pretty cool!  Thank you! smile


Calm down, it's only ones and zeroes

Offline

#7 2024-06-17 14:20

Midas
Member
Registered: 2017-12-15
Posts: 185

Re: Add recovery menus to grub

Agreed. Haven't tested yet but love the idea. Thanks cool

Offline

#8 2024-06-18 16:56

seb3773
Member
Registered: 2023-11-01
Posts: 146

Re: Add recovery menus to grub

Germ wrote:

Pretty cool!  Thank you! smile

Midas wrote:

Agreed. Haven't tested yet but love the idea. Thanks cool

Thank you ! Scripts updated:
- now there's a script to manage services too, and I improved a bit the user management script.
- added an option to send inxi report & linys audit to pastebin (if internet is connected) in rescue mode, and it displays the url & a qrcode (for easy grabbing of the url ^^)

Don't hesitate to tell me if you think about something else that can be usefull in these recovery scripts !


My Q4OS scripts: win10/osx theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#9 2024-06-20 15:16

seb3773
Member
Registered: 2023-11-01
Posts: 146

Re: Add recovery menus to grub

Script updated: -ram tester script with comprehensive display of physical adresses ranges.


My Q4OS scripts: win10/osx theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

Board footer

Powered by FluxBB