Help to update grub

Asked by Thatoo

Hello,

I have tried to follow https://answers.launchpad.net/cubic/+question/697019 but could not make it work.

In Cubic's Terminal environment, I made the small change I want to /etc/default/grub :

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

to

GRUB_DISTRIBUTOR=`lsb_release -d -s 2> /dev/null || echo Debian`

Then, I did cp /etc/default/grub /usr/share/grub/default/grub

And finally, on Cubic's Options page, I clicked on the Boot tab and here is my preseed file named auto-preseed.seed :

### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/language string fr
d-i debian-installer/country string FR
d-i debian-installer/region string fr_FR.UTF-8
d-i debian-installer/locale string fr_FR.UTF-8

# Keyboard selection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/variant select France
d-i keyboard-configuration/xkb-keymap select fr(latin9)

# Cette commande permet de régler l'horloge matérielle sur UTC :
d-i clock-setup/utc boolean true

# Vous pouvez mettre toute valeur acceptée pour $TZ.
# Voyez ce que contient /usr/share/zoneinfo/ pour les valeurs possibles.
d-i time/zone string Europe/Paris

# La ligne suivante autorise l'utilisation de NTP pour régler l'horloge
# pendant l'installation :
d-i clock-setup/ntp boolean true

# (a) Generate /boot/grub/grub.cfg using the customized version of /etc/default/grub.
# (b) Revert the customized version of /etc/default/grub after it has been overwritten.
ubiquity ubiquity/success_command string \
    in-target bash -c 'update-grub'; \
    in-target bash -c 'cp /usr/share/grub/default/grub /etc/default/grub';

My grub.cfg is as follow :

function load_video {
 if [ x$feature_all_video_module = xy ]
 then
  insmod all_video
 else
  insmod video_bochs
  insmod video_cirrus
  if test "${grub_platform}" == "efi"
  then
   insmod efi_gop
   insmod efi_uga
  elif test "${grub_platform}" == "pc"
  then
   insmod vbe
   insmod vga
  fi
 fi
}

if loadfont /boot/grub/font.pf2
then
 set gfxmode=auto
 export gfxmode
 load_video
 insmod gfxterm
 terminal_output gfxterm
 insmod gfxmenu
 insmod png
 set theme=/boot/grub/themes/mon/theme.txt
 export theme
fi

set color_normal=white/black
set color_highlight=black/light-gray
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=10
set timeout_style=menu

menuentry "Essayer ou Installer Mon OS" --class mon {
 set gfxpayload=keep
 linux /casper/vmlinuz boot=casper file=/cdrom/preseed/auto-preseed.seed maybe-ubiquity quiet splash ---
 initrd /casper/initrd.lz
}
menuentry "Essayer ou Installer Mon OS (basse résolution)" --class display {
 set gfxpayload=keep
 linux /casper/vmlinuz boot=casper file=/cdrom/preseed/auto-preseed.seed maybe-ubiquity quiet splash nomodeset ---
 initrd /casper/initrd.lz
}
menuentry "Essayer ou Installer Mon OS (Drivers NVIDIA)" --class nvidia {
 set gfxpayload=keep
 linux /casper/vmlinuz boot=casper file=/cdrom/preseed/auto-preseed.seed maybe-ubiquity nvidia-mon quiet splash ---
 initrd /casper/initrd.lz
}
grub_platform
if [ "$grub_platform" = "efi" ]; then
menuentry 'UEFI Firmware Settings' --class settings{
 fwsetup
}
fi
menuentry "Éteindre" --class poweroff {
 halt
}

And my loopback.cfg is as follow :

menuentry "Essayer ou Installer Mon OS" --class mon {
 set gfxpayload=keep
 linux /casper/vmlinuz boot=casper file=/cdrom/preseed/auto-preseed.seed maybe-ubiquity iso-scan/filename=${iso_path} quiet splash ---
 initrd /casper/initrd.lz
}
menuentry "Essayer ou Installer Mon OS (basse résolution)" --class display {
 set gfxpayload=keep
 linux /casper/vmlinuz boot=casper file=/cdrom/preseed/auto-preseed.seed maybe-ubiquity iso-scan/filename=${iso_path} quiet splash nomodeset ---
 initrd /casper/initrd.lz
}
menuentry "Essayer ou Installer Mon OS (Drivers NVIDIA)" --class nvidia {
 set gfxpayload=keep
 linux /casper/vmlinuz boot=casper file=/cdrom/preseed/auto-preseed.seed maybe-ubiquity iso-scan/filename=${iso_path} nvidia-mon quiet splash ---
 initrd /casper/initrd.lz
}
menuentry "Éteindre" --class poweroff {
 halt
}

The Grub doesn't seem to update as it should...
After installing, when rebooting, after withdrawing the dvdrom, I get a black screen with the <grub> invite command only.
If I don't modify /etc/default/grub and keep
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
then it works.
Could you help me to correct my auto-preseed.seed file or loopback.cfg or grub.cfg if one of the three is wrong or if I'm missing something?

Thank you in advance,
Thatoo

Question information

Language:
English Edit question
Status:
Answered
For:
Cubic Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Cubic PPA (cubic-wizard) said :
#1

/etc/default/grub is just a config file.

It's not a shell script where a value is assigned to a variable by executing a command between the back-tick\Grave character (`).

Therefore, I don't think this will work.

If you make this same change to /etc/default/grub on a running system (i.e. not in Cubic), and you execute `sudo update-grub` does it work?

Revision history for this message
Thatoo (thatoo) said :
#2

Indeed, it does work.
I've just tried again in a VM and both work and display the correct information
 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
and
 GRUB_DISTRIBUTOR=`lsb_release -d -s 2> /dev/null || echo Debian`

and `sudo update-grub` works.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#3

Quickly scanning through your changes, I don't see any errors.

Based on your description, it seems that changing "GRUB_DISTRIBUTOR" causes the problem.

Instead of...

    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

...have you tried not including a command? Perhaps something like...

    GRUB_DISTRIBUTOR=Ubuntu

Revision history for this message
Thatoo (thatoo) said :
#4

Replacing
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
by
    GRUB_DISTRIBUTOR=MonOS
doesn't work neither.
 After installing, when rebooting, after withdrawing the dvdrom, I get the black screen with the <grub> invite command only.

It really seems like grub doesn't get updated...

Revision history for this message
Cubic PPA (cubic-wizard) said :
#5

I've see that during installation, the Ubiquity installer over-writes your version of /etc/default/grub.

This why we execute `cp /usr/share/grub/default/grub /etc/default/grub` to replace Ubiquity's version of the grub file with the customized version.

It might be that /etc/default/grub gets overwritten by Ubiquity just before you execute update-grub.

If this is the case, may be you can try something like this in your preseed file...

ubiquity ubiquity/success_command string \
    in-target bash -c 'cp /usr/share/grub/default/grub /etc/default/grub'; \
    in-target bash -c 'update-grub'; \
    in-target bash -c 'cp /usr/share/grub/default/grub /etc/default/grub';

Also, make sure /usr/share/grub/default/grub does have your changes.

Revision history for this message
Thatoo (thatoo) said :
#6

Too bad, it didn't work neither.
I wonder how much my preseed file is working even. I don't know...

Can you help with this problem?

Provide an answer of your own, or ask Thatoo for more information if necessary.

To post a message you must log in.