Skip to content

fts.sh fails to update etc/default/grub #50

Description

@salvomcl

Hi,
I've noticed that the code below fails to update the parameter GRUB_CMDLINE_LINUX_DEFAULT in my configuration.

GRUB=/etc/default/grub
if [ -f "$GRUB" ]; then
echo "IOMMU -> GRUB"
if grep -q iommu "/etc/default/grub"
then
echo "IOMMU already enabled"
else
if grep -q GenuineIntel "/proc/cpuinfo"
then
echo "intel cpu detected"
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&intel_iommu=on /' /etc/default/grub
echo "IOMMU enabled"
else
echo "amd cpu detected"
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&amd_iommu=on /' /etc/default/grub
echo "IOMMU enabled"
fi
i=1
fi
if grep -q rd.driver.pre=vfio-pci "/etc/default/grub"
then
echo "VFIO preload already enabled"
else
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&rd.driver.pre=vfio-pci /' /etc/default/grub
echo "VFIO preload enabled"
i=1
fi
if [ $i -gt 0 ]; then
echo "Updating GRUB"
grub-mkconfig -o /boot/grub/grub.cfg
else
echo "GRUB already configured"
fi
fi

The reason is that the sed pattern is looking for double quotes, while in my /etc/default/grub I have the following line which uses single quotes instead:
GRUB_CMDLINE_LINUX_DEFAULT='nowatchdog nvme_load=YES loglevel=3'.

However, even using the GRUB_CMDLINE_LINUX_DEFAULT above, the gpu passthrough is working flawlessly.
Is there any reason why I should update the GRUB_CMDLINE_LINUX_DEFAULT parameter according the script above?

If useful, I'm using EndeavourOS.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions