• Grub generation fix/workaround (multi-boot)


    Hi all,

    since Antergos grub generation (grub-mkconfig -o /boot/grub/grub.cfg) does not produce proper entries for other operating systems, I wrote a small workaround script that should fix the grub generator. I’ve tested the generation for Manjaro.

    But currently I don’t have a possibility to test generation for other operating systems, so could anyone please test it on your multi-boot systems?

    When the script is adequately tested by many users, I can move it to github as a downloadable package.

    The script modifies two files, /usr/lib/linux-boot-probes/mounted/40grub2 and /etc/grub.d/30_os-prober, but creates backups for both before any changes.
    All changes to those files can be undone simply by reinstalling packages grub and os-prober.
    Naturally, the script needs to be executed under sudo.

    Here’s the script:

    #!/bin/bash
    #
    # A workaround for os-prober's initrd line generation problem on Antergos.
    #
    
    _check()
    {
        "[email protected]"
        if [ $? -ne 0 ] ; then
            echo "Error: '$*' failed."
            exit 1
        fi
    }
    
    _file1mod()
    {
        sed "s|\(echo \${LINUX} \| cut -d ':' -f 5\)\`|\1 \| tr '^' ' '\`|"
    }
    
    _file2mod()
    {
        sed -e 's|initrd="\$(echo "\$2"|shift; initrd="\$(echo "\$\@"|' \
            -e 's|initrd="/boot\$initrd"|initrd=($initrd); initrd=\${initrd[@]/#//boot}|'
    }
    
    _file()
    {
        local mod="$1"
        local file="$2"
        local filebak="$file"-$(date +%Y%m%d-%H%M)
    
        _check mv $file $filebak
    
        cat $filebak | $mod > $file
    
        _check chmod +x $file
        _check chmod -x $filebak
    }
    
    _StartHere()
    {
        _file _file1mod /etc/grub.d/30_os-prober
        _file _file2mod /usr/lib/linux-boot-probes/mounted/40grub2
    }
    
    _StartHere "[email protected]"
    
  • we should realy build a community repository ;) I would do that… as i can provide my server for it, but it will need a clean build environment like a server, and i am not aware how to build that one exactly…

  • @joekamprad Could you start a new thread for it? It sounds like a great idea, as it could complement the AUR.
    Antergos already has community package database, we should discuss what’s the difference compared to that, and how (if possible) that could be used.

grub111 multi-boot2 fixworkaround1 generation1 Posts 4Views 203
Bloom Email Optin Plugin

Looks like your connection to Antergos Community Forum was lost, please wait while we try to reconnect.