LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 06-09-2016, 04:12 AM   #1
Jigsaw
Member
 
Registered: Apr 2016
Location: Indonesia
Distribution: Debian
Posts: 77

Rep: Reputation: Disabled
/ usr / sbin / grub-probe: error: can not find a GRUB drive for / dev / sda4. Check your device.map.


I have problems at the time of the update-grub in ubuntu, I get the error message "/ usr / sbin / grub-probe: error: can not find a GRUB drive for / dev / sda4. Check your device.map." / Dev / sda4 a / boot partition my lfs. help me sir ..

Code:
sudo update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found GNU/Linux Jigsaw (1.0) on /dev/sda1
/usr/sbin/grub-probe: error: cannot find a GRUB drive for /dev/sda4.  Check your device.map.
done
 
Old 06-09-2016, 07:35 AM   #2
Ned Radd
LQ Newbie
 
Registered: Apr 2016
Posts: 20

Rep: Reputation: Disabled
You need to provide more information about your drive setup. What is not evident here ts why GRUB is suddenly focused on /dev/sda4.

Grup has a problem in that it does not automatically delete obsolete boot entries. To get around this, just use this command: sudo rm /boot/grub/grub.cfg. This will force grub to create this file from scratch from your present configuration. See if that helps.
 
Old 06-10-2016, 01:58 AM   #3
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
Just a note, I never install grub on my LFS partition.

I just do an update-grub from my host system that maintains grub for both
my debian host and my windows 7 install.

More info at:
man update-grub
man grub-mkconfig

It then adds the LFS partition as another boot option.
Then I have options to boot debian, LFS, or Windows7.
I find that much more simple.

So maybe uninstall grub2 on your LFS and try on your host system an update-grub as root or use sudo update-grub if you must.
Just insure your kernel is in the /boot directory of your LFS partition and your /etc/fstab is set correctly.

*** Before you do, backup your /boot/grub/grub.cfg on your host system in case you need to revert.

Hope that helps,
Tim
 
Old 06-10-2016, 07:47 PM   #4
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
I actually have LFS on a separate drive.

Best way to get grub going is as follows:

Code:
mkdir -pv /boot/grub
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sdX
*Note: X represents the drive letter you put Grub onto.
I highly recommend you have LVM2 and other optional dependencies installed and Google how to setup the file /etc/default/grub for best results.

If needed, I also recommend using os-prober. If you need help installing it, I can get you a quick guide drafted.

Last edited by ReaperX7; 06-10-2016 at 07:48 PM.
 
Old 06-15-2016, 04:47 AM   #5
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
yeap,
I also have my LFS on a separate actual hard drive and my host system boots from GRUB on an SSD.
I did have to manually adjust grub to boot the non initrd/initrmfs LFS system and edit /etc/fstab
In any case, so far so good using the host systems grub on a SSD setup as MBR.

Maybe this helps the OP:
https://www.gnu.org/software/grub/ma...b.html#Booting

Last edited by Tim Abracadabra; 06-15-2016 at 05:04 AM. Reason: Add GRUB2 reference link
 
Old 06-19-2016, 03:31 AM   #6
Ned Radd
LQ Newbie
 
Registered: Apr 2016
Posts: 20

Rep: Reputation: Disabled
A problem with grub is that every time it runs, the boot processes previously identified must all be present before it will boot any of them. That makes it necessary to scrub /boot/grub/grub.cfg of any boot entries that you don't want identified before attempting a boot. Call this a correction, and doing a correction before booting up to do the correction means thinking ahead.

You can always do the correction from a LiveCD, as the LiveCD just loads itself into RAM and is not concerned with the HDDs or removable drives and what is or what is not bootable initially.

You can do it before running sudo update-grub by keeping it from recognizing unwanted boot partitions. Say you had 3 bootable partitions on devices /dev/sda1, /dev/sda2, and /dev/sda3. and yo wanted to install UBUNTU 16.04 LTS onto a thunb drive at /dev/sdb with partition /dev/sdb1.

What would temporarily make /dev/sda1, /dev/sda2, and /dev/sda3 no longer appear bootable? Well, that depends on what operating system is set up on each of those partitions, and what does grub look for when it classifies a specific partition as bootable?

Maybe if you renamed a folder or file to be something else temporarily, grub could be fooled while sudo update-grub is running.. Then name it back as it was when update-grub is done.

