Score:0

How can I edit or remove a grub menu entry while booted off a live usb?

ng flag

I messed up and tried adding a grub menu entry to shutdown the computer using the "halt" command. I accidentally put the "halt" command outside the menu entry 'tags' and now the computer starts to boot and after post immediately shuts down again. From my understanding what is happening is grub is booting and running the script with my shutdown menu entry and just running the halt command as it is outside the menu entry tags. I have managed to boot the computer to a Ubuntu live USB and found what I thought was the script but after removing the command outside the tags and restarting the computer it shuts down like before. How can I edit or remove the menu entry while booted off the USB?

C.S.Cameron avatar
cn flag
I boot the Live USB, open Terminal and run `sudo -H nautilus`. I then make a back up of HDD's `/boot/grub/grub.cfg`. Then I open it and edit it.
Score:0
ca flag

these are the steps:

  1. Boot from live usb (try ubuntu)
  2. Open a terminal and as root (sudo -s) mount the boot partition in /mnt
    example: "mount /dev/sdax /mnt".
  3. execute chroot /mnt
    When you do chroot now your / starts from what it was /mnt.
  4. edit your grub settings
    the suggested way to do this is by modifying /etc/default/grub
  5. execute update-grub
  6. reboot

Hope it is more clear now.

Again, good luck.

C.S.Cameron avatar
cn flag
I do not think you can `update-grub` on a Live USB.
oldfred avatar
cn flag
I think he means to run the update when chrooted. But you have to mount your partitions in your install with chroot. Details need to be added. UEFI chroot, must include ESP - efi system partition http://askubuntu.com/questions/53578/can-i-install-in-uefi-mode-with-the-alternate-installer/57380#57380
jpbrain avatar
ca flag
As oldfred said. Once you do chroot the mounted partition at /mnt becomes your root filesystem. Then, when running update-grub will update according that configuration. I have done that several times when I screw my dual boot or windows overwrite ii as I have dual boot.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.