LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-21-2014, 06:46 PM   #1
the dsc
Member
 
Registered: May 2009
Distribution: Debian
Posts: 165
Blog Entries: 177

Rep: Reputation: 46
Question [SOLVED ...sort of] Cfdisk " Bad primary partition 0", but I can mount it all on a live linux


I was trying to install debian stable via USB/unetbootin on my desktop, replacing my previous install (switching from i686 to amd64, which seems to be more appropriate for the intel core 2 duo), without changing the partitions, keeping my stuff on the home partition, formatting only swap and root.

Everything went fine during the install, but on the first boot I got the message that "/boot/grub/i386-pc/normal.mod" wasn't found, leaving me on the grub command prompt. I'm not sure if it's grub 1 or 2 (whatever is Debian stable's).

This file is however at the root of the grub folder, not on the subdirectory i386-pc, which doesn't even exist.

I'm not sure if that's profoundly relevant right now because while trying to recover from that I had found instructions along the lines of:

Code:
grub-install --root-directory=/media/sda1 /dev/sda
This is exactly* how I did it, after mounting sda1, as instructed.

* Well, at least I hope so. I do recall paying attention to pointing to /media/sda1 and to just /dev/sda, not /dev/sda1; but now I wonder if I used the "=" instead of just a space...


But after booting, I simply had no output at all. After the "BIOS" part, it was almost as if the monitor was disconnected from the PC; the monitor's own OSD popped up on the corner and nothing would show up. I think the HDD led wasn't lighting up as well, and it did respond to control+alt+del, from which I booted to parted magic again, and here I am while I'm searching for possible solutions.


For what I've been reading (not much yet) it seems it may be something wrong with the partition table. But I'm not at all sure it is the case since I can mount the partitions with no error message or anything, it all seems to be normal except for cfdisk, which will refuse to start with this warning (bad primary partition 0). Parted -l and fdisk -l also list the partitions normally, with no warnings. I'm not sure they'd would warn of anything, anyway, I'd just guess there would be something weird.

I'm guessing the grub-install caused it by installing on the wrong place or something, possibly I did something wrong and/or I have/had an unusual partition setup.


Here it is:

Code:
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 2      1048kB  132GB   132GB   extended
 6      1049kB  2042MB  2041MB  logical   linux-swap(v1)
 5      2042MB  132GB   130GB   logical   ext4
 1      132GB   160GB   28.0GB  primary   ext4            boot
I don't know why there's no 3 and 4. But there's no "missing space"/missing partitions, it's as if there was nothing wrong but skipped numbers for some reason. Hopefully they're just arbitrary labels or that's just because sda5 and 6 are within the extended partition sda2.

"Partition Table: msdos"? Just now I noticed it. It didn't have DOS or windows for a few years, since I started using it, but it did have windows previously, but never both linux and windows. I'm going to keep searching for more clues on google.

Thanks in advance for any help here. Sorry for the long post, I thought of posting everything that I thought could be relevant but I'm a bit clueless.




Update1:


At least I think don't have "overlapping partitions", which doesn't exactly surprises me, even though it's relieving anyway:

Code:
root@PartedMagic:~# parted /dev/sda unit s print
Model: ATA ST3160811AS (scsi)
Disk /dev/sda: 312581808s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type      File system     Flags
 2      2046s       257894399s  257892354s  extended
 6      2048s       3987455s    3985408s    logical   linux-swap(v1)
 5      3987456s    257894399s  253906944s  logical   ext4
 1      257894400s  312580095s  54685696s   primary   ext4            boot


Update 2:
I think this may have happened:

Quote:
Installation of GRUB bootloader may fail if more than one disk device is available.
When there is more than one disk available during installation (for example one hard disk and one USB stick, as it is commonly the case when booting the installer from a USB stick), grub-install may run into problems: it was reported several times, that the GRUB bootloader was installed onto the USB stick instead of the hard disk containing the newly-installed system.
To avoid running into this, make sure to answer No when the following question is asked during the installation process: Install the GRUB boot loader to the master boot record?; it should be possible to specify the right device at the next step: Device for boot loader installation.
If the installation finished successfully despite a wrong GRUB configuration, it should be possible to recover using the rescue mode of the installer: chroot into the root filesystem, mount any additional boot partition if applicable (like /boot and/or /boot/efi for an EFI system, see /etc/fstab), and run grub-install with the proper device as parameter.
Status: This issue will hopefully be fixed in the second Wheezy point release.

https://www.debian.org/releases/whee...ian-installer/
I guess it even happened once before with me. Indeed booting the USB I can access a "grub rescue" prompt. From there the only command I could guess was "ls" and the result was:

Code:
(hd0) (hd0,msdos1) (hd1) (hd1,msdos6) (hd1,msdos5) (hd1,msdos1)
And now I recall having read something about Debian's (at least the stable release) net-install not being fully ext4-capable...

I'll see if I can recover with this chroot method, even though I'm not that hopeful that it will make any difference. If it doesn't work, I guess I'll try to install again with "hd-media" instead of netinstall...

Last edited by the dsc; 04-21-2014 at 10:33 PM. Reason: updating the situation while not flooding
 
Old 04-21-2014, 08:33 PM   #2
hilyard
Member
 
Registered: Jan 2010
Location: Inland PNW
Distribution: Lite | siduction
Posts: 291

