LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 11-20-2016, 02:03 PM   #1
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

Rep: Reputation: 15
grub ls won't detect external drive


There are five partitions on my external drive (sdb) connected by usb. Grub on my internal drive sees them and lists them on the grub menu screen. But if I try to boot one of the systems on them, I get
Code:
hd1 cannot get C/H/S values
you need to load the kernel first
Grub ls returns only the list of partitions on sda, the internal drive and does not see those on sdb.

I've read many many related articles but only found one that directly tells me what to do, but it is thirteen years old:

Quote:
You need to install the bootloader for debian on /dev/hdb. Then after that the entry in your grub.conf on /dev/hda will work properly. Without a bootloader, how will grub hand over the control to the debian kernel ??

So, here are the steps in short:

1. Boot into rescue mode with Cd-1, at boot prompt type-

linux rescue

2. mount your root partition with

chroot /mnt/sysimage

3. Install grub on the boot sector of second hard disk with

/sbin/grub-install /dev/hdb

Next, check if /etc/grub.conf on your disk with fedora (/dev/hda) points to the correct devices and files of your debian disk..and that should do it...
I don't really understand anything but item 3. If I just do item 3 from a live OS, using sdb rather then hdb, will it install the grub to the external drive without destroying my internal grub?

Also, must space be allotted on the external drive for the grub-install? Does it have to be formatted space?
Will my sdb1 partition, which is currently at the beginning of the partition, be overwritten?

Last edited by hilltownboy; 11-20-2016 at 03:24 PM.
 
Old 11-20-2016, 04:02 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Do the five partitions on your external usb all have different operating systems on them?

Is the error you report occurring when you select any or all of them from the boot menu?

If you Debian installed on the internal drive, are you able to mount/access the partitions on the external drive? and is the external drive seen in the BIOS?

The article you mention is in reference to Grub Legacy. If you are using a current Debian or other Linux, you probably do not have Grub Legacy isntalled. If you have different operating systems on the external, what is the primary distribution on the internal? Have you ever been able to boot anything on the external? Have you run grub-mkconfig from your primary Grub boot system? Are these GPT or MBR systems.

You haven't posted much information which would help someone to help you. Either download and run the bootinfoscript or get boot repair from the link below and burn it to a CD and run it but select just the option to Create Bootinfo Summary and do not try any repairs. Post a link to the output here.

https://help.ubuntu.com/community/Boot-Repair
 
Old 11-20-2016, 09:08 PM   #3
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,345

Rep: Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588Reputation: 1588
Is the external drive formated gpt whereas the internal drive is msdos or vice-a-versa? Sometimes that will cause problems due to missing modules when grub was installed.
 
1 members found this post helpful.
Old 11-21-2016, 09:38 AM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
So, here are the steps in short:

1. Boot into rescue mode with Cd-1, at boot prompt type-

linux rescue

2. mount your root partition with

chroot /mnt/sysimage

3. Install grub on the boot sector of second hard disk with

/sbin/grub-install /dev/hdb
just type exactly what the steps say to do. then understand it later, if that gets it working.

you are telling that boot CD-1 to put you into rescue mode. then you are chroot (changing root to) /mnt/sysimage

(looks like it does some things automatically for you. mounting your system image to /mnt first)

then installing grub from your system image in /sbin/ where it lives. to your, I guess USB /dev/sdb?

providing you do not have two hard drives within your on board system

Last edited by BW-userx; 11-21-2016 at 09:40 AM.
 
Old 11-21-2016, 02:36 PM   #5
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

Original Poster
Rep: Reputation: 15
yancek, thanks for your reply and interest. Before answering your questions let me mention somrthing in Boot Info Summary that may be critical:
Code:
Windows is installed in the MBR of /dev/sdb.
WindowsXP was originally on my computer HPCompaq 6910p but I ditched it.

Your questions in order:
1. External disk has copies of three operating systems and two storage items, and a lot of empty partitions.

2. The error occurs when selecting any from the boot menu. I should display the error in full:
Code:
no such device: <uuid of the particular device>
      hdx cannot get C/H/S values
      you need to read the kernel first
3. Any OS on the internal drive or usb flash drive can mount any of the external partitions. The BIOS allows usb flash drive to boot, but with the external disk it shows:
Code:
Non-system disk or disk error
      replace and strike any key when ready
upon which the system hangs

4. Every OS is Grub2 (that's why I changed the cited command to sdb), except for PCLinux on the internal drive. (I don't really use PCLinux and it is no longer supported for my 32 architecture.)
The primary internal distribution is Debian8 (jessie).
I once booted sdb1 (a copy of Debian squeeze) from the jessie grub menu, but because the original had been on sda8, it brought up what is now on sda8. So I manually edited the sdb1 grub.cfg to change all references to sda8 and hd0,8 to sdb1 and hd1,1. After that, it would not boot, so using a live usb OS I ran update-grub on sdb1. It now has the references to sdb1 and the same uuid as on its fstab and jessie grub.cfg, but still will not boot.
I have run update-grub which supposedly runs grub-mkconfig.
All systems are MBR.

5. Bootinfoscript is several thousand pages long because of the length of grub.cfg in all the partitions. I doubt that you want all that -- maybe certain parts.
 
Old 11-21-2016, 06:23 PM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Check the grub.cfg menuentries from your primary system on sda (Debian?) and compare the entries to the output of the blkid command (may need sudo blkid) to see if it is using the correct uuid's for the partitions. Or you could post that info here for members to review.
 
Old 11-22-2016, 01:21 PM   #7
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

Original Poster
Rep: Reputation: 15
I've checked over and over. Here are excerpts.
From blkid:

Code:
/dev/sdb1: LABEL="SQUEEZE" UUID="5da3ae8c-6347-4402-9d0a-e8b1d5214ce0" SEC_TYPE="ext2" TYPE="ext3" PARTUUID="2f0e4272-01"

/dev/sdb4: UUID="58737a29-7851-4f74-b210-9e03a3a31a75" TYPE="ext4" PARTUUID="2f0e4272-04"
From grub.cfg:

Code:
menuentry 'Debian GNU/Linux (6.0.7) (on /dev/sdb1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-5da3ae8c-6347-4402-9d0a-e8b1d5214ce0' {
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  5da3ae8c-6347-4402-9d0a-e8b1d5214ce0
        else
          search --no-floppy --fs-uuid --set=root 5da3ae8c-6347-4402-9d0a-e8b1d5214ce0
        fi
        linux /boot/vmlinuz-2.6.32-5-686 root=UUID=5da3ae8c-6347-4402-9d0a-e8b1d5214ce0 ro quiet
        initrd /boot/initrd.img-2.6.32-5-686
}

menuentry 'Debian GNU/Linux (8.1) (on /dev/sdb4)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-58737a29-7851-4f74-b210-9e03a3a31a75' {
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos4 --hint-efi=hd1,msdos4 --hint-baremetal=ahci1,msdos4  58737a29-7851-4f74-b210-9e03a3a31a75
        else
          search --no-floppy --fs-uuid --set=root 58737a29-7851-4f74-b210-9e03a3a31a75
        fi
        linux /boot/vmlinuz-3.16.0-4-686-pae root=UUID=58737a29-7851-4f74-b210-9e03a3a31a75 ro quiet
        initrd /boot/initrd.img-3.16.0-4-686-pae
}
Can the format of the external drive be the problem?

Last edited by hilltownboy; 11-22-2016 at 01:23 PM.
 
Old 11-22-2016, 03:38 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
I understood that you had some Linux (Debian?) installed on the internal drive. The info in your last post only mentions two Debian installs on sdb, is that your external drive? Which systems grub.cfg are posting? Might be best to run boot repair and post a link to the pastebin where the output goes, just use the Create Bootinfo Summary and don't make any changes.
 
Old 11-23-2016, 05:58 PM   #9
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

Original Poster
Rep: Reputation: 15
yancek, the above #7 is in direct response to your #6 re check and compare. The first part is the blkid on two partitions with Debian OSs on the sdb, the external drive.

The second part are the sda grub.cfg sections applicable to those two partitions. These are from grub.cfg on Debain8 on the internal drive, which establishes the grub menu which shows all partitions on both drives and will boot those on sda but not those on sdb.

I couldn't find Boot Repair in the Debian repository and am not too keen on installing non-Debian programs.
 
Old 11-24-2016, 06:29 AM   #10
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Quote:
I couldn't find Boot Repair in the Debian repository and am not too keen on installing non-Debian programs.
Then don't install it on Debian. If you look at the page of the link I posted, it explains that you can download it and burn it to a CD/flash drive which will be bootable and you can use it that way. Your output of the blkid and the grub.cfg file show the correct uuid's so the problem lies elsewhere.
 
Old 11-24-2016, 11:55 AM   #11
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
If the external usb drive is /dev/sdb then there should be additional grub2 modules to handle usb storage. The two Linux menu entries for grub on the internal drive should have the lines

insmod usbms
insmod ehci

older setups may use uhci or ohci instead. You could load all three if you don't know which one you need. Basically you need to add grub2 USB mass storage support as well as a module for the USB controller interface.

This appears to be a bug with grub2 mkconfig where it either doesn't realize a drive is on usb and thus add the necessary modules or it expects the usb support to be provided transparently by the motherboard firmware. I have read about a similar bugs on Ubuntu and other dist. where they were getting the exact same error messages