But a simpler way is just to let sudo update-grub do its thing, then remove or comment out (put a # at the front of each line) any boot entries you don't want there from the /boot/grub/grub.cfg file. Not recommended, as this is where you can clobber your boot capabilities, but you are clobbered anyway if grub can't match up entries to what it actually finds present at boot time.

Worse thing that can happen in all likelihood is having to delete /boot/grub/grub.cfg and make it over again by running sudo update-grub from somewhere and then copying this file to each partition that has a grub boot process on it.

But I am speaking off the top of my head in terms of what might work. What I did for setting up an install on a removable drive is pick a laptop that had just had Win 7 wiped off it, and did the first install to a thumb drive. It was the the only bootable partition present, so its MBR and /boot/grub/grub.cfg reflected that fact.

Then i removed the thumb drive and did a second install to the reformatted internal drive on the laptop, and again update-grup only saw one boot partition available, but this time it was on the internal drive.

That gave me two installs initially, one on a removable drive, the other on an internal partition, and neither had a record of the other. Each gave me a master /boot/grub/grub.cfg file that I put under that name.

If update-grub runs, I just needed to use "sudo cp -f master /boot/grub/grub.cfg" and replace the new /boot/grub/grub.cfg with the old one. This works, because the active part just loads vmlinuz into RAM, and vmlinuz is always the latest Linux kernel once compiled. Any additions related to other boot partitions just get blown away by the overwrite.

If you want multiple boot options under any one partition, then you have to work that out a different way.

Last edited by Ned Radd; 06-19-2016 at 03:37 AM.
 
Old 06-19-2016, 04:07 AM   #7
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
@Ned_Radd

You really shouldn't be manually editing /boot/grub/grub.cfg.

There is a template file used by grub to build the above mentioned file and that is where
your persistent changes should be made. On my debian system it is actually multiple files
located in /etc/grub.d

See the man pages and the README in that directory for more info.

IF you make your changes there, they will persist over grub updates and reboots.

Hope that helps,
Tim
 
Old 06-19-2016, 04:30 AM   #8
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Edit /etc/default/grub only. Nothing else.
 
Old 06-19-2016, 04:42 AM   #9
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
This may be true on other distros's but not on debian.
Only edit or add files to /etc/grub.d/

If your host system is not debian, the name and location may be different.

It is not recommended, as I mentioned above to Ned Radd, to directly modify /boot/grub/grub.cfg


Thanks ReaperX7 for pointing out the differences between distros.

Edit: Just to note my /etc/default/grub file you mentioned has almost everything commented out.

Also, Editing these host files only applies when you use the host systems grub to boot LFS, not any grub installed on your LFS if for some reason you decide to go that way.

All the best,
Tim

Last edited by Tim Abracadabra; 06-19-2016 at 05:20 AM. Reason: Add comment about file name and location and specifying host grub boot
 
Old 06-19-2016, 06:35 AM   #10
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
Interesting the OP has not responded since the original post.
 
Old 06-27-2016, 03:56 AM   #11
Ned Radd
LQ Newbie
 
Registered: Apr 2016
Posts: 20

Rep: Reputation: Disabled
Got lots going on. I don't folow posts on a day by day basis, but just get back here if there ia indication of other activity.

I just replaced the hard drive in a Toshiba Satellite L355 laptop. The drive was unformatted, and I formatted it with great care. Do ir right the first time, and avoid later problems. But finding the right way was a challenge. I had it reasoned out as to how to try it, and so far the resulrs look good, according to testdisk. But I don't fully understand the use and options of teskdisk, and am trying to do specific extracts of the log produced as part of the process. From ther I either work out what was done on its end, and drom that i hopw to plan a recovery wffor od corrupted drives rhat nothing fixes now.

The bid geal is learning to use dd or other disk writing tool to write and read specific sectors on the hard drive. I'm told it can be done but not how. I also read I can do it in C, but I'm not a C programmer. Python or bash is more my speed. Also PureBasic.

As to /booy/grub/grub.cfg, I left that for now as to just to back it up and deal with that whole matter later. On the L355, I have nor yet committed to an install od any OS, but have used it to create 2 separate stick boot drives. I did this easily enough by only having one plugged in at a time.

The automatic upgrade-grub and grub-install process only find that one device to be bootable with an OS available, so they remain independent of each other and only reflect the hardware installed on. I've read that Linux can adjust to different hardware as it boots up, so I will be texting that deature going forward.

Like I said, lots going on.
 
Old 06-27-2016, 11:59 AM   #12
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
Ned Radd,

You are not the OP of this thread.
Please consider opening your own thread for such discussions on topics per your previous post
that are not apparently related to the Original Posters concerns.

Thanks and all the best,
Tim
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/usr/sbin/grub-probe: error: no such disk. leader1201 Linux - Software 5 03-14-2013 08:52 AM
grub-probe: error: cannot find a device for /. (in chroot) luxianos Linux - Software 5 02-21-2013 03:46 AM
[SOLVED] '/usr/sbin/grub-probe: error: cannot stat `/dev/root' k84834 Linux From Scratch 4 01-02-2013 04:21 AM
/usr/sbin/grub-probe: error: no such disk. mpyusko Debian 3 01-05-2012 10:28 AM
[SOLVED] GRUB: Cannot find list of partitions && /usr/sbin/grub-setup: error w1k0 Linux Mint 26 12-21-2010 03:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 04:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration