-2

I just managed to install a dual boot for Kali Linux and Windows 7. So I can choose to start from my secondary disk, where GRUB finds place, can chooce Kali and everything works fine. The problem: It's only working fine, when a USB-Stick is inserted. I know it sounds weird, but its true...

I installed Kali with a image burned to USB-stick with Rufus. Install progress went fine, no problems at all, but now, I can only start Kali when "A" usb stick is inserted, I don't say when "THE" usb stick is inserted, it can be ANY usb stick, I completely formatted the usb stick, I tried another one, it doesn't mind, it just has to be one and exactly one usb stick inserted (if I plug in a second one, it's again not working), the error I get says something like sdb3 not found. And I already got behind the problem. Kali always mounts the USB-Stick to sda, the partition with Kali partitions on is sdb and another partition on another disk is on sdc (doesn't mind for Kali). Now I guess, that Kali tries to find the partition under sdb3, but if my usb-stick is not plugged in, it would be sda3.

I hope you understand what I mean.

This is a picture of the sdb disk

This is a picture of the sdb disk.

So again, it seems, that Kali always tries to boot from sdb, but as I plug in the usb-stick, sdb is something different then without the usb-stick.

How can I change this? I'm really wondering why it's referencing on the identifier sdb instead of really referencing to the disk itself.

So what can I do against this, so I don't have to start with a usb-stick inserted?

Edit: The output of lsblk is the following: enter image description here And honestly I'm a bit confused about the thing behind sda1, because I completely formatted that device...

Edit2: running grub install gives me the following error: enter image description here

Output of parted-l

Model: SanDisk Extreme (scsi)
Disk /dev/sda: 62.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      32.8kB  3020MB  3020MB  primary               boot, hidden
 2      3020MB  3021MB  721kB   primary


Model: ATA WDC WD30EZRX-00M (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                  Flags
 1      20.5kB  134MB   134MB                                         msftres
 2      135MB   2162GB  2162GB  ntfs            Basic data partition  msftdata
 3      2162GB  2980GB  818GB   ext4            Basic data partition  msftdata
 4      2980GB  2992GB  12.6GB  linux-swap(v1)  Basic data partition  msftdata
 5      2992GB  3001GB  8389MB  ntfs            Basic data partition  msftdata


Model: ATA WDC WD5000AAKX-0 (scsi)
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary  ntfs         boot

[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

simply outputs BIOS

  • Without the USB does it boot straight to Windows or does it boot to grub and then fail to find /dev/sdx? If you are getting an error message please post it. – bu5hman Nov 15 '17 at 12:09
  • Its always booting staright to windows, as my boot order is set to the other disk with windows on it, to boot in Kali I press F11 to get in boot menu and choose the other disk (you can see that one in the image) and then grub comes up, which then automatically starts kali (or at least tries to). – nameless Nov 15 '17 at 12:11
  • Can't do like screenshot the message, because its just in a console like, but it says something like Failed to mount (or find, not sure) sbd3, falling back to a shell, and then I have a shell, where I can enter few commands. – nameless Nov 15 '17 at 12:12
  • what is the output from lsblk executed from kali. Do you have 2 disks in your machine? – bu5hman Nov 15 '17 at 12:16
  • When I select the second disk to boot, grub comes up, then kali is (auto-)selected and then I get this message saying that it can't find sdb3 – nameless Nov 15 '17 at 12:19
  • You are booting kali-live. This is not the one you installed on your HDD. Remove your USB and then go to boot menu options. – defalt Nov 15 '17 at 13:01
  • @bu5hman added a screenshot of the output – nameless Nov 15 '17 at 13:35
  • @defalt how can it be possible? again, the USB-Stick is completely EMPTY and I can plug in ANY other usb stick, that has nothing to do with Kali at all – nameless Nov 15 '17 at 13:36
  • Once you boot kali run sudo update-grub && sudo grub-install /dev/sdb – defalt Nov 15 '17 at 13:38
  • @defalt getting an error with that as well, just edited my question to show the error. – nameless Nov 15 '17 at 13:49
  • can you show parted -l and [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS and please not as picture. –  Nov 15 '17 at 13:58
  • @Bahamut would have loved to, but now its completely destroyed, the grub install command made it not startable any more, once booting in grub I'm getting a invalid license error, I'll try reinstalling Kali now, the 3rd time... – nameless Nov 15 '17 at 14:04
  • @nameless you can show it from your install-medium. –  Nov 15 '17 at 14:15
  • @Bahamut edited my question for this two commands – nameless Nov 15 '17 at 14:38
  • also, now removed the boot flag from the usb stick, but doesn't change anything... – nameless Nov 15 '17 at 15:17

2 Answers2

1

I see.

Summary: 2 Hardrives. One with gpt-schema the 2. with ms-dos.

When you install in bios-mode on a hardrive that has a gpt partition table und you will install grub on this, you need to create a so called BIOS-Boot partition

Another oppertunity is to install grub in the 2. drive, there is also your bootloader from windows; and make this drive in bios as first bootmedium.

this one

Model: ATA WDC WD5000AAKX-0 (scsi)
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary  ntfs         boot

I mean.

  • Just tried the second thing and its not working, too. I tried every possibility now. Installing GRUB on 1. drive (sdb) and on 2. drive (sdc), as well for both boot from one disk and boot from the other disk.. Nothing is working as it's meant to....However, if it won't be working, I'll just keep booting with a usb-stick inserted, even if it doesn't make sense at all.. – nameless Nov 15 '17 at 15:55
  • If you are going to use Kali tools for the purpose intended you need to treat every obstacle as a challenge and not give in, patience, analysis and sheer bloody-mindedness are the keys. True, the behaviour of your system seems odd but once you have cracked the install, it will be you helping others with the same problem. Hang on in there @nameless. – bu5hman Nov 15 '17 at 18:10
1

Despite the fact that you have to press F11 to get the grub menu it seems that grub is installed on your windows drive (since you can boot to grub with any other non-bootable USB and the windows disc is the only one with a boot flag set).

You can verify the location of grub with the help of ghulselmans script.

To boot into kali without the usb plugged in, drop to the grub shell from the grub menu (press c when the grub menu shows) and proceed pretty much as is described here.

From your info, and assuming that without the usb plugged in your kali install is on sda3, called (hd0,3) by grub, the boot sequence from grub shell will be

set root=(hd0,3)              
linux /vmlinuz root=/dev/sda3
initrd /initrd.img
boot

Once you are successfully in, check that /etc/default/grub/config policy does not prevent use of UUID, as described here then reinstall grub. It will probably only allow installation on your bootable windows drive (which will now be sdb without any usb plugged).

Before rebooting

cat /boot/grub/grub.cfg

and check whether grub.cfg is using UUID or not. If it isn't then, as you already noted, you need to correct this to avoid problems booting if you have a usb plugged in later.

To avoid breaking the new grub install by editing working entries, it will be better to add a new UUID configured menu entry to grub.cfg.

First get the UUID for sda3 from

sudo blkid

Then copy the contents of the existing grub menu item for Kali into a new grub menu item and edit it to replace /dev/sda3 with its UUID equivalent. I use grub-customizer for these edits and there are probably other tools but editing grub.cfg by hand is not recommended.

The finished custom entry should look something like

#calls to insmod will be the ones you copied, these are mine
insmod part_gpt            
insmod ext2 
#this is your main edit
search --no-floppy --fs-uuid --set=root YourSda3Uuid
linux /boot/vmlinuz-WhateverVersion root=UUID=YourSda3Uuid ro quiet
initrd /boot/initrd.img-WhateverVersion

Reboot and test it. If it fails then boot back in to Kali via your unedited (top of the menu?) grub entry and check your syntax in the grub manual

And one last thing.

If there are links to your current vmlinuz and initrd in / then amend your menu entry to

linux /vmlinuz root=UUID=YourSda3Uuid ro quiet
initrd /initrd.img

and then when your kernel updates and modifies the links your menu entry will pick up the new kernel.

bu5hman
  • 4,756