Ubuntu – I need the pendrive to boot into Ubuntu, how to correct this and boot from the HDD

bootgrub2usb

I installed Ubuntu through USB. Instillation was successful.

But when I restarted my laptop it didn't boot. So planed install it again when started selected install from USB. it booted my previous installed Ubuntu. So after went Ubuntu boots no need of that pen drive, so in short, every time I want to start my pc I need that pen drive to boot.

Best Answer

The most likely cause was that you installed GRUB in your Pendrive. To correct this situation you have to Install GRUB correctly in the Hard Disk. First you need intel to do this, you need to know what partition is your Ubuntu. For this we rely in fdisk.

  1. Using your pendrive in a live session, open the terminal, then type sudo blkid. You will get a output similar to this:

    /dev/sda1: UUID="bf554a2f-a035-4c22-bca8-162def35a03c" TYPE="ext4" 
    /dev/sda2: UUID="3962db06-3776-4f38-8ab9-eab6feeccc1d" TYPE="ext4" 
    /dev/sdb1: UUID="AA64B45A64B42AC9" TYPE="ntfs" 
    /dev/sdb2: UUID="F66E431C6E42D551" TYPE="ntfs" 
    /dev/sdb3: UUID="75a0854b-8b6b-453f-8aec-2a081a1f19e3" TYPE="swap" 
    /dev/sdb5: UUID="279a18da-130b-46dd-8b54-84da48eb445f" TYPE="ext4" 
    /dev/sdb6: UUID="393cd35e-b827-4dea-acb5-2a66f2369dce" TYPE="swap"
  2. Here you can see that my Hard Drive is in the sda and my pendrive is sdg. We are interested in sda. Now lest look at the descriptions of the partitions. We want the partitions that are ext4. In my case I have two ext4 partitions. This is because I have my /boot separated, I will take note about that, but lets assume that you don't have /boot separated for now and that your / (root) is sda1. Now we will mount sda1.

    sudo mount /dev/sda1 /mnt
    sudo mount -o bind /proc /mnt/proc
    sudo mount -o bind /dev /mnt/dev
    sudo mount -o bind /dev/pts /mnt/dev/pts
    sudo mount -o bind /sys /mnt/sys
    

    Tecnical note: This is the minimum. If you have a /boot partition (or any other) separated just mount it the same way, in my case sudo mount /dev/sda2 /mnt/boot. Please take note that I used /mnt/boot, you should change it if using other mount points.

  3. Now we will proceed to CHROOTING the partition:

    sudo chroot /mnt /bin/bash
    
  4. Now we will proceed to install grub:

    sudo grub-install /dev/sda
    
  5. Done. Now reboot in your system without the pendrive.

Related Question