Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Booting minimal image from USB stick
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Mon Jul 13, 2015 2:40 am    Post subject: [SOLVED] Booting minimal image from USB stick Reply with quote

Hi everyone,

I am trying to boot the minimal image in order to install Gentoo Linux on a laptop. I am running into a very strange problem I have never seen before and I really don't know what I can do to fix this problem.

First of all, the laptop is having a Windows 7 image which no longer boot neither. Second, it had a previous Gentoo Linux "version" installed and instead of trying to upgrade it, I decided to reinstall it because it is outdated for a long time.

So, I decided to modify the partitions of my only drive, I then booted with the USB stick and used fdisk to erase the swap partition in order to reduce its size and create a new partition in between.

After I did that, I was no longer able to boot sanely from the USB stick. WTF is going on? The first sign something went wrong is the udev events processing takes almost infinite time. I can interrupt it to proceed further, but when I finally get the prompt after a very long booting process I can use the keyboard only few seconds before it freezes. After waiting for a long time, I can see finally some characters I typed appearing on the display, then it is active for few more seconds, etc. The gpm process is started, but the mouse doesn't seem to work at all even if no error message was issued during the boot process.

I am desesperated to find what is going on.

Any ideas? Hints?

I can trying to boot normally without the usb stick, but the boot process get interrupted (looks like a kernel panic even if I cannot seen the kernel panic message), but this can be somewhat normal since the swap partition number has changed. That's why I need to boot on the usb stick to at least correct my /etc/fstab.

But, why everything seems to freeze?

I managed to issue the fdisk /dev/sda command, with many minutes delay between each small time window I can type something. So, here is what I get just after doing this, the welcome message is displayed followed by a message in red saying:

Code:
Omitting partitions after #60. They will be deleted if you save this partition table.


What is that?

I requested a partitions table print and waiting for it...

Got the table, although I cannot see the upper part of it. It seems, for an unknown reason the newly created partitions and all subsequent partitions (a total of 5 partitions) are repeated over and over until it reaches the total number of 60 partitions including the partitions before them. There was three primary HPFS/NTFS/exFAT partitions for Windows, then the extended partition and finally in the extended partition I had the boot partition, the newly created partition after deleting the swap space partition, the newly created swap partition (not yet switched to Linux swap type), then my root partition, then a LVM partition and finally another HPFS/NTFS/exFAT partition (newly created as well I forgot to mention it).

So, the section with the following partitions is repeated over and over with the same start, end sectors and size, something like the following is shown:

Code:

/dev/sda6 152594432 152856575 262144 128M 83 Linux
/dev/sda7 152858624 159150079 6291456 3G 83 Linux
/dev/sda8 168980480 170004479 1024000 500M 83 Linux
/dev/sda9 170006528 374806527 204800000 97.7G 8e Linux LVM
/dev/sda10 374808576 437723135 62914560 30G 7 HPFS/NTFS/exFAT
/dev/sda11 152594432 152856575 262144 128M 83 Linux
/dev/sda12 152858624 159150079 6291456 3G 83 Linux
/dev/sda13 168980480 170004479 1024000 500M 83 Linux
/dev/sda14 170006528 374806527 204800000 97.7G 8e Linux LVM
/dev/sda15 374808576 437723135 62914560 30G 7 HPFS/NTFS/exFAT
/dev/sda16 152594432 152856575 262144 128M 83 Linux
/dev/sda17 152858624 159150079 6291456 3G 83 Linux
/dev/sda18 168980480 170004479 1024000 500M 83 Linux
/dev/sda19 170006528 374806527 204800000 97.7G 8e Linux LVM
/dev/sda20 374808576 437723135 62914560 30G 7 HPFS/NTFS/exFAT
...
/dev/sda60 374808576 437723135 62914560 30G 7 HPFS/NTFS/exFAT


Anyone knows how I can fix this? Yes, I used the expert mode of fdisk to reordered the partitions since after deleting the swap partition, the newly added partitions where having numbers higher than the last one which was /dev/sda8 at this time.
_________________
Achille Talon Hop!


Last edited by AchilleTalon on Sun Jul 26, 2015 4:01 am; edited 1 time in total
Back to top
View user's profile Send private message
Keruskerfuerst
Advocate
Advocate


Joined: 01 Feb 2006
Posts: 2289
Location: near Augsburg, Germany

PostPosted: Mon Jul 13, 2015 6:21 am    Post subject: Reply with quote

Do you have a second computer?
Try to update the Bios of the not working computer.

Maybe the hardware of the not working computer is defective.
HDDfirmwarevirus?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Mon Jul 13, 2015 9:05 am    Post subject: Reply with quote

AchilleTalon,

Something is broken. I suspect its fdisk.
Try a clean install of System Rescue CD on your USB stick. Its Gentoo based, so you will feel quite at home.

Its unlikely to be failed hardware - there are too many checks along the way before the hardware boots.
The logical partitions in an MSDOS partition table are stored in a linked list. If you were to get loops in the list,
the list output would never end.

Do you need to salvage any data from /dev/sda5 and later ?
If so, post the first two loops ot the partition table starting at /dev/sda5. We can mount the partitons without using the partition table.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Tue Jul 14, 2015 3:09 am    Post subject: Reply with quote

@NeddySeagoon,

I finally managed to get the partition table as shown by the fdisk command and yes, I need to salvage some data from partitions in the extended partition. I agree with you it is unlikely to be a hardware problem. I believe the problem is actually I am getting a loop in the linked list, the command stop at partition 60. When booting with the USB stick with the minimal distro it scans /dev/sda0 to /dev/sda255 before switching to /dev/sdb1 (the USB stick drive). This number of 256 is looking like a limit once reached to give up indicating in fact the loop is infinite.

Here is the output of the fdisk -l /dev/sda command:

Code:
Warning: deleting partitions after 60

Disk /dev/sda: 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/sda1               1        1828    14680064  27 Unknown
/dev/sda2   *        1828        1841      102400   7 HPFS/NTFS
/dev/sda3            1841        9490    61440000   7 HPFS/NTFS
/dev/sda4            9490       60802   412163072   5 Extended
/dev/sda5            9490        9499       71680  83 Linux
/dev/sda6            9499        9515      131072  83 Linux
/dev/sda7            9516        9907     3145728  83 Linux
/dev/sda8           10519       10583      512000  83 Linux
/dev/sda9           10583       23331   102400000  8e Linux LVM
/dev/sda10          23331       27248    31457280   7 HPFS/NTFS
/dev/sda11           9499        9515      131072  83 Linux
/dev/sda12           9516        9907     3145728  83 Linux
/dev/sda13          10519       10583      512000  83 Linux
/dev/sda14          10583       23331   102400000  8e Linux LVM
/dev/sda15          23331       27248    31457280   7 HPFS/NTFS
/dev/sda16           9499        9515      131072  83 Linux
/dev/sda17           9516        9907     3145728  83 Linux
/dev/sda18          10519       10583      512000  83 Linux
/dev/sda19          10583       23331   102400000  8e Linux LVM
/dev/sda20          23331       27248    31457280   7 HPFS/NTFS
/dev/sda21           9499        9515      131072  83 Linux
/dev/sda22           9516        9907     3145728  83 Linux
/dev/sda23          10519       10583      512000  83 Linux
/dev/sda24          10583       23331   102400000  8e Linux LVM
/dev/sda25          23331       27248    31457280   7 HPFS/NTFS
/dev/sda26           9499        9515      131072  83 Linux
/dev/sda27           9516        9907     3145728  83 Linux
/dev/sda28          10519       10583      512000  83 Linux
/dev/sda29          10583       23331   102400000  8e Linux LVM
/dev/sda30          23331       27248    31457280   7 HPFS/NTFS
/dev/sda31           9499        9515      131072  83 Linux
/dev/sda32           9516        9907     3145728  83 Linux
/dev/sda33          10519       10583      512000  83 Linux
/dev/sda34          10583       23331   102400000  8e Linux LVM
/dev/sda35          23331       27248    31457280   7 HPFS/NTFS
/dev/sda36           9499        9515      131072  83 Linux
/dev/sda37           9516        9907     3145728  83 Linux
/dev/sda38          10519       10583      512000  83 Linux
/dev/sda39          10583       23331   102400000  8e Linux LVM
/dev/sda40          23331       27248    31457280   7 HPFS/NTFS
/dev/sda41           9499        9515      131072  83 Linux
/dev/sda42           9516        9907     3145728  83 Linux
/dev/sda43          10519       10583      512000  83 Linux
/dev/sda44          10583       23331   102400000  8e Linux LVM
/dev/sda45          23331       27248    31457280   7 HPFS/NTFS
/dev/sda46           9499        9515      131072  83 Linux
/dev/sda47           9516        9907     3145728  83 Linux
/dev/sda48          10519       10583      512000  83 Linux
/dev/sda49          10583       23331   102400000  8e Linux LVM
/dev/sda50          23331       27248    31457280   7 HPFS/NTFS
/dev/sda51           9499        9515      131072  83 Linux
/dev/sda52           9516        9907     3145728  83 Linux
/dev/sda53          10519       10583      512000  83 Linux
/dev/sda54          10583       23331   102400000  8e Linux LVM
/dev/sda55          23331       27248    31457280   7 HPFS/NTFS
/dev/sda56           9499        9515      131072  83 Linux
/dev/sda57           9516        9907     3145728  83 Linux
/dev/sda58          10519       10583      512000  83 Linux
/dev/sda59          10583       23331   102400000  8e Linux LVM
/dev/sda60          23331       27248    31457280   7 HPFS/NTFS

Partition table entries are not in disk order

_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Tue Jul 14, 2015 8:51 am    Post subject: Reply with quote

AchilleTalon,

Heres the analysis ...
Code:
Disk /dev/sda: 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/sda1               1        1828    14680064  27 Unknown
/dev/sda2   *        1828        1841      102400   7 HPFS/NTFS
/dev/sda3            1841        9490    61440000   7 HPFS/NTFS
/dev/sda4            9490       60802   412163072   5 Extended

Thats the easy bit ... the four partitions in the MBR. Nothing overlaps and all of the space on the drive is described there, so its probably OK. Now it gets interesting ...

Code:
   Device Boot      Start         End      Blocks  Id System
/dev/sda5            9490        9499       71680  83 Linux
/dev/sda6            9499        9515      131072  83 Linux
/dev/sda7            9516        9907     3145728  83 Linux
/dev/sda8           10519       10583      512000  83 Linux
/dev/sda9           10583       23331   102400000  8e Linux LVM
/dev/sda10          23331       27248    31457280   7 HPFS/NTFS
/dev/sda11           9499        9515      131072  83 Linux

It looks like the last block of sda5 is also the first block sda6. It can't be both, at least, not without some data loss.
sda6 and sda11 describe the same space on the drive, so that will be the start of the repeat.
If you really had a sda11 (and later), its likely the data is still there but it can no longer be accessed using the partition table.
There is a gap between sda7 and sda8, that can be correct as deleting a partition leaves the space unallocated.
sda8 and sda9 share a block.
The highest ending number is 27248 but the extended partition ends at 60802, so there were either other partitons or lots of empty space or the partition table has more damage than a circular linked list.

Run testdisk on the drive. It will try to spot partitions. Do not allow it to write the partiton table. Do not use the drive read write.
Post the testdisk results.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Tue Jul 14, 2015 1:17 pm    Post subject: Reply with quote

NeddySeagoon,

there is not partition after sda10. From sda11 it is a repeating pattern of partitions sda6 to sda10. Yes, the gap of unallocated blocks is expected since I didn't reallocated all the blocks after deleting the partition. The only partition I really care about is the Linux LVM partition where I have data I would like to salvage if possible. sda10 is a new empty unformatted partition.

As soon as I have extra time I will run the required test.
_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Tue Jul 14, 2015 2:07 pm    Post subject: Reply with quote

AchilleTalon,

At face value, sda8 and sda9 overlap by one block.
Code:
   Device Boot      Start         End      Blocks  Id System
/dev/sda8           10519       10583      512000  83 Linux
/dev/sda9           10583       23331   102400000  8e Linux LVM

That may or may not be true. The 10583 could be incorrect in both places.

Lets assume its correct for now, in which case, your LVMs may already appear in /dev/mapper/...
If so, try and mount them one at a time, read only and copy the data somewhere else. Recovery in place is not possible.

If you don't have any Logical Volumes, try
Code:
vgchange -ay
and look again.
If there is stil nothing, the sda9 start of 10583 is probably incorrect. Do a testdisk scan but do not allow testdisk to write to the disk.

Have you ever extended any of your logical volumes or are they all single fragments?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Tue Jul 21, 2015 11:55 pm    Post subject: Reply with quote

Just an update. I cannot boot with a USB stick or even a USB drive without being trapped into a never ending process. I guess it has something to do with the linked-list loop for the disk partitions.

What kind of boot media and what stuff on it will make my laptop to boot? Do I have to disable something about the drive to avoid the boot process trying to figure out everything on that disk?
_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Wed Jul 22, 2015 7:42 pm    Post subject: Reply with quote

AchilleTalon,

How did you boot to get to fdisk?
If that works so should other forms of booting.

As long as that was Linux, it will do to attempt to recover your data.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Thu Jul 23, 2015 12:03 am    Post subject: Reply with quote

I booted with my USB external hard drive. However, it was a very only kernel version. So, I decided to update it to get the latest version of the tools and since that time I run into this problem, almost the same with the USB stick which is having as well a recent image.
_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Thu Jul 23, 2015 4:32 pm    Post subject: Reply with quote

AchilleTalon,

That you were able to boot at all shows its not a problem with your broken partition table.

Try with System Rescue CD on a usb stick. Follow the instructions to install it onto the stick.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Sat Jul 25, 2015 6:06 pm    Post subject: Reply with quote

I finally got it and here is the output from the analysis from testdisk:

Code:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63
Current partition structure:
     Partition                  Start        End     Size in sectors
 1 P Windows RE(store)        0  32 33  1827 181 18   29360128
 2 * HPFS - NTFS           1827 181 19  1840 117  5     204800
 3 P HPFS - NTFS           1840 117  6  9489  98 17  122880000
 4 E extended              9489  98 18 60801  80 15  824326144
 5 L Linux                 9489 130 50  9498 111 21     143360
   X extended              9498 111 22  9514 224 54     264192
No ext2, JFS, Reiser, cramfs or XFS marker
 6 L Linux                 9498 143 54  9514 224 54     262144
 6 L Linux                 9498 143 54  9514 224 54     262144
   X extended              9514 224 55  9906 161 47    6293504
No ext2, JFS, Reiser, cramfs or XFS marker
 7 L Linux                 9515   2 24  9906 161 47    6291456
 7 L Linux                 9515   2 24  9906 161 47    6291456
   X extended             10518 107 22 10582  73 51    1026048
 8 L Linux                10518 139 54 10582  73 51    1024000
   X extended             10582  73 52 23330 159 61  204802048
 9 L Linux LVM            10582 106 21 23330 159 61  204800000
   X extended             23330 159 62 27247   1 18   62916608
Invalid NTFS or EXFAT boot
10 L HPFS - NTFS          23330 192 31 27247   1 18   62914560
10 L HPFS - NTFS          23330 192 31 27247   1 18   62914560
   X extended              9498 111 22  9514 224 54     264192
Logical partition must be in its own extended partition
   X extended              9498 111 22  9514 224 54     264192
   X extended              9498 111 22  9514 224 54     264192


Code:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63
Analyse cylinder 60800/60800: 100%


  HPFS - NTFS              0  32 33  1827 181 18   29360128
  HPFS - NTFS           1827 181 19  1840 117  5     204800
  HPFS - NTFS           1840 117  6  9489  98  2  122879985
  Linux                 9489 130 50  9498 111 21     143360
  Linux Swap            9498 143 54 10518 107  5   16383984
  Linux                10518 139 54 10582  73 51    1024000
  Linux LVM            10582 106 21 23330 159 61  204800000
Invalid NTFS or EXFAT boot
 0 D HPFS - NTFS          23330 192 31 27247   1 18   62914560
  HPFS - NTFS          23330 192 31 27247   1 18   62914560


After scan:
Code:
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63

>* HPFS - NTFS              0  32 33  1827 181 18   29360128
 P HPFS - NTFS           1827 181 19  1840 117  5     204800
 P HPFS - NTFS           1840 117  6  9489  98 17  122880000
 L Linux                 9489 130 50  9498 111 21     143360
 L Linux Swap            9498 143 54 10518 107 21   16384000
 L Linux                10518 139 54 10582  73 51    1024000
 L Linux LVM            10582 106 21 23330 159 61  204800000
 L HPFS - NTFS          23330 192 31 27247   1 18   62914560
 L HPFS - NTFS          56976 152  9 60801  47 46   61442048


Structure: Ok.   Use Up/Down Arrow keys to select partition.
...
NTFS, blocksize=4096, 15GB / 14GiB


BTW, when I am on the command line, I can rarely type more than a dozen of characters at once and I have to wait few minutes before I can continue. So, that is a bit tedious. I also checked and I have a backup for my filesystems on the LVM, not current, but not too old. So, I can in fact delete all Linux partitions if needed, including the last NTFS partition which has not been formatted at this point anyway.

Anyway, I can bring on-line the VG and access all the LV within it now. So, no problem here to recover latest data.

The system on the rescueCD is now responsive. I don't know why. But it is definitely usable.
_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sat Jul 25, 2015 7:47 pm    Post subject: Reply with quote

AchilleTalon,

The simple way forward is to wipe everything, make a new partition table and reinstall from backups.

If you feel lucky you can delete all of your logical partitions (5 and on) then recreate them with the exact same starting and ending values as they have now.
That way, your data will be preserved in place. Because of the on disk data layout, after the first logical partition, (sda5) you have to get this right first time.

If you feel really adventureous, you can fix the loop in the linked list with a hex editor.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Sat Jul 25, 2015 8:39 pm    Post subject: Reply with quote

I feel a bit adventurous. I mean, I am curious how I could fix the linked-list. Do you have more information, a URL to a wiki, website or something to help me understand and get started? I may not walk down this road, I will see.
_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Sun Jul 26, 2015 4:00 am    Post subject: Reply with quote

BTW, after doing the testdisk scan, suffice to write the partition table to restore everything in a working state. I still have to recreate my second Linux /boot and shrink my swap space to do so, however, the partition table is now in a sane state. I will avoid using fdisk next time and rely on parted instead.
_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sun Jul 26, 2015 9:19 am    Post subject: Reply with quote

AchilleTalon,

If you are happy there are no false positives, you can let testdisk rewrite the partiton table for you.
If it gets partitions 1..4 wrong, there is no harm done.
If it gets partition 5 wrong there will be no damage to the data in partition 5 until it writes the entry for partition 6, whick will be written at the end of the incorrect partition 5 entry.
This may be anywhere on disk.

Be sure that the partition table testdisk wants to write is a truncated version of your posts here.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
AchilleTalon
Guru
Guru


Joined: 11 Apr 2004
Posts: 368
Location: Montreal, Quebec, Canada

PostPosted: Sun Jul 26, 2015 1:54 pm    Post subject: Reply with quote

NeddySeagoon,

since nothing has been written to the disk after the partitions were created and testdisk discovered the partitions before the change, writing this partition table fixed the problem.

I am still curious about using an hex editor to edit the partition table. Maybe another time I will explore this with a disk I have no fear to lost anything on it.

Thanks for you help, very much appreciated.
_________________
Achille Talon Hop!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum