LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Losing Windows boot on dual boot Windows/Ubuntu machine (http://www.linuxquestions.org/questions/linux-newbie-8/losing-windows-boot-on-dual-boot-windows-ubuntu-machine-826934/)

windows22 08-18-2010 03:51 AM

Losing Windows boot on dual boot Windows/Ubuntu machine
 
I have been using Ubuntu since 9.04 (now on 10.04). Linux is installed from the CD after Windows has been installed (I have had Vista in the past, now I have Win98 SE). It's a test machine for Win and Linux.

I've noted that the Win boot ability never lasts more than a few months. Directly after a Linux update the Windows entry at boot time becomes "unknown operating system".

In the past I have uninstalled Ubuntu, reinstalled Windows then reinstalled Ubuntu, But is there an easier way? Can I edit a grub record on Linux or similar? And why does this keep happening?


Thanks

John VV 08-18-2010 04:24 AM

??? can win 98 even run on the same computer as ubuntu 10 ?

dose grub2 even support win 98 ?

did you add the boot partition for 98 to grub ? (hd0,0) I am assuming

what is the output of
Code:

su -
fdisk -l


windows22 08-19-2010 01:42 AM

Quote:

Originally Posted by John VV (Post 4069962)
??? can win 98 even run on the same computer as ubuntu 10 ?

dose grub2 even support win 98 ?

did you add the boot partition for 98 to grub ? (hd0,0)

I just follow the instructions to dual boot with Windows that come with the Ubuntu CD. As I said, same problem with Vista.

Quote:

Originally Posted by John VV (Post 4069962)
what is the output of
Code:

su -

Authentication failure even after running sudo to do something

Quote:

Originally Posted by John VV (Post 4069962)
Code:

fdisk -l

No output at all.

can someone help further. Note that Windows doesn't disappear after running Windows but after running Ubuntu where an update has occurred.

Thanks

yancek 08-19-2010 11:25 AM

What are you updating? Are you updating the kernel? I'm not an Ubuntu user nor do I use Grub2, but you may have to do an update grub after making these type changes.

What is your windows entry in Grub? /boot/grub/grub.cfg?

Do you get output from sudo fdisk -l?

windows22 08-19-2010 05:31 PM

Quote:

Originally Posted by yancek (Post 4071357)
What are you updating? Are you updating the kernel? I'm not an Ubuntu user nor do I use Grub2, but you may have to do an update grub after making these type changes.

What is your windows entry in Grub? /boot/grub/grub.cfg?

Do you get output from sudo fdisk -l?

The update is the system update from Update Manager that you are "supposed" to do when it pushes to you.

Here is output from sudo fdisk -l

Code:

Disk /dev/sda: 10.3 GB, 10262568960 bytes
255 heads, 63 sectors/track, 1247 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6b736964

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        284    2281198+  c  W95 FAT32 (LBA)
/dev/sda2            285        1247    7735297+  5  Extended
/dev/sda5            285        1225    7558551  83  Linux
/dev/sda6            1226        1247      176683+  82  Linux swap / Solaris

/boot/grub/grub.cfg does not exist (I am showing hidden files/folders).

Thanks

syg00 08-19-2010 08:09 PM

For any command (except su -, don't use that at all on Ubuntu) that doesn't work, try sticking "sudo" in front of it. That will get you around Ubuntus lame "security" implementation.
I'm surprised the updates keep affecting you - try "sudo update-grub" to force the search for other operating systems. This will rebuild the boot menu - should be done automatically each update. The config file you are looking for is /boot/grub/grub.cfg - don't edit it directly.
I don't have a Ubuntu systems handy, but the following should show us the relevant parts of that file
Code:

sudo sed -n '/30_/,/30_/p' /boot/grub/grub.cfg

yancek 08-20-2010 11:16 AM

What is the status of the machine now? Are you able to boot Ubuntu? but not W98? I would expect that neither would boot if you don't have a /boot/grub/grub.cfg file? Did you install Grub to the mbr with the 10.04 installation? Do you have a menu.lst file in /boot/grub/ direc
tory?

windows22 08-21-2010 01:37 AM

Quote:

Originally Posted by yancek (Post 4072482)
What is the status of the machine now? Are you able to boot Ubuntu? but not W98? I would expect that neither would boot if you don't have a /boot/grub/grub.cfg file? Did you install Grub to the mbr with the 10.04 installation? Do you have a menu.lst file in /boot/grub/ direc
tory?

Thanks. Yes I can boot ubuntu but not W98. Don't recall what I did with 10.04 install but I could boot W98 until recently. I have /boot/grub/menu.lst. Should I attach it?

windows22 08-21-2010 01:46 AM

Quote:

Originally Posted by syg00 (Post 4071798)
For any command (except su -, don't use that at all on Ubuntu) that doesn't work, try sticking "sudo" in front of it. That will get you around Ubuntus lame "security" implementation.
I'm surprised the updates keep affecting you - try "sudo update-grub" to force the search for other operating systems. This will rebuild the boot menu - should be done automatically each update. The config file you are looking for is /boot/grub/grub.cfg - don't edit it directly.
I don't have a Ubuntu systems handy, but the following should show us the relevant parts of that file
Code:

sudo sed -n '/30_/,/30_/p' /boot/grub/grub.cfg

Thanks. As expected, the above command can't find grub.cfg.

sudo update-grub can't seem to find W98:

Code:

Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.32-24-generic
Found kernel: /boot/vmlinuz-2.6.32-23-generic
Found kernel: /boot/vmlinuz-2.6.32-22-generic
Found kernel: /boot/vmlinuz-2.6.32-21-generic
Found kernel: /boot/vmlinuz-2.6.31-20-generic
Found kernel: /boot/vmlinuz-2.6.28-11-generic
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

Can Ubuntu be fooled by adding a grub.cfg based on the fdisk -l output?

yancek 08-21-2010 02:47 PM

In your post #5, you indicate that /boot/grub/grub.cfg does NOT exist!
In your last post, you indicate you have a /boot/grub/menu.lst file. This, I would expect to be from an earlier Ubuntu install. Post it here:

you should have a title entry for windows 98 similar to:

title windows98
rootnoverify (hd0,0)
chainloadder +1

It seems your Grub to from Ubuntu 10.04 wasn't successfully installed to the mbr??

windows22 08-21-2010 06:47 PM

1 Attachment(s)
Quote:

Originally Posted by yancek (Post 4073481)
In your post #5, you indicate that /boot/grub/grub.cfg does NOT exist!
In your last post, you indicate you have a /boot/grub/menu.lst file. This, I would expect to be from an earlier Ubuntu install. Post it here:

you should have a title entry for windows 98 similar to:

title windows98
rootnoverify (hd0,0)
chainloadder +1

It seems your Grub to from Ubuntu 10.04 wasn't successfully installed to the mbr??

menu.lst attached as menu.txt. It contains

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Windows 95/98/Me
rootnoverify (hd0,0)
savedefault
makeactive
chainloader +1


Obviously I did not delete grub.cfg. Perhaps that is what has to be recreated?

Thanks

Erik_FL 08-21-2010 07:28 PM

You are experiencing a common problem with Vista.

Vista uses a Microsoft boot loader called "bootmgr". It uses a boot configuration database (BCD) in the "boot" folder of the first primary partition. That database identifies the partition containing the boot manager "bootmgr" and the one containing Windows. There are different ways that it can identify the partitions and usually that is by a serial number or unique ID. Unfortunately things that modify the partition table or master boot record (MBR) can change the serial number since those bytes are in a previously unused part of the MBR sector.

A way around the problem is to change how Windows boot database identifies partitions.

To do that you can use the "BCDEDIT" program in Windows Vista and then enter some commands to change the configuration.

First, you have to start a command prompt as an Administrator. Click on the start menu, then Programs or All Programs. Click on the Accessories folder. Right click on the "Command Prompt" in the menu and then (left) click on "Run as administrator".

To display the current boot configuration you can use this command.

bcdedit /enum all

You can change the device designations for the boot loader and Windows OS to accept whatever partition was used to start the boot manager as a valid Windows partition.

bcdedit /set {bootmgr} device boot
bcdedit /set {current} device boot
bcdedit /set {current} osdevice boot


The above will work ONLY if you have the Windows boot manager and the Windows operating system in the first primary partition. If you have Windows in the second, third, fourth or anything other than the first primary partition you should not do this. With some BIOS drive ID substitution in GRUB it is possible to make other partitions work but it's tricky.

Normally Windows makes settings like this, and they depend on the disk serial numbers to identify drive letters.

bcdedit /set {bootmgr} device partition=c:
bcdedit /set {current} device partition=c:
bcdedit /set {current} osdevice partition=c:


The misleading thing is that the boot database does not actually contain the drive letter "c:". It contains a disk serial number. If that somehow changes windows will show the device as "unknown" and will no longer boot.

You can find more information and examples on-line by searching for "bcdedit".

Also, the program has built-in help.

bcdedit /?
bcdedit /? /set
bcdedit /? types
bcdedit /? formats


If you think that the commands are confusing, many other people including programmers also agree with you.

Windows Setup always puts "bootmgr" and the boot database in the first primary partition on the first hard disk, no matter where you install the Windows operating system. The Windows operating system files may be stored in some other partition as indicated in the boot configuration database.

bcdedit /set {bootmgr} device partition=c:
bcdedit /set {current} device partition=d:
bcdedit /set {current} osdevice partition=d:


You may wonder why a device designation is needed for "bootmgr". Although "bootmgr" will always be installed to the first primary partition, that partition might not have the drive designation of c: in Windows. Also, drive "c:" is only valid if Windows knows the partition serial number of some partition as drive letter c. It is possible to move the "bootmgr" and "boot" folder somewhere else, as long as the boot configuration is updated to reflect the correct information. However, you can't tell Windows Setup to install it somewhere else. You have to move the files later after installing Windows.

The things in curly braces are identifiers for boot database (and menu) entries. Some of them have simple aliases like "{current}" but all of them have a unique numeric ID similar to this.

{cbd49292-9d4a-11df-8857-aef606616986}

You can use the mouse copy and paste functions for the command prompt window to avoid typing in the long ID numbers if there is no short alias for an entry.

To see the long versions of IDs even for the commonly used entries use this command.

bcdedit /enum all /v

There are some common aliases defined that you can use.

{bootmgr} The alias for the boot manager's entry
{current} The currently booted Windows operating system's entry
{ntldr} The entry for the Windows NT/XP boot loader

If you have a Microsoft version of the Windows Vista Setup CD then you can use the command mode of the boot CD to enter BCDEDIT commands even if Windows won't boot from the hard disk. Press F10 at a Setup screen to get into the command prompt. You can find information about the other System Recovery commands on the Microsoft site.

windows22 08-21-2010 09:57 PM

Erik FL, Thanks but I am no longer on Vista. Win 98 is what I now need to boot into , but Ubuntu updates seemed to break boot into Vista same as boot into W98.

Obviously at the moment I can't boot into Windows at all.

John VV 08-21-2010 10:58 PM

i would start over
reformat the drive into two partitions
win 98 ??? is fat32 - right ? or was it able to use ntfs ?

well fat32 will be safe for win98
then ext3 for ubuntu

install win98 on the first partition
with the win 98 bootloader ON THE MBR !!!!
get win 98 working
seeing as there has been NO support for 98 in a very long time i do not think it will be able to run a first update . Ot that the web browser will even work .

install ubuntu to the ext3 partition
WITH A /boot partition
install grub/lilo to the boot partition ( the FIRST LINUX partition )
install ubuntu
reboot using the ubuntu install dvd as a rescue disk and after you " chroot /mnt/sysimage"

then fallow any tutorial using dd command
-- something like this --
[code]
dd of=/dev/sda3 if=/ubuntu.bin bs=512 count=1
[code]
copy ubuntu.bin to the win98 C:\\ drive
ubuntu should be able to auto mount a fat partition
and edit the win98 boot.ini

like you would for xp

this uses the windows bootloader to start grub

windows22 08-21-2010 11:15 PM

Quote:

Originally Posted by John VV (Post 4073764)
ubuntu should be able to auto mount a fat partition
and edit the win98 boot.ini

Hi

Yes win 98 is FAT32. And it is a hassle getting an update to IE 6 to make the browser and other things work, which is why I don't especially want to do that again. I will say "Win 98 boot time 20 seconds, Ubuntu 10.04 about 50 seconds without installing anything extra." And yes Win 7 is about the same as Ubuntu.

Clearly Ubuntu isn't capable of maintaining boot records properly, so I was really hoping for a way of editing the Linux grub system so it can boot the Win OS that is already there.

Does anything in your proposal prevent Ubuntu screwing this up again? I am not a Linux guru. I expect a distro these days to work with the instructions you see on the screen, not use command lines. Otherwise people just go back to Windows I think, if they want it at all.

Does anyone have the .cfg file I am missing dual booting with some win version that gives me an idea what it should contain?

Edit: If it helps, I can write to the Windows file system from Ubuntu.

Thanks


All times are GMT -5. The time now is 09:07 AM.