no such device: <uuid of the particular device>
hdx cannot get C/H/S values
you need to read the kernel first

grub can't find the uuid on /dev/sdb on usb drive as the usb support modules haven't been added.

Edit the grub.cfg by hand and add

insmod usbms
insmod ehci
insmod uhci
insmod ohci

It it works you can then remove the two unneeded hci modules through commenting out and testing. It should be mentioned that these problems wouldn't occur if you had an eSATA external drive.
 
Old 11-24-2016, 06:54 PM   #12
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
Just a fyi: I had 'auto-magic' success with it here. Best wishes!
 
Old 11-25-2016, 03:35 PM   #13
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

Original Poster
Rep: Reputation: 15
Question

tofino_surfer, many thanks for your advice. I added the insmod ubsms and insmod ehci lines to the grub.cfg section on the internal drive for booting the external sdb4 partition, which is what you suggested if I understand correctly.

Result: nothing at all would boot, with in every case the error message to the effect that (hd0,msdos8) not found. That's the address for the internal Debian8 that has the active grub.cfg. This is what I did:

Code:
menuentry 'Debian GNU/Linux (8.1) (on /dev/sdb4)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-58737a29-7851-4f74-b210-9e03a3a31a75' {
        insmod usbms
        insmod ehci
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos4 --hint-efi=hd1,msdos4 --hint-baremetal=ahci1,msdos4  58737a29-7851-4f74-b210-9e03a3a31a75
        else
          search --no-floppy --fs-uuid --set=root 58737a29-7851-4f74-b210-9e03a3a31a75
        fi
        linux /boot/vmlinuz-3.16.0-4-686-pae root=UUID=58737a29-7851-4f74-b210-9e03a3a31a75 ro quiet
        initrd /boot/initrd.img-3.16.0-4-686-pae
grub ls did not list any partitions other than hd0,msdos8 not found. I tried the uhci and ohci alternatives and found the same result.

I did check that both usbms and ehci modules are available in my Debian8, although not shown as loaded (lsmod).

Last edited by hilltownboy; 11-25-2016 at 03:57 PM.
 
Old 11-26-2016, 02:07 PM   #14
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
>>>Result: nothing at all would boot, with in every case the error message to the effect that (hd0,msdos8) not found. That's the address for the internal Debian8 that has the active grub.cfg.

I have done some more searching and there have been changes between grub 2.00 and 2.02. There is a new command 'nativedisk' that you should use instead of loading the usb modules separately. What is happening currently is that if you load a grub2 usb driver it disables the biosdisk functions and you no longer have access to the SATA drive where (hd0,msdos8) is located. The message below mentions this:


https://www.mail-archive.com/search?...2&o=newest&f=1

The command nativedisk loads native drivers for many interface types if no arguments are given. However it changes all of the device names so that (hd0,msdos8) becomes (ahci1,msdos8) for a SATA disk. The grub prefix will also be changed. I tried this myself and all of the 'hd' became 'ahci'. I don't have any usb disks attached but they may show up as ehci or uhci.

Use the command nativedisk instead of the two insmod commands. As the names change try the command nativedisk followed by ls in your grub shell before attempting t edit your grub.cfg. Not only will SATA device names change to ahci but your usb drive may be detected as the modules are added by nativedisk. As said they may show up as ehci or uhci. Let me know if this works.
 
Old 11-26-2016, 02:14 PM   #15
hilltownboy
Member
 
Registered: Jan 2008
Location: Ashfield, MA
Distribution: Debian 11 "Bullseye", Arch
Posts: 123

Original Poster
Rep: Reputation: 15
As mentioned, partitions on the external drive had copies, not original installations, of various OS, mostly debian. I just put an original installation of Debian8-1 on the first external partition and updated grub on the internal drive. Lo and behold, not only does the grub menu (internal drive) boot Debian8-1 (external drive), but also now grub ls lists all of the external drive partitions.

However, if the BIOS is set to boot from the external disk the non-system disk error appears and the system is frozen.

I'm marking this as solved even though I don't pretend to understand it.
 
  


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
RedHat won't detect external hard-drive garfobo Linux - Hardware 17 12-05-2016 01:35 PM
Can't get my external USB floppy drive to detect media Cyberman Linux - Hardware 4 07-04-2014 03:00 PM
[SOLVED] How do I detect and mount an external hard drive through my router? Buckeye1999 Linux - Newbie 10 01-12-2010 10:54 PM
External hard drive system not detect right size stefane321 Linux - Hardware 1 12-01-2009 03:09 PM
Grub won't detect my second hard drive pumpkin7593 Linux - Software 2 04-25-2004 01:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:22 PM.

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