DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Arm64 Is No Longer the Edge Case
  • TOP-5 Lightweight Linux Distributions for Container Base Images
  • How to Secure Your Raspberry Pi and Enable Safe, Resilient Updates
  • regreSSHion: Should We Panic About the New OpenSSH Vulnerability?

Trending

  • AI Agents for Software Engineering and Autonomous Development Workflows
  • Threat Modeling Context-Aware AI: A STRIDE Walkthrough
  • PWA on iOS, Part 1: PWAs on the iPhone Are Older Than They Look
  • The Permission Was Valid. The Action Was Not Authorized.

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Repair Grub

How to Repair Grub

By 
Amanuel G. Shiferaw
·
May. 14, 20 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
13.2K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Last time, installing Windows stopped my Ubuntu from booting-up. After some research, I managed to fix the boot-loader. I thought it might be worth sharing my experience for those who may face the same problem.

First of all, you need a live cd or bootable USB stick of any flavor of Linux distribution. For example, Ubuntu, Mint, or Fedora can be used.

Boot to the live cd or USB that you have and open a terminal window( Ctrl + T ) and type the following: sudo fdisk -l

The output will be like what's on the following image.

Sudo fdisk -l output

We are going to install our grub on the highlighted partition.

sudo blkid: This is used to make sure you have selected the right device, and its output will be (nowadays ext4 is the default file system used):
Sudo blkid output

Now you are sure about where to install grub. By default, grub is installed in the /boot/grub directory when you install Ubuntu or other Linux distros. So you have to mount /dev/sda3 to a directory of your preference. To do this, type the following:

sudo mount /dev/sda3 /mnt, where /mnt is any directory you need.

Note: If you have a separate boot partition, skip the above command and mount the boot partition at /mnt/boot(sudo mount /dev/sdX /mnt/boot).

sudo grub-install --boot-directory=/mnt/boot /dev/sda: Make sure that the last argument( /dev/sda ) must be the device(hard disk), not some particular partition, like /dev/sda3, that you need to install the boot loader on.

Reboot your system, and it should boot properly.

File system Partition (database) ubuntu Directory USB Linux (operating system) Loader (equipment) terminal Distribution (differential geometry)

Published at DZone with permission of Amanuel G. Shiferaw. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Arm64 Is No Longer the Edge Case
  • TOP-5 Lightweight Linux Distributions for Container Base Images
  • How to Secure Your Raspberry Pi and Enable Safe, Resilient Updates
  • regreSSHion: Should We Panic About the New OpenSSH Vulnerability?

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook