LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Windows not loading after grub install (https://www.linuxquestions.org/questions/linux-newbie-8/windows-not-loading-after-grub-install-4175603246/)

Safeway44 04-05-2017 07:34 AM

Windows not loading after grub install
 
From the Grub menu Windows 8 does not load after I select it I get an error
File:\Boot\BCD
Status: 0xc000000e

When I change the BIOS to UEFI from legacy Windows works
but then Kali is not accessible.I had to install Kali under Legacy because under UEFI the CD didn't do its thing, other than the computer brand's logo on the screen glaring.

During install Grub was placed in MBR. As this is a UEFI system is MBR even required? I don't have a spare USB lying around so if the solution can be utilizing the CD that work be ideal.CD is tested and working.

Kali iso is a recent download and it's meant to be UEFI friendly. Kali is loading fine. Thanks

hazel 04-05-2017 10:08 AM

As far as I know, modern versions of Windows will not boot from a GPT disk with a bios. You have to use uefi. And, as you probably know, it is dangerous to keep switching modes because sooner or later you are going to use the wrong one. However, it is possible to convert a bios install to uefi. Basically you have to reinstall grub in uefi mode so that it goes onto your efi system partition. You can do that, using your installation disc.
Here's something I found on a Ubuntu site:
Code:

sudo mount /dev/sda1 /mnt # Mount the root filesystem in /mnt
sudo mkdir /mnt/boot/efi # Create a directory to mount the ESP in
sudo mount /dev/sda3 /mnt/boot/efi # Mount the ESP
sudo grub-install --root-directory=/mnt /dev/sda # Run the grub install

Basically you boot from the CD, mount your normal root partition, mount the efi system partition on the root partition's /boot/efi directory and then install grub there.

trumpforprez 04-05-2017 03:13 PM

Quote:

Originally Posted by Safeway44 (Post 5692916)
Kali iso is a recent download and it's meant to be UEFI friendly. Kali is loading fine. Thanks

What is Kali? Can you tell us more about what it is?

Once a new OS is installed, it is sometimes necessary to run
Code:

update-grub
from the terminal.
So boot your linux distro, run 'update grub' and see if this makes a difference.

Making changes on BIOS to UEFI is not related to your problem.
All linux distros should now be 'UEFI-friendly'.

yancek 04-05-2017 04:07 PM

Quote:

What is Kali?
It's an operating system designed specifically and only for penetration testing/computer forensics and is basically meant for experts. Obviously, it can be used by people wishing to learn/study computer forensics and is absolutely not recommended as a standard Desktop distribution as explained at their site below.

http://docs.kali.org/introduction/sh...use-kali-linux

Mixing MBR and UEFI as mentioned above is the problem and the simplest solution to the problem the OP has would be to install Kali on a flash drive and select that drive on boot when he wants to try to learn penetration testing.

Quote:

As this is a UEFI system is MBR even required? I
If you are using UEFI, you should not have any boot code in the MBR and mixing the two is going to lead to boot problems. If you can boot either by making a change in the BIOS, that's the best you can do if you can't get Kali to install uefi. I'd suggest taking a close look at the Kali documentation on installing UEFI.

BW-userx 04-05-2017 04:27 PM

sounds like you did a different boot method for each one, I'd suggest installing Linux by the same means windows boots. kiss is involved here, get their greatest hits album on apple cares today. :D but that gpt thing well then....

Rickkkk 04-05-2017 04:52 PM

Quote:

Originally Posted by BW-userx (Post 5693120)
sounds like you did a different boot method for each one ...

Agreed.

Quote:

, I'd suggest installing Linux by the same means windows boots ...
Also agreed. Several previous posts suggest solutions. ...

Quote:

... kiss is involved here, get their greatest hits album on apple cares today. :D ...
... smirk ... that's worth a Deuce ... :D

Cheers ...

Safeway44 04-06-2017 07:50 PM

Quote:

Originally Posted by hazel (Post 5692966)
Basically you have to reinstall grub in uefi mode so that it goes onto your efi system partition. You can do that, using your installation disc.


Quote:

Originally Posted by hazel (Post 5692966)
Basically you boot from the CD,

Should I be in legacy or UEFI when I do this? The CD won't do anything when its in UEFI with the iso in it.

Quote:

Originally Posted by hazel (Post 5692966)
mount your normal root partition,

Am I in terminal when I do this? What screen should I be seeing on my screen to execute this? Do I use Gparted?

Safeway44 04-06-2017 07:52 PM

Quote:

Originally Posted by yancek (Post 5693113)
If you are using UEFI, you should not have any boot code in the MBR and mixing the two is going to lead to boot problems.

I recall placing Grub in MBR when prompted during install, I should have said no. How do I remove it from MBR?

Safeway44 04-06-2017 07:54 PM

Quote:

Originally Posted by BW-userx (Post 5693120)
kiss is involved here, get their greatest hits album on apple cares today.

No thanks, I just want to Gpart all night and everyday:)

Rickkkk 04-06-2017 10:17 PM

Quote:

Originally Posted by Safeway44 (Post 5693626)
No thanks, I just want to Gpart all night and everyday:)

... I think we're hitting Rock Bottom ... :D

... OK I'll stop.

hazel 04-07-2017 02:02 AM

Quote:

Originally Posted by Safeway44 (Post 5693620)
Should I be in legacy or UEFI when I do this? The CD won't do anything when its in UEFI with the iso in it.

At this stage, you'll have to boot the CD in bios mode. The point is to change that for the future.
Quote:

Am I in terminal when I do this?
Yes. These are console commands.
Quote:

What screen should I be seeing on my screen to execute this?
I have no idea. I've never used Kali. And if you know so little about Linux as to ask these questions, you should not be using Kali either. It's really not a good distro for learning.
Quote:

Do I use Gparted?
Definitely not! gparted is a partitioning tool. There's probably nothing wrong with your partitioning scheme. You just need to install grub where the uefi expects to find bootloader code, i.e. in the efi system partition.

Safeway44 04-15-2017 07:22 AM

I started with root@(none)
Quote:

Originally Posted by hazel (Post 5692966)
sudo mount /dev/sda1 /mnt # Mount the root filesystem in /mnt

Quote:

Originally Posted by hazel (Post 5692966)
sudo mkdir /mnt/boot/efi # Create a directory to mount the ESP in

I typed it in and got: "already exists"

Quote:

Originally Posted by hazel (Post 5692966)
sudo mount /dev/sda3 /mnt/boot/efi # Mount the ESP

I typed it in and got:
"sudo: unable to resolve host(none): connection refused" Which connection is that?

Quote:

Originally Posted by hazel (Post 5692966)
sudo grub-install --root-directory=/mnt /dev/sda # Run the grub install

Do I need to be online (connected) to install? Can it be done through Grub prompt too?

Quote:

Originally Posted by hazel (Post 5692966)
Basically you boot from the CD, mount your normal root partition, mount the efi system partition on the root partition's /boot/efi directory and then install grub there.


hazel 04-15-2017 07:54 AM

Are you logging in remotely? That "connection refused" thing usually occurs when people use ssh.

Make sure you are using the right device name for the partition. It probably isn't sda3 on your system. That extract I gave you was just an example. Running fdisk -l will give you a list of the partitions on your own hard drive together with their types. The one that is down as an efi system partition is the one you need to mount.

You can check if the efi system partition actually has mounted by subsequently using the mount command without any arguments.

Safeway44 04-16-2017 01:58 AM

Quote:

Originally Posted by hazel (Post 5697265)
Are you logging in remotely? That "connection refused" thing usually occurs when people use ssh.

No I am not logging in remotely. Accessing a computer that's sitting on my desk in front of me.


Quote:

Originally Posted by hazel (Post 5697265)
The one that is down as an efi system partition is the one you need to mount.

I ran fdisk and was able to see a list of partitions and one labelled EFI.

However when I tried fdisk l on a virtualbox version of Kali I didn't, instead I got: Welcome to fdisk (util-linux 2.29.1)
Changes will remain in memory only, until you decide to write them to disk. Be careful before using the write command.

fdisk: cannot open 1: no such file or directory


Quote:

Originally Posted by hazel (Post 5697265)
You can check if the efi system partition actually has mounted by subsequently using the mount command without any arguments.

Is this what you mean by no arguments?:
sudo mount

hazel 04-16-2017 02:47 AM

Quote:

Originally Posted by Safeway44 (Post 5697544)
No I am not logging in remotely. Accessing a computer that's sitting on my desk in front of me.


