LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-30-2016, 03:28 AM   #1
Paolopd
Member
 
Registered: Mar 2010
Distribution: Linux Mint 19.2
Posts: 56

Rep: Reputation: 0
[unsolved] Grub, confusing HD


Hi there,
I have some trouble with Grub.
I have 3 HD: 1 for Debian, 1 for Xp and 1 for Xp_Game. When Updating grub it recognize all 2 XP (it seems!), but when choosing one of Xp variants it opens only one of them.
In the grub.cfg both Xp installations are seeing with the same UUID, and this is not correct.
Looking deep to find out which are the correct UUID I guess the same result:
Quote:
esa@debian:~$ sudo blkid
[sudo] password di esa:
/dev/sda1: UUID="C0A4B867A4B86218" TYPE="ntfs" PARTUUID="eaaeeaae-01"
/dev/sda5: LABEL="Volume" UUID="46AC1227AC1211D3" TYPE="ntfs" PARTUUID="eaaeeaae-05"
/dev/sdb2: UUID="4204D9FA58C1A2DD" TYPE="ntfs" PARTUUID="000b3f5d-02"
/dev/sdb5: LABEL="Volume" UUID="64AC138AAC1355C0" TYPE="ntfs" PARTUUID="000b3f5d-05"
/dev/sdb1: UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="000b3f5d-01"
/dev/sdb3: UUID="b708d2a5-7eb3-4f29-becd-610515c79754" TYPE="ext3" PARTUUID="000b3f5d-03"
/dev/sdc1: LABEL="WxP" UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="4b879f19-01
The 2 number bolded are those where are installed windows XP.
The question is how can I solve this matter?

Thank you for your suggestions.

Last edited by Paolopd; 08-03-2016 at 02:50 AM.
 
Old 07-30-2016, 03:43 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,695

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
How was the second copy of XP created ? - dd ?.
 
Old 07-30-2016, 04:25 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,907

Rep: Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510
As far as I know, grub does not and can not read ntfs.
 
Old 07-30-2016, 06:05 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 9,383

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
In the grub.cfg both Xp installations are seeing with the same UUID, and this is not correct
It isn't necesary to use a UUID in grub.cfg. You can use the device name for the partition on the set root line with a simple chainloader entry. This is because Grub does not read ntfs partitions. I'd be curious to know how this happened other than dd or cloning?
 
Old 07-31-2016, 02:48 AM   #5
Paolopd
Member
 
Registered: Mar 2010
Distribution: Linux Mint 19.2
Posts: 56

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
How was the second copy of XP created ? - dd ?.
I made a new installation for the second Xp disconnecting other hds
 
Old 07-31-2016, 09:21 AM   #6
Paolopd
Member
 
Registered: Mar 2010
Distribution: Linux Mint 19.2
Posts: 56

Original Poster
Rep: Reputation: 0
Looking to solve this matter I have tried to see which are the UUID and from console:

Code:
blkid: 
/dev/sdc1: LABEL="WxP" UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="4b879f19-01"
/dev/sdb1: UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="000b3f5d-01"
The question is curios: why this command read "LABEL" in sdc1, while in sdb1 read the UUID?

Second question.
looking into windows boot.ini of both Xp installed I have noticed that square brackets from the first row is missing. Here an example:
Code:
boot loader]
timeout=1
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP
Professional" /noexecute=optin /fastdetect
Can anybody tell me if this is a a way that grub use to load ownself?

Thank

Last edited by Paolopd; 07-31-2016 at 09:26 AM.
 
Old 07-31-2016, 01:18 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,907

Rep: Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510
I just noticed that those "UUID" you list are not complete... a UUID should be 32 digits long... Yours show only half that many.
 
Old 07-31-2016, 01:20 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 9,383

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
looking into windows boot.ini of both Xp installed I have noticed that square brackets from the first row is missing. Here an example:
Could you explain specifically what happens when you select the 2nd entry for xp? From your original post, it would appear that you have two menuentries for xp in the Grub menu, is that correct? Also, apparently one boots and the other fails, correct? What exactly happens when you select the second entry which does not boot?

I have an old netbook with xp and booted Linux on that machine and removed the bracket in the boot.ini file on xp and rebooted xp. On selecting xp, I get a message: windows could not boot because the following file is missing or corrupt: system32\\hal.dll. Rebooted Linux and replaced the bracket in the boot.ini file and then rebooted xp successfully. Do you get this message or some other message?

Grub does not 'boot' and windows. Basically what happens is the entry for windows in Grub points to a specific point on the xp (windows) partition where the boot code needs to be and booting is turned over to the windows system. That is basically what chainloading is.

What are the xp entries in the Debian grub.cfg file? Can you post them here.
 
Old 07-31-2016, 01:22 PM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,907

Rep: Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510
Quote:
Originally Posted by Paolopd View Post
Looking to solve this matter I have tried to see which are the UUID and from console:

Code:
blkid: 
/dev/sdc1: LABEL="WxP" UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="4b879f19-01"
/dev/sdb1: UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="000b3f5d-01"
The question is curios: why this command read "LABEL" in sdc1, while in sdb1 read the UUID?

Second question.
looking into windows boot.ini of both Xp installed I have noticed that square brackets from the first row is missing. Here an example:
Code:
boot loader]
timeout=1
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP
Professional" /noexecute=optin /fastdetect
Can anybody tell me if this is a a way that grub use to load ownself?

Thank
I don't think so. Grub requires the use of the chain loader to load a windows loader that can then load XP. The section you are showing doesn't do that.

A reference (xubuntu getting xp booted);https://ubuntuforums.org/showthread.php?t=2000951
 
Old 07-31-2016, 03:57 PM   #10
Paolopd
Member
 
Registered: Mar 2010
Distribution: Linux Mint 19.2
Posts: 56

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by yancek View Post
Could you explain specifically what happens when you select the 2nd entry for xp? From your original post, it would appear that you have two menuentries for xp in the Grub menu, is that correct? Also, apparently one boots and the other fails, correct? What exactly happens when you select the second entry which does not boot?
Nothing! Just a black screen with a blinking cursor. For that reason I have supposed that the order in the bios was not correct, but nothing.
Code:
I have an old netbook with xp and booted Linux on that machine and removed the bracket in the boot.ini file on xp and rebooted xp.  On selecting xp, I get a message:  windows could not boot because the following file is missing or corrupt:  system32\\hal.dll.  Rebooted Linux and replaced the bracket in the boot.ini file and then rebooted xp successfully.  Do you get this message or some other message?
I didn't get any bad message, just a black screen

Quote:
What are the xp entries in the Debian grub.cfg file? Can you post them here.
For sure here is what I have:

Code:
menuentry 'Windows NT/2000/XP (su /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-5E70A7E470A7C0DF' {
	insmod part_msdos
	insmod ntfs
	set root='hd1,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd1,msdos1'  5E70A7E470A7C0DF
	else
	  search --no-floppy --fs-uuid --set=root 5E70A7E470A7C0DF
	fi
	parttool ${root} hidden-
	drivemap -s (hd0) ${root}
	chainloader +1
}
menuentry 'Windows Xp_Game (su /dev/sdb1)' --class windows --class os $menuentry_id_option 'osprober-chain-5E70A7E470A7C0DF' {
	insmod part_msdos
	insmod ntfs
	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  5E70A7E470A7C0DF
	else
	  search --no-floppy --fs-uuid --set=root 5E70A7E470A7C0DF
	fi
	parttool ${root} hidden-
	drivemap -s (hd0) ${root}
	chainloader +1
But I have noticed another strange thing: every time I try to digit the command in the console "update-grub" I have different indication on where are stored the 2 XP installations. Like this:

Code:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Trovata immagine linux: /boot/vmlinuz-4.4.0-1-amd64
Trovata immagine initrd: /boot/initrd.img-4.4.0-1-amd64
Trovato Windows NT/2000/XP su /dev/sda1
Trovato Windows Xp_Game su /dev/sdb1

Last edited by Paolopd; 07-31-2016 at 06:13 PM.
 
Old 07-31-2016, 06:26 PM   #11
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 9,383

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
The menuentries posted from the grub.cfg file not only use the same UUID but have the same set root line; 'hd1,msdos1' which is why it only boots the one instance of xp. Your update-grub output shows one xp on sda1 and the other on sdb1 so only the sdb1 has a menuentry; sdb1 is equal to hd1,msdos1. You don't need everything in that menuentry so change one of the entries to the following and leave the other as is:

Code:
menuentry 'Windows NT/2000/XP (su /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-5E70A7E470A7C0DF' {
	insmod part_msdos
	insmod ntfs
	set root='hd0,msdos1'
	chainloader +1
}
The above entry should work if you just change it in the grub.cfg file in a text editor as root (using sudo) and save the change. Do NOT run update-grub but just reboot to test it.

In order for this to work, you will need a correct boot.ini file on both xp installs and the one that appears to be the problem is on sda1. You need to change the file so it points to the correct disk/partition. I'm not sure as I don't really use xp but I expect you would have to change both the line beginning with 'default' as well as the one beginning with 'multi', at least the disk entry. The xp on sdb1 needs the disk indicated as a 1, the partition can remain. The boot.ini on sda1 should have disk as 0 and partition as 1. Grub2 and windows both count physical hard drives from zero and partitions from one. I would also add the beginning bracket to whichever boot.ini file is missing. It might be a good idea to do an online search for proper entries in boot.ini or
check at a windows forum.

Last edited by yancek; 07-31-2016 at 06:37 PM.
 
1 members found this post helpful.
Old 08-03-2016, 02:49 AM   #12
Paolopd
Member
 
Registered: Mar 2010
Distribution: Linux Mint 19.2
Posts: 56

Original Poster
Rep: Reputation: 0
@Yancek

Thank you for your suggestion, but due to my frustration I have erased the second partition of Xp: too many problems!
But the facts more embarrassing was grub: everytime I digit "udate-grub" it changes the address of the disks and since I am not an expert I preferred to save what is working in the other 2 disks instead to lose every data.
I am sorry if I have made some trouble.

Thank you again.
 
Old 05-26-2017, 09:12 AM   #13
Paolopd
Member
 
Registered: Mar 2010
Distribution: Linux Mint 19.2
Posts: 56

Original Poster
Rep: Reputation: 0
Finally I realized that grub read the hard drive from "udev" and udev is not very much reliable. I should have to set the "disk-id" while disk-id is unique instead the way as grub use.
 
Old 05-26-2017, 10:48 PM   #14
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 472

Rep: Reputation: 150Reputation: 150
Quote:
I just noticed that those "UUID" you list are not complete... a UUID should be 32 digits long... Yours show only half that many.
This is because the UUIDs of Windows filesystems such as NTFS are shorter than those of Linux filesystems such as ext4 or xfs. This is normal.

Quote:
blkid:
/dev/sdc1: LABEL="WxP" UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="4b879f19-01"
/dev/sdb1: UUID="5E70A7E470A7C0DF" TYPE="ntfs" PARTUUID="000b3f5d-01"

The question is curious: why this command read "LABEL" in sdc1, while in sdb1 read the UUID?
It is simply because sdb1 does not appear to have a user defined label. If you count the fields for both you will see that sdc1 has four fields while sdb1 has only three. They both have UUIDs.

sdc1: LABEL, UUID, TYPE, PARTUUID
sdb1: UUID, TYPE, PARTUUID

To confirm this create a label for sdb1 and run blkid again. The command ntfslabel can read existing labels and set new ones.

To read: ntfslabel /dev/sdb1

To set new label:

ntfslabel device label
ntfslabel /dev/sdb1 new-label

Quote:
As far as I know, grub does not and can not read ntfs.
Really ? From the grub2 documentation

Many more file systems are supported, including but not limited to ext4, HFS+, and NTFS.

A module can register filesystem drivers (eg ext2, reiserfs, befs, ntfs). Note that at least one filesystem driver module is embedded in core.img so the files in directory /boot/grub can be read. Filesystem drivers cannot be auto-loaded; the “insmod” command must be used to explicitly load the necessary modules. The filesystem driver modules for Grub support reading only; Grub does not need to write data back to the filesystem during boot, and skipping write support makes the modules a lot smaller and easier to implement.

Support multiple filesystem types

Support multiple filesystem types transparently, plus a useful explicit blocklist notation. The currently supported filesystem types are ...
NTFS (including compression)

menuentry "Windows" {
insmod chain
insmod ntfs
set root=(hd0,1)
chainloader +1
}

Last edited by tofino_surfer; 05-27-2017 at 04:01 AM.
 
Old 05-27-2017, 04:11 PM   #15
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
Ideally you would need to change the UUIDs to be "unique". Which you would probably have to do under windows, since it's NTFS. Then update your grub and it should work. As long as that doesn't make XP grumpy. Never done that myself since winME was the last version of windows I ever kept actively installed on a system. The winME version broke loadlin (old way of booting linux using the windows boot loader), which was the last straw for me, no more windows.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
I am confusing ram_rajavarapu Linux - Enterprise 3 11-12-2008 06:54 PM
very confusing metallica1973 Linux - Software 5 08-07-2006 07:21 PM
this is so confusing!! theguitarness Linux - Newbie 5 03-07-2006 10:53 PM
so confusing c12ayon Programming 5 10-26-2003 11:52 PM
Very confusing rm Luc Linux - Newbie 3 11-04-2002 01:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:33 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