Fix ManjaroLinux in grub (fallback only), simple gambas script
Posted
#1
(In Topic #500)
Banned
I was initially writing this script with bash but it has been much better to do it with gambas scripting.
What it does….
If you have ManjaroLinux on a disk but it's not your main disk and not the disk grub is installed from then the os-probe get's some details wrong about manjaro and makes a grub.cfg file that will only boot manjaro in "fallback" mode.
The reason is this…
On the Manjaro disk it's grub.cfg file will have a line like this at the end of the ManjaroLinux menu entry.
initrd /boot/intel-ucode.img /boot/initramfs-5.8-x86_64.img
But if your grub is set up on another drive it's grub.cfg will look like this..
initrd /boot/intel-ucode.img
I've made the simple fix before, more than once though as it reverts to the "wrong" config every time update-grub is run on the main OS.
So a simple script to fix it is born
So run this script from your main OS and it will auto-detect your Manjaro drive (if mounted) and read it's grub.cfg file to get the correct initrd line. (or you can manually select the Manjaro grub.cfg file if not detected.
It then reads the grub.cfg file from your running OS and Changes the initrd lines to be correct.
If run as root it will save the /boot/grub/grub.cfg automatically and job done.
If not run as root it will save a new modified grub.cfg file to your desktop for you to copy manually.
Wishing Well
(Ps. the Message() requesters show a gtk warning in the cli, ignore it. Benoit is looking into it.
change Use "gb.gui" to Use "gb.qt5" to use qt)
File Fix-manjaro-grub-entries.gbs
Code (gambas)
- ' Gambas script file
- Use "gb.gui"
- Goto SkipChooser
- Print "Manjaro not auto-detected, opening file requester.."
- .Title = "Choose grub.cfg"
- .Filter = ["*.cfg", "Grub cfg Files"]
- SkipChooser:
- EditGrub()
- sLine = sLines[iCount]
- bActive = True
- Return sLine
- Print "/bot/grub/grub.cfg not found, aborting."
- Quit 1
- bActive = True
- sLines[iLine] = "\t" & sMGrubLine
- bActive = False
- Print "Root permissions granted, saving '/boot/grub/grub.cfg'"
1 guest and 0 members have just viewed this.