Rep: Reputation: 66
After a brief search, I have to ask if you have taken a look here ?
 
1 members found this post helpful.
Old 04-21-2014, 10:33 PM   #3
the dsc
Member
 
Registered: May 2009
Distribution: Debian
Posts: 165

Original Poster
Blog Entries: 177

Rep: Reputation: 46
Thanks, but I think I did see it, I remember seen a blog with instructions about reinstalling grub, from a link in some forum, and this blog had this "animated pop-up" effect.


I "solved" it by reinstalling, not without some bumps still. First I tried using hd-media on unetbootin, but it wouldn't work, complaining that it couldn't read the CD ROM drive. Then I thought I'd try netinst again, since it had at least finished the installation, with the grub error that the Debian page warns. Funnily enough, this netinst behaved like hd-media*, looking for ISOs on the HD, and finding a netinst I've downloaded earlier. I succeeded installing from that with the relatively minor annoyance that I couldn't set to use my former home partition again, as it was the source for the ISO (I suppose it's because of that). Also, unexpectedly, the install didn't show up with the "default" offer to install GRUB on the MBR, but instead it gave me manual options, as the Debian's site warning says if it would do if I had refused the default offer... weird, perhaps that was a bug-fix. Now I just need to edit fstab and perhaps some other configuration trickery to have the old /home partition again.

I'll mark as "solved" anyway, even though it's not quite "reference" solved. There should be a "[SOLVED ...sort of]" mark. I even still have the same cfdisk warning/failure, but it seems the system will be usable, at least for the rest of the life of this old HDD.



* I guess that, without manually removing the files from the pendrive, there may be remains from hd-media that are not overwritten or deleted by unetbootin, and change the behavior of what is installed later. Or maybe it was just a wrong impression, and netinstall always has this behavior.

Last edited by the dsc; 04-21-2014 at 10:40 PM.
 
Old 04-21-2014, 10:41 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 8,144

Rep: Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624
Quote:
"/boot/grub/i386-pc/normal.mod" wasn't found
Definitely Grub2. The entry in grub.cfg may have been pointing to the wrong location but I guess that's a moot point now.

Quote:
grub-install --root-directory=/media/sda1 /dev/sda
That's the wrong command because you have a separate boot directory to which you should be pointing not the --root-directory.

Quote:
I don't know why there's no 3 and 4. But there's no "missing space"/missing partition
There is nothing wrong or unusual with the partitions. Number 1 is a primary boot partition and number 2 is primary as Extended. 5 and 6 are logical partitions within 2, the Extended partition. On Linux, logical partitions start with 5. I'm not familiar with Debian so don't have any suggestions. Hope the above information is useful.
 
1 members found this post helpful.
Old 04-22-2014, 04:41 PM   #5
the dsc
Member
 
Registered: May 2009
Distribution: Debian
Posts: 165

Original Poster
Blog Entries: 177

Rep: Reputation: 46
Quote:
Originally Posted by yancek View Post
Definitely Grub2. The entry in grub.cfg may have been pointing to the wrong location but I guess that's a moot point now.
Actually I've fixed it "twice" already, I had to reinstall once again when I noticed that Debian stable was too old for my taste (and couldn't be smoothly upgraded to "testing"), and the install had the same bug of installing GRUB on the pendrive, despite of me manually setting it to install at /dev/sda.

I could however boot to the HDD install from the pendrive's grub, and from there I did pretty much the "grub install" line mentioned before, only followed by it's repetition with a "--recheck" option (just mindlessly doing what I've read on some ubuntu page, didn't seem it could possibly be bad), and then "update-grub".



Quote:
That's the wrong command because you have a separate boot directory to which you should be pointing not the --root-directory.
I guess it may the case when you have an actual separate /boot partition, which isn't that uncommon. The "numberless"/"partitionless" command is intended to install grub at the MBR, not at any given partition; the installer even mentions that installing at a partition "probably isn't what you want to do", or something like that. Or at least that's what I got/recall from what I've read so far. In any case, I did the command without pointing to a /boot folder (or partition) and it worked.



Quote:
There is nothing wrong or unusual with the partitions. Number 1 is a primary boot partition and number 2 is primary as Extended. 5 and 6 are logical partitions within 2, the Extended partition. On Linux, logical partitions start with 5. I'm not familiar with Debian so don't have any suggestions. Hope the above information is useful.
Thanks. At least now I know that's most likely not linked with cfdisk's message.

Last edited by the dsc; 04-22-2014 at 04:44 PM.
 
  


Reply

Tags
grub, netinstall, partition table, unetbootin


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cfdisk fatal error - bad primary partition ewsmith Slackware - Installation 8 10-31-2010 04:34 PM
"Mount: wrong file system type, bad option, bad superblock" User Name. Linux - Newbie 9 09-03-2008 04:40 PM
Bad mount of .mdf - "wrong fs type, bad option, bad superblock, on /dev/loop0" Maybe-not Linux - General 2 02-29-2008 02:30 PM
USB stick won't mount ("wrong fs type, bad option, bad superblock ...") Arla Linux - Hardware 4 06-01-2007 08:23 AM
cfdisk cannot partition hard drive because it's "write protected" Flz Linux - General 13 04-25-2006 09:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration