LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't install GNU/Linux after connecting external USB harddrive. (https://www.linuxquestions.org/questions/linux-newbie-8/cant-install-gnu-linux-after-connecting-external-usb-harddrive-564720/)

NomDeGuerre 06-26-2007 09:54 PM

Can't install GNU/Linux after connecting external USB harddrive.
 
I connected an external usb drive to my computer and the next time I started it I got this message after choosing Ubuntu 7.04 or Windows XP in GRUB: "Error 29: Disk write error". Used XP disc to do fixboot and fixmbr which got Windows started. When I try to install Debian or Ubuntu I get this at the part where I accept partition changes: "Input/output error during write on /dev/hdb ERROR!!!" on Ubuntu and "Input/output error during read on /dev/ide/host0/bus0/target1/lun0/disc ERROR!!!" on Debian. dmesg gives me several: "end_request: I/O error, dev hdb, sector" and then a number. There were lots of 0 and 8 and a few 74252424. I just reformatted the drive with XP cd and installed XP, I also tried loading the optimized and then fail-safe defaults on BIOS but I *still* get that message when I get to the part where I accept partition changes, so I can't install either Debian or Ubuntu. Any ideas on what the problem is?

AceofSpades19 06-27-2007 12:37 AM

grub probably changes the lettering and numbering of the harddrive when the external one is plugged it

b0uncer 06-27-2007 12:44 AM

Quote:

"Input/output error during write on /dev/hdb ERROR!!!"
But shouldn't hdb refer to a secondary IDE harddisk, rather than USB, which should be referred to as sda (in case the internal harddisk is IDE disk, hda), or if the internal disk was SATA disk (sda), then the external should be sdb and not hdb, again?

Also I would find it odd that GRUB changed lettering/numbering all of a sudden. Those errors do seem to be caused by a malfunctioning (as in "not functioning quite the way it should") secondary (hard)disk, but if you plug the USB drive out, then shouldn't the problems vanish? Do they?

NomDeGuerre 06-27-2007 07:21 AM

GRUB was installed in master boot record so how can it still cause problems if I've done fixmbr with the Windows XP cd and even reinstalled?

Yes hdb refers to my internal IDE harddrive which is plugged in as slave (no reason for that other than that's how it turned out when I plugged it in the first time). I also have two other harddrives, sda and sdb, one which was /home and one which was only /media/sdb which contained everything I couldn't fit in /home.

The external usb harddrive isn't plugged in, it only was for a short while. It had ntfs and I got a message that I didn't have permission to write to it, even when I was root, so I just gave up.

saikee 06-27-2007 10:25 AM

Normally to boot a USB device you must instruct the Bios to boot it first. That gives the first bootable disk status to it. Therefore the MBR would be in the first sector of the USB disk.

The internal disk will not boot properly because it will be relegated to the second bootable disk status but all the OS were installed as the first boot disk.

Also the USB device may not get the sda status as this is dependent on the relationship between the mobo connection and the Bios. Even if it is a sdc in Linux it can still be the first boot disk (hd0) to Grub.

One needs to know how the boot disk order work reasonably well before trying to boot from a USB device.

In general the sda, sdb, sdc etc are location-dependent and don't get changed once plugged but the disk order is one freely specifies in the Bios.

Also SCSI/Sata/USB system names the disks consecutively. Thus removing sdb disk in the middle will force the one following sdc to take up its name.

In case of doubt boot up a Live CD and type in root terminal

Code:

fdisk -l
will show all partitions of every disk in Linux notation.

Code:

grub
geometry (hd0)
geometry (hd1)
geometry (hd2)
geometry (hd3)
etc and so on

show up the partitions of 1st, 2nd, 3rd and 4th disk.

That is the way to get the information from the horse's mouth, getting Linux and Grub to report how each sees your disks.

NomDeGuerre 06-27-2007 12:22 PM

I didn't try to boot from the USB hard disk. It was brand new and I connected it to move some files over to it, didn't work so I just ejected it and unplugged it, that was the end of it. And it's not mine so no advice on how to get it to work now :) Also I don't mind if everything on hdb gets lost as long as I can install GNU/Linux on it, obviously Windows installs on it just fine but i don't want to use that.

This is the boot order for hard disks in BIOS:
Code:

1. Ch0 S.        :        ST340016A
2. Ch2 M.        :        ST3200822AS
3. Ch3 M.        :        HDS725050KLA360

First boot device is CD-ROM and second boot device is Hard Disk.

I forgot to do 'grub' but since I did fixmbr earlier I shouldn't have grub... right? Grub should be completely removed from my hard disk.

This is what i got from 'fdisk -l'
Code:

Disk /dev/sda: 200.0 GB 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device                Boot        Start        End        Blocks                Id        System
/dev/sda1                1        24321        195358401        83        Linux


Disk /dev/sdb: 500.1 GB 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device                Boot        Start        End        Blocks                Id        System
/dev/sdb1                1        60801        488384001        83        Linux


Disk /dev/hdb: 40.0 GB 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device                Boot        Start        End        Blocks                Id        System
/dev/hdb1        *        1        4864        39070048+        7        HPFS/NTFS


saikee 06-27-2007 12:56 PM

Don't kid yourself. The fixmbr merely overwrite the MBR which is 512 bytes large or the first sector with MS 's MBR.

You can destroy Grub by nuking the Linux partitions which you have sda1 and sdb1.

You Windows can only boot if it was installed as the first disk and run as such. Your information doesn't tell us if the fisrt bootable disk is 400Gb or not.

You should do geometry command in a Grub shell as suggested in Post #5.

Seem to me you don't have an idea which of your 200Gb, 500Gb and 400Gb disk is the first bootable disk and could have restored the XP MBR to the wrong disk. In any case you haven't told us if your XP boots and you Linux doesn't have you?

Under the normal circumstance the Pata disk will automatically get the first boot disk status unless the user specified otherwise.

NomDeGuerre 06-27-2007 01:34 PM

Why would GRUB end up in sda or sdb when I installed Ubuntu on hdb and only used sda as /home ? Either way I can't nuke sda and sdb since that's where I keep everything, hdb was for OS only.

I had Ubuntu and Windows XP on hdb, my 40gb hard disk. When I did fixmbr with the Windows XP cd I had to choose which hard disk to do it to, and the only choice was C: (where XP was installed, which is hdb) so I didn't restore MBR on the wrong disk. Yesterday I formatted the whole disk to NTFS and installed Windows XP on it, it boots just fine. It did before too when Windows was in a partition and Ubuntu was in another, after I did fixmbr to get rid of GRUB that is. Before I had done fixmbr neither Ubuntu or Windows would start when I chose them in the GRUB menu.


ST340016A which is first in the BIOS boot order for hard disks is my 40gb hard disk and it is also bootable as you can see from the results that I got after doing 'fdisk -l'.

I put in the Debian cd and chose to execute a shell, when I typed in 'grub' I got this:

Code:

/bin/sh: grub: not found

saikee 06-27-2007 02:48 PM

OK you 1st disk is now Xp.

Thus to install and boot a Linux you can either

(1) Use Xp's boot loader NTLDR to boot Linux. Task E4 in the last link in my signature refers.

or

(2) Put another disk as first bootable disk. Install Linux or restore its boot loader. You then boot XP by switch the boot disk order on-the-fly, using commands inside Grub or Lilo. Section A of the second link of my signature refers

NomDeGuerre 06-27-2007 06:11 PM

Perhaps I misunderstand but I get the impression that to do nr. 1 I need to actually have GNU/Linux installed already (which I don't), is that right? If not, how will I get e.g. Ubuntu installed after doing those things if I can't even create a partition for it using the installation disc?


I don't want to keep Windows XP though, I'm just forced to use it.
What I want is to completely remove Windows XP, fix the problem (whatever it is), and install Ubuntu.

Nr 2. I can't do, my two other disks are full.

Tinkster 06-29-2007 03:53 PM

Have you tried using the system rescue CD or RIP or something
to see if they can re-partition hdb?


Cheers,
Tink

NomDeGuerre 07-02-2007 06:19 PM

I haven't tried those but I did just try cfdisk with an old Slackware 9.1 cd. I deleted the NTFS partition which took up the whole disk and made two 7gb partitions at the beginning and one 2gb swap at the end. Then I put in the Ubuntu cd and got to the partitioning program in that. The first 7gb partition was NTFS, I guess that's because cfdisk didn't actually format the partition only created it so the old stuff was still in it (though WinXP wouldn't boot properly afterwards since I messed the partitions up). So I choose to format the first partition to ext3 and at first it looked like it was going to work but then it stopped and gave me this message:

Failed to create a file system
The ext3 file system creation in partition #1 of IDEslave (hdb) failed.

I then tried to delete all the partitions (we're still in ubuntu installer) and choose to install Ubuntu on the entire disk (hdb) instead of manually setting up the partitions. I then get this error message:

The attempt to mount a file system with type ext3in IDE1 slave, partition #2 (hdb2) at / failed.


So now I've at least gotten to more error messages (clues?). We're making some progress! :)

AceofSpades19 07-02-2007 06:53 PM

you should just reformat and start from scratch

NomDeGuerre 07-04-2007 09:50 AM

Well that's the problem, I can't.

NomDeGuerre 07-05-2007 08:55 AM

When I tried installing Ubuntu on the entire disk (read post #12) I chose not to use sda and sdb so those weren't mounted but it still wouldn't work so obviously those are not part of the problem, right?

I have this in my notebook, I think it's from trying to install Slackware.

Code:

[!!] Install the base system
Base system installation error

The debootstrap program exited with an error (return value 1).
Check /var/log/syslog or see virtual console 4 for the details.

I checked virtual console 4 and saw several of these:

Code:

(here was date and time) kernel: [  197.017785] end_request : I/O error, dev hdb, sector 812653
The numbers 197.017785 and 812653 were different on each line.

saikee 07-05-2007 09:27 AM

You seems to be moving the goal posts while we are trying to understand your original problem.

Your propblem reported in Post #12 could be due not rebooting the machine after you had changed the partition table, especially when a foreign system (to Linux) is involved.

If you want to install Ubuntu in sdb , or any distro, just boot up the Ubuntu and use it as a Live CD. Use its cfdisk program, by command "sudo cfdisk /dev/sdb", to make two partition of sdb1 (10Gb) and sdb2 (1Gb), alter the partition type from 83 to 82 for sdb2, highlight "write", press retuen, exit cfdisk and type at terminal "sudo reboot".

After a reboot click hard disk installation and tell the installer you want Ubuntu installed in sdb1. This may require you highlight sdb1, edit it as the mounting pont for "/", select a filing system like Ext3, click "format" and the "OK".

I never had any problem if I had a partition arranged for installing any distro. Every installer will just get on with it and know what to do with the swap.

You should meet no resistance if you install Slackware.

NomDeGuerre 07-05-2007 11:37 AM

No I'm just showing the results I get when I try different stuff. The problem, which has been the same from the start, is that I can't install Linux on my IDE harddrive (hdb) which was probably caused by connecting an external usb harddrive earlier.

The Windows XP cd can change partitions and installs fine, the linux cd's can't change partitions and won't install.

It's not sda or sdb that I want to install to so forget those, both disks are full with stuff that I want to keep.

NomDeGuerre 07-15-2007 10:42 AM

bump and 10 characters

saikee 07-15-2007 11:07 AM

I don't really understand what problem you have got.

Why you keep wanting to install Linux into (hdb)?

Your post #6 tells us you have no hdb! Linux with kernel 2.6.20 and later see all IDE/Pata disk same as Sata and call them sda, sdb, sdc etc. Is this your problem, that you must use hdb name?

You can, just get hold of an older Linux with kernel older than 2.6.20.

NomDeGuerre 07-16-2007 03:39 PM

I want to install Linux into hbd because that's the harddrive I've been using for the operating system and my other two harddrives are comletely full. Post #6 clearly shows that I *do* have hdb.

Code:

Disk /dev/hdb: 40.0 GB 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device                Boot        Start        End        Blocks                Id        System
/dev/hdb1        *        1        4864        39070048+        7        HPFS/NTFS

The problem isn't that I have to use the hdb name but that hdb is the harddrive I want to use. I've tried to install Ubuntu Dapper Drake, Ubuntu Feisty Fawn, Slackware 10, Debian Etch, nothing works. I can only install Windows XP on the harddrive. The Linux cd's can't even reformat the harddrive, something the Windows XP cd can.

saikee 07-16-2007 04:36 PM

Are you missing something here by saying you can't format the drive?

Your hard disk has a ntfs partition occupying the the entire 40Gb. Therefore to install a Linux you need boot up a Linux Live CD to

(1) Delete the hdb1, just use terminal command "su", then "cfdisk /dev/hdb", highlight the partition and click "delete".

(2) Create two partitions, one 10Gb and another 1Gb, which will be hda1 and hda2 if primaries or hd6 and hda7 if they are logicals. Either way or in any combination. When you create a partition in a Linux Live CD it will automatically be Type 83 which is suitable for Linux. (NTFS is Type 7 and is NOT suitable for Linux installation) You highlight hda2 and select "type" to make it Type No. 82 for being a swap.

(3) highlight "write" and confirmed again with "yes". When done highlight "quit" and press return to leave cfdisk.

(4) Go for a reboot and you will find every Linux can be installed in hda1.

You don't format the partition. You leave it to the installer. The idea is you select hda1, ask it to be formatted in ext3 and mounted as "/" and the installer will put everything inside.

NomDeGuerre 07-17-2007 01:10 AM

Nope, I've installed Linux several times on that harddrive, probably about 50 times, it's just that I can't do it anymore and it seems like connecting an external usb harddrive once is the cause. I can't think of anything else because that's when it started acting weird. And I don't understand where the problem actually is considering that I've changed both the MBR and partitions several times since then using the Windows XP disc so nothing that was on it before that could have messed things up should be there now.

That's exactly what I've been trying, in post #12 I write about using cfdisk which managed to change the partitions but when I get to the installer I still get the same problem.

saikee 07-17-2007 02:00 AM

Can you create the partitions as suggested first and post the output "fdisk -l" here?

Then try to install Ubuntu and let us know exactly which step you have a problem with.

jazzgossen 01-15-2008 02:09 AM

Hi! Did you ever get this problem solved? I'm having very similar trouble installing Ubuntu 7.10 to a USB flash drive. It has worked with one 1 GB flash drive, but I'm having trouble installing it to a new 4 GB drive. I've seen the same kind of I/O error messages, and the "The attempt to mount a file system failed" message from Ubuntu's GUI installer on the live CD.


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