[SOLVED] Now I've done it - Debian dual boot (Sid, Wheezy) grub overwritten, lost Wheezy?
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Now I've done it - Debian dual boot (Sid, Wheezy) grub overwritten, lost Wheezy?
I had SteamOS on one hard drive and a stable Wheezy on the second. I got tired of SteamOS as it was going to be more trouble than it was worth to get the Debian desktop functional, and I had been wanting to begin using Sid anyhow. My understandig is that you basically install either stable or testing and migrate to Sid. Two steps of migration if you install stable, or one if you install testing. I installed stable.
I apparently overwrote the grub information in the process, and now neither grub nor the new Wheezy install seem to see the other disk.
If I escape into grub I can see the disk, but I can't even seem to boot into my newest install from the command line, much less recover the old one, if indeed it is all still there.
Anyhow, anyone able to help? It's not a huge loss if I have to reformat and reinstall, but I have done SOME work on that installation, and in any event I'd really like to learn how to rescue screwed up grub files and so forth.
If you can boot into either of your installed versions of Debian then do so. Then su to root and run grub-mkconfig and grub-install.
The command to create a new grub.cfg is:
grub-mkconfig -o /boot/grub/grub.cfg
The command to install a new grub bootloader is:
grub-install /dev/sdx
where /dev/sdx is the hard drive that you boot from, likely /dev/sda.
If you can't boot into one of your Debian systems then boot from a rescue CD, chroot to one of your / partitions and then run grub-mkconfig and grub-install. Assuming that your root partition is /dev/sda1 then do the following in the rescue CD:
mkdir /spare1
mount /dev/sda1 /spare1
chroot /spare1
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sdx
where /dev/sdx is the hard drive that you boot from, likely /dev/sda.
Ukiuki and Jailbait, thanks. Did not work. I can indeed boot the newest installation. But these commands seem to have merely duplicated the grub setup as it already existed.
Widget, I am downloading a live dvd image now. I can tell you this though. I can escape into grub from bootup by hitting the c button. When I do and do an 'ls', I get the following.
Code:
grub> ls
(hd0) (hd0,msdos5) (hd0,msdos1) (hd1) (hd1,msdos5) (hd1,msdos1)
If I further ls (hd0,msdos1) it shows to have an ext2 filesystem. For some reason I don't quite get, (hd1,msdos1) has a fat file system, and I have not had Windows on this machine ever, at all, period, end of story. Plus, I am pretty sure the SteamOS disk is the one I over-wrote, so even the idea that SteamOS might have something like that for some reason seems far fetched because I don't think that is the remaining of the two previous installs.
The iso just finished downloading as I was typing. Not sure what info would be of more use for you, but I will hack at it some more tonight and if anyone has any ideas, feel free.
Thanks all!
P.S. I do not understand why I cannot at least SEE the other disk from my operable Wheezy. Before, I could look at the file system of SteamOS from Wheezy, and likewise look at the Wheezy file system from the SteamOS/Debian desktop.
One of those to HAS to be still on the other disk, but I cannot see it from the operable current Wheezy.
P.P.S. I can select the second hard drive from a boot loader built into my bios, but that disk will not boot... I think this is just because both disks originally booted from the mbr of the one disk.
Last edited by ShaneRoach; 01-31-2014 at 10:31 PM.
I am in on the Live DVD now, and can indeed see both disks. They both list as "983 GB Filesystem" in the devices list on the left hand side of the "places" window in Gnome. They are both essentially identical from there, but the first one's boot folder has a grub folder, config-3.2.0-4-amd64 file, intrd.img-3.2.0-4-amd64 file (looks like a package), System.map-3.2.0-4-amd64 file, and finally a vmlinuz-3.2.0-4-amd64 file. I am betting this is the bootable disk.
The other disk's boot folder just has a EFI folder at first, which opens into a debian folder, which contains a grubx64.efi file.
I hope there is more on the whole disk than that...? Is it possible my new wheezy install reformatted that disk in the process?
It sure looks as if it must have reformatted it, but I do not understand why. I had no issues at all adding wheezy to the second disk when I had SteamOS on the first...
Last edited by ShaneRoach; 01-31-2014 at 10:41 PM.
Which I guess brings me to my third and final post for now...
How the heck are you supposed to tell what is on a given disk when installing to a multiple disk system? Even from this live dvd, I cannot tell which of these two is sda0 and which is sda1 when I go to install the OS. Once I have the installation up and running and there are two disks there, unless there is something specific about the file system itself I can recognize, such as a number of paritions or whatnot, I have no way of knowing which disk contains what except my own recollection, which is traditionally woefully inadequate to such tasks.....
I think I'm screwed.
I thought the disks were labelled during installation, but that does not show up at all during the installation steps leading up to formatting the new disk for the OS.
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628
Rep:
The best thing to do is get the boot info script and run it from the Live Session. This will give all the information we need for both drives. http://bootinfoscript.sourceforge.net/
If you want to look at the drives in a graphic manner most Live Sessions include Gparted and you can see what you have on there quite plainly.
One thing you should consider in the future is labeling your partitions. Makes telling them apart much easier.
The best thing to do is get the boot info script and run it from the Live Session. This will give all the information we need for both drives. http://bootinfoscript.sourceforge.net/
If you want to look at the drives in a graphic manner most Live Sessions include Gparted and you can see what you have on there quite plainly.
One thing you should consider in the future is labeling your partitions. Makes telling them apart much easier.
As I had said, I thought I was doing this during install. It would seem not... What command does one use to label these suckers? e2label pops up on a google search. Is that what you use?
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628
Rep:
Quote:
Originally Posted by ShaneRoach
As I had said, I thought I was doing this during install. It would seem not... What command does one use to label these suckers? e2label pops up on a google search. Is that what you use?
You can put a label on partitions in the Debian installer.
e2label is a fine tool for the job. Pretty quick and easy.
If you use gparted you can lable partitions there too.
As with most things dealing with partitions it is best if done when the partition(s) are unmounted. This is another reason it is nice to have installs on more than one drive and/or a Live Session of some sort available.
The boot info script will list your partitions and what they are. It will give all the info on each partition to tell us what is on that partition.
Here's that RESULT.txt. It would appear from my reading that the MBR is indeed gone from the other disk. Is it recoverable?
I am about to buy me a little USB key to create a bootable rescue environment. I ran this from the operating Wheezy hard drive, and it appears that makes it hard for the script. On the other hand, I am tired of creating dvd after dvd after dvd for troubleshooting.
=)
Thanks all, and I will be looking at TestDisk to see if I can recover this doohickey in the meantime, but please chime in as I will be checking back here frequently.
I'll let you know if I lose heart and decide to just reinstall all over again.
P.S. Where in the installation process did I fail to label these? I know this current Wheezy I named DebianSid (Because it is the one I eventually want to migrate to Sid), but that information does not seem to be saved in the paritions or disk names.
I could have sworn you could name disks too....
Code:
Boot Info Script 0.61 [1 April 2012]
============================= Boot Info Summary: ===============================
=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
for (,msdos1)/boot/grub on this drive.
=> No boot loader is installed in the MBR of /dev/sdb.
=> No boot loader is installed in the MBR of /dev/sdc.
sda1: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Mounting failed: mount: /dev/sda1 already mounted or sda1 busy
sda2: __________________________________________________________________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
sda5: __________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
sdb1: __________________________________________________________________________
File system: vfat
Boot sector type: -
Boot sector info: According to the info in the boot sector, sdb1 has
997376 sectors.. But according to the info from the
partition table, it has 1920196607 sectors.
Operating System:
Boot files:
sdb2: __________________________________________________________________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
sdb5: __________________________________________________________________________
File system:
Boot sector type: -
Boot sector info:
Mounting failed: mount: /dev/sda1 already mounted or sda1 busy
mount: unknown filesystem type ''
sdc1: __________________________________________________________________________
File system: vfat
Boot sector type: -
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:
============================ Drive/Partition Info: =============================
Drive: sda _____________________________________________________________________
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sda1 * 2,048 1,920,198,655 1,920,196,608 83 Linux
/dev/sda2 1,920,200,702 1,953,523,711 33,323,010 5 Extended
/dev/sda5 1,920,200,704 1,953,523,711 33,323,008 82 Linux swap / Solaris
Drive: sdb _____________________________________________________________________
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sdb1 2,048 1,920,198,655 1,920,196,608 83 Linux
/dev/sdb2 1,920,200,702 1,953,523,711 33,323,010 5 Extended
/dev/sdb5 1,920,200,704 1,953,523,711 33,323,008 82 Linux swap / Solaris
Drive: sdc _____________________________________________________________________
Disk /dev/sdc: 8004 MB, 8004304896 bytes
35 heads, 21 sectors/track, 21269 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sdc1 32 15,633,407 15,633,376 b W95 FAT32
"blkid" output: ________________________________________________________________
Device UUID TYPE LABEL
/dev/sda1 3e66733f-21bb-433e-9faa-5ecba8b51b36 ext4
/dev/sda5 53b60b7f-5715-4f65-84f0-381329787278 swap
/dev/sdb1 FC43-BB5B vfat
/dev/sdc1 065C-763C vfat
================================ Mount points: =================================
Device Mount_Point Type Options
/dev/disk/by-uuid/3e66733f-21bb-433e-9faa-5ecba8b51b36 / ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
/dev/sdc1 /media/065C-763C vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=cp437,iocharset=utf8,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks)
=============================== StdErr Messages: ===============================
xz: (stdin): Compressed data is corrupt
This will not fill a stick if it is nice size. I have a stick with Wheezy on it with persistence. You just need to dd the ISO on first and then create any other partitions you want. I actually have mine of 32gig stick. Gives a lot of storage space for recovery operations.
I think an 8gig stick is the best size. You can use something else for storage if you need it.
4gig is actually plenty. I just like capacity and have music files loaded so I can listen to tunes while exploring some wreckage.
The mounts failing stops a lot of the info we would normally see - running from a liveUSB should fix that issue.
I would say the real problem is that whilst the /dev/sdb1 partition is flagged as "Linux" (x'83') its filesystem has been formatted as VFAT - I'm surprised the installer would allow that (but I don't use Debian).
I'd blow it away and start again.
As for "which disk is which", I try to always have different size disks - when I can't, I use different partition layouts so I can tell the difference. I never allow installers to do the partitioning. Always "Custom" layouts - I have too many systems on each box to allow what devs think they can dictate to screw everything.
As mentioned, filesystems can have labels (or UUIDs) - not disks or partitions (in a MBR layout). gpt disks allow partitions to have a GUID (similar to UUID) which can be used to boot Linux, and avoid using an initrd (for that - you may have other requirements for the initrd).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.