How do you add lines to /etc/default/grub so they're reflected in /boot/grub/grub.cfg?
My question is about how to add a few lines to the /etc/default/grub
file so that it is automatically reflected each time /boot/grub/grub.cfg
is regenerated. The details:
I'm running ubuntu on a Macbook Pro 8.2 and one of the things that I had to do to get it to run correctly was alter the grub.cfg so that it only loads one of the two graphics cards. To turn off one of the cards I added the text concerning i915 in the GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub
:
GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0"
GRUB_CMDLINE_LINUX=""
The problem is that I must also have the following adding to /etc/grub.cfg
:
outb 0x728 1
outb 0x710 2
outb 0x740 2
outb 0x750 0
Which I've added in context in grub.cfg
as so:
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-1e8685ef-b6a8-4bf3-abb8-62d0212cea7c' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
insmod part_gpt
insmod reiserfs
outb 0x728 1
outb 0x710 2
outb 0x740 2
outb 0x750 0
set root='hd0,gpt4'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 21c34907-4da5-4356-b1c8-a5d2747411ed
else...
How can I add this to the /etc/default/grub
file so that I don't have to manually add it to the grub.cfg
every time Ubuntu updates? Currently it appears as if each time Ubuntu updates it regenerates the /boot/grub/grub.cfg
file from the /etc/default/grub
file and it'd be helpful if these four lines could be included as well.
Do not edit the /boot/grub/grub.cfg
file. Edit the /etc/grub.d/10_linux
file:
Add your commands to the
cat << EOF
insmod gzio
EOF
section, so it should read:
cat << EOF
insmod gzio
outb 0x728 1
outb 0x710 2
outb 0x740 2
outb 0x750 0
EOF
This file is sourced every time update-grub
is run, and it is rarely overwritten by updates. (Or at least it will ask when you update whether you want to update this file or keep your modified version.)