Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Cannot install GRUB after BSD.

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Naron
Posts: 28
Joined: 2011-08-29 11:48
Has thanked: 2 times
Been thanked: 1 time

Cannot install GRUB after BSD.

#1 Post by Naron »

Hi.
I have recently (out of boredom) played with FreeBSD and OpenBSD on my laptop, both did run pretty well but I have had problems with XFCE integration so I returned to Debian. But after installing Debian Stretch x64 from an install CD with Xfce, an error occured while installing GRUB on MBR: GRUB couldn't be installed. When this error appeared, the installer showed me a menu with options, one of them being to install LILO instead of GRUB. This worked and the system booted fine, but now I have lost the option to boot in Windows 7 (I have a dual-boot Win 7/Linux because of gaming reasons) and this LILO looks really ancient. I would like to have GRUB - I tried installing it from the installed Debian but this error appears and the installation is aborted:

Code: Select all

grub-install /dev/sda
Installing for i386-pc platform.
grub-install: error: hostdisk//dev/sda appears to contain a ufs1 filesystem which isn't known to reserve space for DOS-style boot.  Installing GRUB there could result in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup (--skip-fs-probe disables this check, use at your own risk).
So, I don't know what to do at this point. I searched and it seems it would be necessary to wipe out the first 10 GB or so on the HDD but this is not an option because I would lose Windows partitions and I have a lot of data there. Is there any alternative?
My laptop is an old Dell Latitude E4300.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Cannot install GRUB after BSD.

#2 Post by GarryRicketson »

it would be necessary to wipe out the first 10 GB or so on the HDD but this is not an option because I would lose Windows partitions and I have a lot of data there
That shouldn't be any problem, you just use the back up you made, before you started experimenting.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Cannot install GRUB after BSD.

#3 Post by phenest »

When you installed Debian after BSD, did you use the partition BSD created?
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Cannot install GRUB after BSD.

#4 Post by Head_on_a_Stick »

I think that you will have to delete the FreeBSD disklabel.

Please post the full output of:

Code: Select all

# parted --list
deadbang

shep
Posts: 423
Joined: 2011-03-15 15:22

Re: Cannot install GRUB after BSD.

#5 Post by shep »

But after installing Debian Stretch x64 from an install CD with Xfce, an error occured while installing GRUB on MBR: GRUB couldn't be installed.
The issue is a traditional MBR boot loader, like lilo or the one OpenBSD uses installs to the first sector. The newer bootloaders, like GRUB2 and the default to FreeBSD => 10, use the first two sectors. See Rod's Book on GPT.

I dual boot Debian Stretch/OpenBSD. Basicially, install Debian First but manually partition in the Debian installer. I use 4 partitions out of habit: 1) / 2) swap 3)/home 4) OpenBSD type A6. When Installing OpenBSD, use the OpenBSD partition. See DaemonForums Dual Boot Thread for more details.

If you just want Debian with GRUB2, install gdisk from the main Debian repository and follow the procedure in Rods Books about zeroing out a GPT. You are probably aware, but I need to restate, this will wipe out your existing Debian installation and you will need to re-install.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Cannot install GRUB after BSD.

#6 Post by phenest »

The OP doesn't want BSD. They want to dual boot with Windows. They tried BSD but installed Debian instead.

Also, the OP said they tried FreeBSD which uses 2 sectors as GRUB2 does, so that doesn't explain the problem.

The OP mentioned the GRUB error:
Naron wrote:

Code: Select all

grub-install /dev/sda
Installing for i386-pc platform.
grub-install: error: hostdisk//dev/sda appears to contain a ufs1 filesystem which isn't known to reserve space for DOS-style boot.  Installing GRUB there could result in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup (--skip-fs-probe disables this check, use at your own risk).
As you can see, there is a UFS1 filesystem in use (somehow), or at least, they've used the BSD partitioning which is incompatible with GRUB.
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

shep
Posts: 423
Joined: 2011-03-15 15:22

Re: Cannot install GRUB after BSD.

#7 Post by shep »

Also, the OP said they tried FreeBSD which uses 2 sectors as GRUB2 does, so that doesn't explain the problem.
The OP did not go into a lot of details on the FreeBSD installation. Depending on the version, (FBSD 9.x, uses only the initial sector) and the boot loader options selected in FBSD 10.x and FBSD 11.0, a one sector MBR can be used.

As far as recovery for the OP, I would try using the Window rescue to restore the Windows installation. Then backup the Windows data before trying to dual boot anything.

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Cannot install GRUB after BSD.

#8 Post by phenest »

shep wrote:The OP did not go into a lot of details on the FreeBSD installation.
Quite. But until they respond again, we'll just keep throwing ideas their way. :D
shep wrote:Then backup the Windows data before trying to dual boot anything.
GarryRicketson wrote:That shouldn't be any problem, you just use the back up you made, before you started experimenting.
+1
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

Naron
Posts: 28
Joined: 2011-08-29 11:48
Has thanked: 2 times
Been thanked: 1 time

Re: Cannot install GRUB after BSD.

#9 Post by Naron »

Thanks to all for help. Some more details: I did have a dual-boot Win 7/Debian and as I said, tried FreeBSD and OpenBSD - in this order. Then I decided to return to Debian, thinking that reinstalling Debian would reinstall GRUB and thus restoring the initial setup. But, as you see, I was quite wrong.
Here is an output of parted:

Code: Select all

parted --list
Model: ATA ST9120821AS (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  106MB   105MB   primary
 2      106MB   98.6GB  98.5GB  primary  ntfs
 3      98.6GB  118GB   19.5GB  primary  ext4            boot
 4      118GB   120GB   1974MB  primary  linux-swap(v1)
I did not make a backup of Windows partitions because I was foolishly thinking that I would be able to restore the setup by reinstalling GRUB. Now, when I try to acces the Windows partition in Thunar, these errors spits out:

Code: Select all

ntfs: driver 2.1.32 [Flags: R/O MODULE].
[  950.524281] ntfs: volume version 3.1.
[  951.025813] ntfs: (device sda2): map_mft_record_page(): Mft record 0x11049 is corrupt.  Run chkdsk.
[  951.025820] ntfs: (device sda2): map_mft_record(): Failed with error code 5.
[  951.025824] ntfs: (device sda2): ntfs_read_locked_inode(): Failed with error code -5.  Marking corrupt inode 0x11049 as bad.  Run chkdsk.
[  960.949209] ufs: ufs was compiled with read-only support, can't be mounted as read-write
[  960.949345] ufs: You didn't specify the type of your ufs filesystem
               
               mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...
               
               >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
[  960.971635] ufs: ufs_fill_super(): bad magic number
[  995.767056] ntfs: volume version 3.1.
[  996.002092] ntfs: (device sda2): map_mft_record_page(): Mft record 0x11049 is corrupt.  Run chkdsk.
[  996.002100] ntfs: (device sda2): map_mft_record(): Failed with error code 5.
[  996.002103] ntfs: (device sda2): ntfs_read_locked_inode(): Failed with error code -5.  Marking corrupt inode 0x11049 as bad.  Run chkdsk.
Did I have lost my data?

User avatar
phenest
Posts: 1702
Joined: 2010-03-09 09:38
Location: The Matrix

Re: Cannot install GRUB after BSD.

#10 Post by phenest »

shep wrote:I would try using the Window rescue to restore the Windows installation.
This is a good suggestion. Try restoring the MBR from a Windows disc, and getting Windows working again.
https://neosmart.net/wiki/fix-mbr/
ASRock H77 Pro4-M i7 3770K - 32GB RAM - Pioneer BDR-209D

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Cannot install GRUB after BSD.

#11 Post by dasein »

Naron wrote:I did not make a backup of Windows partitions because...
And now you've learned that Reality doesn't care about your reason(s) for not backing up.

Welcome to why we old-timers are always telling you to backup. And to test the backup. And to keep multiple copies. And so on. We're not trying to steal your joy; we're trying to save your from your own carelessness.

Naron
Posts: 28
Joined: 2011-08-29 11:48
Has thanked: 2 times
Been thanked: 1 time

Re: Cannot install GRUB after BSD.

#12 Post by Naron »

dasein wrote:
Naron wrote:I did not make a backup of Windows partitions because...
And now you've learned that Reality doesn't care about your reason(s) for not backing up.

Welcome to why we old-timers are always telling you to backup. And to test the backup. And to keep multiple copies. And so on. We're not trying to steal your joy; we're trying to save your from your own carelessness.
But I have installed other Linux distributions without backing up the Windows partitions and everything was OK - I was always able to reinstall Debian (and GRUB) and restore the setup. Did not know that BSDs are so different - lesson learned now. When I installed the BSDs, I did not touch the Windows partitions, just erased the Debian partitions and installed there.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Cannot install GRUB after BSD.

#13 Post by Head_on_a_Stick »

Can we see what is in the MBR?

Code: Select all

# apt install most
# dd if=/dev/sda bs=512 count=1 | most
Have you tried wipefs(8)?
deadbang

Naron
Posts: 28
Joined: 2011-08-29 11:48
Has thanked: 2 times
Been thanked: 1 time

Re: Cannot install GRUB after BSD.

#14 Post by Naron »

Most:

Code: Select all

0x00000000: FC31C08E D031E48E D88EC0BE 007CBF00     .1...1.......|..
0x00000010: 06B90001 F3A5BEEE 07B008EA 20060000     ............ ...
0x00000020: 803EB607 FF750488 16B60780 3C007404     .>...u......<.t.
0x00000030: 0806B207 83EE10D0 E873F0CD 1A891600     .........s......
0x00000040: 08E83301 813EB407 FFFF7446 F606B307     ..3..>....tF....
0x00000050: 807406B4 01CD1675 39F606B3 07407407     .t.....u9....@t.
0x00000060: F6061704 0F752B31 C0CD1A2B 1600082B     .....u+1...+...+
0x00000070: 16B40772 D7A0B307 24073C07 750BBEBE     ...r....$.<.u...
0x00000080: 07B000B9 0400803C 007566FE C083C610     .......<.uf.....
0x00000090: E2F4E8E2 00B40EBE A0078A0E B207ACD0     ................
0x000000A0: E97302CD 1008C975 F5B03ACD 1031C0CD     .s.....u..:..1..
0x000000B0: 163C0074 F83C0D74 BC3C6172 063C7A77     .<.t.<.t.<ar.<zw
0x000000C0: 022C2088 C3BEA007 8A0EB207 ACD0E973     ., ............s
0x000000D0: 0438C374 0608C975 F3EBD2B8 0D0E31DB     .8.t...u......1.
0x000000E0: CD108D84 5F003C07 7507B01F A2B207EB     ...._.<.u.......
0x000000F0: A1E88300 31D2B901 003C0474 1173F030     ....1....<.t.s.0
0x00000100: E4B104D2 E0BEBE07 01C68A16 B607BF05     ................
0x00000110: 0056F6C2 80742BB4 41BBAA55 52CD135A     .V...t+.A..UR..Z
0x00000120: 5E56721E 81FB55AA 7518F6C1 0174138B     ^Vr...U.u....t..
0x00000130: 44088B5C 0ABE9007 89440889 5C0AB442     D..\.....D..\..B
0x00000140: EB0C8A74 018B4C02 B80102BB 007C50C6     ...t..L......|P.
0x00000150: 06920701 CD13585E 73054F75 B4EB9081     ......X^s.Ou....
0x00000160: 3EFE7D55 AA75F631 DBB80D0E CD10B00A     >.}U.u.1........
0x00000170: CD10EA00 7C000050 B80D0E31 DBCD10BE     ....|..P...1....
0x00000180: 8C07B904 00ACCD10 E2FB58C3 4D425220     ..........X.MBR
0x00000190: 10000100 007C0000 00000000 00000000     .....|..........
0x000001A0: 31323334 46000041 4E44546D 62720002     1234F..ANDTmbr..
0x000001B0: 00029007 00008000 5FC347A9 A8010000     ........_.G.....
0x000001C0: 00000000 00000000 00000000 000000DF     ................
0x000001D0: 140C076C DEFF0028 03000020 760B80FE     ...l...(... v...
0x000001E0: FFFF83FE FFFF0048 790B0028 450200FE     .......Hy..(E...
0x000001F0: FFFF82FE FFFF0070 BE0D00D8 3A0055AA     .......p....:.U.
0x00000200:
No, I have not tried wipefs, will try.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Cannot install GRUB after BSD.

#15 Post by dasein »

Naron wrote:But I have installed other Linux distributions without backing up the Windows partitions and everything was OK
OMG... are you really as oblivious as you sound? "Yeah, I've played Russian Roulette before and 'everything was OK.'"

Backups protect against all kinds of problems--not just PEBKAC but water leaks, lightning strikes, and the inevitable wear that affects all mechanical devices (including hard drives), to name just a few.

There is no such thing as "safely" mucking around with partition tables and MBRs. You can either learn from this experience or repeat it someday. The choice is yours.

Post Reply