1

I've created a persistent linux installation using the often suggested method with the help of mkusb and installing the final system using the before-created partitioning scheme (see e.g. here: https://askubuntu.com/a/1107334/1043714 by @C.S.Cameron).

I now have doubt, that grub is installed correctly. When I edit /etc/default/grub (with e.g. some change in the timeout) and update-grub, I don't see any effect after reboot.

I suspect, it should put grub.cfg somewhere into /dev/sdx3 (which to my understanding is the acutal boot partition) instead of /dev/sdx5 (which is my actual / ) - but I'm not sure and additionally don't know, how EFI would come into play at this moment...

Thanks a lot in advance for guiding, pheidrias

1 Answers1

1

Update GRUB on Full Install USB made using mkusb

The method you point to has one instance of GRUB for BIOS and another for UEFI.

Running sudo update-grub will update GRUB on / only.

To fully update GRUB, after doing sudo update-grub, copy /boot/grub/grub.cfg from sdx5 to /boot/grub/grub.cfg on sdx3.

I will update that answer.

That answer was something I wrote on my way to making How to Create a Full Install of Ubuntu 20.04 to USB Device Step by Step

C.S.Cameron
  • 19,519
  • Thanks, C.S. Cameron!

    But is there a way to automate this? If I'm not mistaken, the actual installation would e.g. miss out on kernel updates, if I'm not manually copying grub.cfg...

    The usb devices are intended to be used by students on a day-to-day basis - so I'm not able to interfere this massively on the drives (only via ansible, atm)...

    – pheidrias May 03 '21 at 10:28
  • @pheidrias: Do many of the students use Legacy only computers? UEFI computers use the grub on sdx5 to boot. sdx5 grub.cfg is updated with update-grub and kernel upgrades etc. Manually copying grub.cfg should only be needed on older computers. perhaps someone could build a script to do the work, but just copying the grub.cfg file over to sdx3 is not that hard. Is there some other problem I am missing? – C.S.Cameron May 03 '21 at 13:21
  • I'm not sure. But to me it seems, that the grub.cfg on sdx5 isn't used. For example: I do have a laptop here, where "Legacy Support" is disabled in BIOS. This should mean, it is using UEFI - right? "Secure Boot" is somehow disabled, btw - but this souldn't be relevant here - or should it?

    I set my grub-timeout to 10s and also added the beep but still do have the 30s timeout and no beep...

    – pheidrias May 03 '21 at 18:04
  • Another machine has Legacy Support enabled and still won't use my updated grub.cfg. How can I be sure to reinstall grub properly? Maybe something went wrong at this stage? I honestly don't understand that we manually mount sdx3, install grub with this boot-directory (mounted at /mnt) and it should be considered relevant at boot? Or is the "--boot-directory=/mnt/boot" just a one-time thing? – pheidrias May 03 '21 at 18:09
  • Hello again,

    I followed your other tutorial this time (https://askubuntu.com/questions/1217832/how-to-create-a-full-install-of-ubuntu-20-04-to-usb-device-step-by-step). I did use virtualbox to not have to fiddle with harddrive stuff...Noticeable difference to your description: the first partition didn't have "grub2 core.img" as a file system? There is no mentioning on how to achieve this. Nevertheless, I got a booting USB drive. BUT: still no reaction to update-grub...

    – pheidrias May 03 '21 at 21:15
  • @pheidrias: Try this: Boot USB in BIOS mode. Run `sudo -H nautilus. Files should open as root. Open sdx3/boot/grub/grub.cfg. (it may be mounted at /media/cscameron/usbboot). Edit the first menuentry adding the word BIOS thus: menuentry 'Ubuntu-BIOS?' --class..., save. Open sdx5/boot/grub/grub.cfg. (it may be mounted at Filesystem Root). Edit the first menuentry adding the word UEFI thus: menuentry 'Ubuntu-UEFI?' --class..., save. – C.S.Cameron May 04 '21 at 03:18
  • Now boot the computer in BIOS mode. The first item on the GRUB menu should be "Ubuntu-BIOS?". Now boot on a UEFI computer, the first item on the GRUB menu should be "Ubuntu-UEFI?". Run sudo update-grub. Boot in BIOS mode again, the first item will still be "Ubuntu-BIOS?", Boot in UEFI mode and note that the first item on the GRUB menu is now "Ubuntu", without "UEFI?". You can confirm that your kernels are working properly after doing a grub.cfg copy. – C.S.Cameron May 04 '21 at 03:18
  • I just realized, that I seem to be always booting in EFI mode - even if I'm enabling "Legacy Boot" the system comes up as EFI (verified by checking the existence of /sys/firmware/efi as suggested her: https://askubuntu.com/questions/162564/how-can-i-tell-if-my-system-was-booted-as-efi-uefi-or-bios). But maybe we do still have a misunderstanding? I am worried, that update-grub doesn't update the "right" grub.cfg itself, as it doesn't change the bootmenu after reboot. I do have to manually copy the new cfg to make it work. Can't update-grub be persuaded to use the right one? Maybe hardlinking? – pheidrias May 05 '21 at 17:56
  • Ok - I checked once more. Grub definetely takes the grub.cfg from /dev/sdx3, but update-grub doesn't update this one, which is clear, as /dev/sdx3 isn't even mounted at this point. How could I enforce this? Another syntax for grub-install? – pheidrias May 05 '21 at 20:15
  • After updating GRUB, copy sdx5/boot/grub/grub.cfg to sdx3/boot/grub/. – C.S.Cameron May 06 '21 at 02:43
  • Hallo CS Cameron, thanks for bearing with me, but I totally understood that I could get this behaviour by manually copying grub.cfg. The question is: is there no way to tell grub where to put grub.cfg? Or do I have to find a completely different way of creating a bootable, real installed usb device? – pheidrias May 06 '21 at 16:56
  • If update-grub cannot be convinced: do you have some idea on how to automatically run a script after the creation of grub.cfg? There is this /etc/grub.d/40_custom - but I'm not sure it will run after the "physical" creation of grub.cfg or before... – pheidrias May 06 '21 at 17:21
  • Modifications to /etc/grub.d/40_custom work using update-grub so they only effect sdx5. I think it is easy enough to make a Full install USB that updates always in BIOS mode or always in UEFI mode, just do a normal install while in the correct mode. Sudodus may have update-grub working as you want with the image on this page: https://askubuntu.com/questions/1300454/easy-full-install-usb-that-boots-both-bios-and-uefi. I will try playing with it today and see if that is true. – C.S.Cameron May 07 '21 at 02:18
  • Thanks again! I did modify the 40_custom to copy grub.cfg to sdx3 - but as expected, it takes the actual and not the version-to-be-created. However - running update-grub two times will eventually have grub.cfg in the right places. Atm, this allows me at least to be only one kernel update behind :D without any manual interaction. – pheidrias May 07 '21 at 09:36
  • @pheidrias: Thanks, as soon as my Flash drive is free, I will give it a try and than update the answer with the info. – C.S.Cameron May 07 '21 at 09:58
  • Another update: I do get an error regarding the update of grub-efi-amd64-signed on my running system...

    grub-install: Achtung: EFI-Variable Boot0003 konnten nicht gesetzt werden grub-install: Achtung: efivars_set_variable: writing to df 8 failed

    and corresponding errors....

    Any ideas, what's going on?

    – pheidrias May 23 '21 at 12:05