I ran fdisk and was able to see a list of partitions and one labelled EFI.

However when I tried fdisk l on a virtualbox version of Kali I didn't, instead I got: Welcome to fdisk (util-linux 2.29.1)
Changes will remain in memory only, until you decide to write them to disk. Be careful before using the write command.

fdisk: cannot open 1: no such file or directory

That should be "-l" for "list", not a 1
Quote:

Is this what you mean by no arguments?:
sudo mount
Exactly, except that you don't need sudo when you use mount this way. Listing mounted partitions is a job anyone is allowed to do. The term "arguments" always refers to strings that follow a command. They provide extra information for the program.

You know, someone who is so much a beginner as you are shouldn't be using Kali at all.

Safeway44 04-16-2017 06:41 AM

Quote:

Originally Posted by hazel (Post 5692966)
Here's something I found on a Ubuntu site:
sudo mount /dev/sda1 /mnt # Mount the root filesystem in /mnt

Starting at root@(none):
I got
sudo: unable to resolve host(none): Connection Refused
Quote:

Originally Posted by hazel (Post 5692966)
sudo mkdir /mnt/boot/efi # Create a directory to mount the ESP in

already exists
Quote:

Originally Posted by hazel (Post 5692966)
sudo mount /dev/sda3 /mnt/boot/efi # Mount the ESP

I got
sudo: unable to resolve host(none): Connection refused
btw sda3 is what partition? Home, boot...?
Quote:

Originally Posted by hazel (Post 5692966)
sudo grub-install --root-directory=/mnt /dev/sda # Run the grub install


Quote:

Originally Posted by hazel (Post 5692966)
Basically you boot from the CD, mount your normal root partition,

root partition is sda1? so what's sda3?
Quote:

Originally Posted by hazel (Post 5692966)
mount the efi system partition on the root partition's /boot/efi directory and then install grub there.


hazel 04-16-2017 07:08 AM

Please read post 13 again. I pointed out there that this is only an example and that you must use the correct partition device names for your system, not the ones used in the example. You need to find out those names and that is what you are going to use fdisk for.

Run fdisk -l and write down the correct partition numbers for the root partition and the efi system partition. The device names will be /dev/sdan where n is the partition number. So if the efi system partition is 1 and your root partition is 2, the device /dev/sda2 must be mounted somewhere on your rescue system (say on /mnt) and /dev/sda1 would then go on /mnt/boot/efi.

Again, these are examples only. You should be able to understand this.

yancek 04-16-2017 07:47 AM

If you are using the Kali DVD to run these commands, stop using sudo. By default when you log in to Kali you already are root. That is the default by design because of it's purpose. To give us a better idea of what you have, when you fun the: fdisk -l (Lower Case Letter L) how about posting the actual output here?

From your earlier posts, the problems you are having are because you have a windows UEFI install with a Legacy/CSM install of Kali. If for some reason, you don't or can't install Kali UEFI, the best you can hope for is to be able to switch to CSM/Legacy in the BIOS to boot Kali and to UEFI to boot windows.

You asked earlier about deleting Grub from the MBR. The page below explains that. Make sure you scroll down the page to the section: Option #2: Command to delete mbr only so you don't delete your partition table. You should be able to boot windows without making this change by setting the BIOS to boot UEFI. You'll need to have someone more familiar with UEFI confirm this.

https://www.cyberciti.biz/faq/linux-...rd-dd-command/

If you get this straightened out and still want to learn computer forensics, I would suggest you install Kali to a flash drive. Detailed instructions on there site and should eliminate a lot of these problems.

hazel 04-16-2017 09:51 AM

It is possible to convert a legacy mbr system to boot with uefi instead. I remember reading a HOWTO on doing this immediately after installation by remounting the hard drive on the installation image, mounting the efi system partition on it, and then installing GRUB in its proper location on the esp. Unfortunately I haven't been able to find that item again.

The existing GRUB stub in the mbr can be left in place. It doesn't do any harm because a UEFI running in native mode ignores the mbr.

I've read a lot of warnings against mixing UEFI native and legacy booting on a permanent basis. Sooner or later you're going to use the wrong method with bad results.

Safeway44 04-16-2017 11:25 PM

Quote:

Originally Posted by hazel (Post 5697661)
It is possible to convert a legacy mbr system to boot with uefi instead.

I have an UEFI computer

Quote:

Originally Posted by hazel (Post 5697661)
The existing GRUB stub in the mbr can be left in place. It doesn't do any harm because a UEFI running in native mode ignores the mbr.

Your right, I've changed my mind about deleting the GRUB stub in MBR.

Quote:

Originally Posted by hazel (Post 5697661)
I've read a lot of warnings against mixing UEFI native and legacy booting on a permanent basis. Sooner or later you're going to use the wrong method with bad results.

You mean like computers that run windows on uefi and linux on legacy on the same computer long term?

Safeway44 04-16-2017 11:34 PM

Quote:

Originally Posted by yancek (Post 5697623)
From your earlier posts, the problems you are having are because you have a windows UEFI install with a Legacy/CSM install of Kali.

Correct

Quote:

Originally Posted by yancek (Post 5697623)
You asked earlier about deleting Grub from the MBR. The page below explains that. Make sure you scroll down the page to the section: Option #2: Command to delete mbr only so you don't delete your partition table.
https://www.cyberciti.biz/faq/linux-...rd-dd-command/

There's no mention in the article on how to delete just the small portion of grub that's sitting in the mbr. But thank you anyway. I've decided to leave it as is.

Quote:

Originally Posted by yancek (Post 5697623)
You should be able to boot windows without making this change by setting the BIOS to boot UEFI. You'll need to have someone more familiar with UEFI confirm this.

My windows is booting fine in UEFI

hazel 04-17-2017 01:11 AM

Quote:

Originally Posted by Safeway44 (Post 5697906)
I have an UEFI computer

Yes, but when you installed Kali, you told the UEFI to behave like a BIOS. That's what "legacy mode" actually means.
Quote:

You mean like computers that run windows on uefi and linux on legacy on the same computer long term?
Yes. It's not recommended.

Safeway44 04-17-2017 02:29 AM

Quote:

Originally Posted by hazel (Post 5692966)
mount the efi system partition on the root partition's /boot/efi directory and then install grub there.

I have a separate partition just for boot, should I still go ahead like you said above?

hazel 04-17-2017 02:35 AM

If you have a boot partition, start by mounting it on the empty /boot directory of your root partition. Then create /boot/efi in it. Then mount the esp on /boot/efi.

Safeway44 04-17-2017 02:37 AM

Quote:

Originally Posted by hazel (Post 5697950)
If you have a boot partition, start by mounting it on the empty /boot directory of your root partition. Then create /boot/efi in it. Then mount the esp on /boot/efi.

Could I get the code please?

Quote:

Originally Posted by hazel (Post 5692966)
... and then install grub there.

Do I need to be online to do that?

Quote:

Originally Posted by hazel (Post 5692966)
grub-install --root-directory=/mnt /dev/sda # Run the grub install


hazel 04-17-2017 04:38 AM

Quote:

Originally Posted by Safeway44 (Post 5697951)
Could I get the code please?

Start by reading the man page for mount (man mount). See if you can work out the arguments you need to give it. It'll be good training for you. You really can't use Linux, especially a distro like Kali, if you expect to be spoon-fed all the time. I'll give you a clue: you need to tell mount what partition you want to mount, what kind of filesystem it's using, and where you want to mount it, in that order.

Quote:

Do I need to be online to do that?
No. You only need to be online to use the Internet.

yancek 04-17-2017 07:32 AM

Quote:

There's no mention in the article on how to delete just the small portion of grub that's sitting in the mbr
Yes there is. It is under Option #2: Command to delete MBR only (the last part highlighted in red) but as pointed out above, if you have UEFI set up it ignores the MBR so it's not a problem. I think it would be a good idea to post the actual output of commands like fdisk -l or gdisk -l and also what exactly you have on your separate boot partition. What's in the EFI partition would also be useful information.

Safeway44 04-18-2017 05:04 AM

Quote:

Originally Posted by yancek (Post 5698003)
Yes there is. It is under Option #2: Command to delete MBR only (the last part highlighted in red) but as pointed out above, if you have UEFI set up it ignores the MBR so it's not a problem.

I think your right.

Your saying Grub is that 446 bytes of MBR?
If Grub occupies that 446 bytes of the primary portion in MBR then what was occupying that 446 bytes of space prior to Grub's arrival?

Quote:

Originally Posted by yancek (Post 5698003)
What's in the EFI partition would also be useful information.

I use fdisk -l for this?

hazel 04-18-2017 05:28 AM

No, you mount the efi partition on /boot/efi as I have described, and then use the ordinary Linux file management tools to find out what is in that directory. The whole point of uefi booting is that all boot code is in normal files that can be inspected from out of any operating system, and not in special "magical spaces" like the mbr.

You need some very basic education. Try reading this.

yancek 04-18-2017 07:19 AM

Quote:

If Grub occupies that 446 bytes of the primary portion in MBR then what was occupying that 446 bytes of space prior to Grub's arrival?
Nothing. From the information you posted, your windows was UEFI which does not use the MBR.

hazel 04-18-2017 08:18 AM

Quote:

Originally Posted by yancek (Post 5698519)
Nothing. From the information you posted, your windows was UEFI which does not use the MBR.

Actually on gpt disks (which is what you will have in a uefi machine), the first sector is filled with a dummy mbr, just to reassure programs that expect to find one. There's no boot code until you install it, but there is a dummy partition table with one whole-disk partition on it.

Safeway44 04-19-2017 08:12 AM

Quote:

Originally Posted by yancek (Post 5697623)
If you are using the Kali DVD to run these commands, stop using sudo.

Does that apply if I access root command thruogh Grub and not through the Live CD?

If I'm in root and I did type sudo does it effect what I'm coding?

How do I reboot or save and exit when I want to wrap things up from within command line? using live cd or through accessing command line through GRUB? I tried:
reboot, shutdown and number of other things.

BW-userx 04-19-2017 08:50 AM

Quote:

Originally Posted by Safeway44 (Post 5699159)
Does that apply if I access root command thruogh Grub and not through the Live CD?

If I'm in root and I did type sudo does it effect what I'm coding?


Wether or not #sudo command does something different or not I do not know it is just
over kill - root user does not need sudo command.

Quote:

Originally Posted by Safeway44 (Post 5699159)
How do I reboot or save and exit when I want to wrap things up from within command line? using live cd or through accessing command line through GRUB? I tried:
reboot, shutdown and number of other things.

It depends on how or what you are using to do whatever it is you need to do first .before I could tell you how to save whatever it was you needed to do first.

nano has its own save commands.
VI has its own save commands
cat has its own save commands
etc...

depending on what level you went to and how you got there. If everything is saved properly 'exit' will boot you out of it, three finger salute may work, hard shut down defiantly works. just got a keep in mind posable consequences from that one.

anyone else?

Safeway44 04-24-2017 06:26 AM

Quote:

Originally Posted by hazel (Post 5697611)
sudo mount /dev/sda1 /mnt # Mount the root filesystem in /mnt

sda1 is root?
Quote:

Originally Posted by hazel (Post 5697611)
sudo mkdir /mnt/boot/efi # Create a directory to mount the ESP in

I have a separate boot partition so /boot is referring to that?
Quote:

Originally Posted by hazel (Post 5697611)
sudo mount /dev/sda3 /mnt/boot/efi # Mount the ESP

sda3 is ESP partition?

yancek 04-24-2017 07:28 AM

Quote:

If I'm in root and I did type sudo does it effect what I'm coding?
I think you need to get back to some basics and probably read a little about Kali before you continue. You do know that Kali is designed specifically and exclusively to be used for penetration testing and computer forensics. The Kali developers created the system so that when you log in you ARE root. You do not need to use 'sudo' to switch to the root user becasue you ARE root when you log in. Using sudo at the Grub prompt won't do anything different.

Quote:

How do I reboot or save and exit when I want to wrap things up from within command line? using live cd or through accessing command line through GRUB?
Are you still trying to find file for Kali on the EFI partition? The commands suggested above should do that. What are you wanting to save? You are pretty limited in the commands you can run from Grub since it is just a bootloader. If you are using the Kali Live CD that's different and if you want to see if there is an EFI partition and what it's contents are, run either fdisk -l or gdisk -l (Lower Case Letter L in both command) and look at the output or post it here. You can run the mount commands suggested by hazel to see what is in those directories.

Since you indicate you can boot windows UEFI and you are having all this difficulty getting Kali to work, you might be better off installing Kali on a flash drive. Their site has very detailed instructions on doing that and you could then format the old Kali partitions to be used for data.


All times are GMT -5. The time now is 11:14 PM.