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
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • 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?
  • Multiplatform Directory Bookmarks on the Command Line

Trending

  • How AI Is Rewriting Full-Stack Java Systems: Practical Patterns with Spring Boot, Kafka and WebSockets
  • Why AI-Generated Code Breaks Your Testing Assumptions
  • AWS Managed Database Observability: Monitoring DynamoDB, ElastiCache, and Redshift Beyond CloudWatch
  • You Don't Get to Retrofit Trust: Why API Security Must Be Designed In, Not Bolted On
  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Repair Grub

How to Repair Grub

By 
Amanuel G. Shiferaw user avatar
Amanuel G. Shiferaw
·
May. 14, 20 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
13.0K Views

Join the DZone community and get the full member experience.

Join For Free

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

  • 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?
  • Multiplatform Directory Bookmarks on the Command Line

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • 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