# [Solved] change GRUB2 boot default from windows/linux

## DeIM

I'm connected to distant PC with gentoo via SSH. There are windows too. Grub default boot option is set to windows, so when I reboot PC it boots windows. Is there any way to boot from windows to linux, i.e. e.g. change default boot option from windows? Thanks.Last edited by DeIM on Sat Oct 31, 2015 7:23 pm; edited 1 time in total

----------

## eccerr0r

Well, this would be an advantage of installing GRUB on a FAT filesystem, and then Windows could edit that directly.  Else you'd have to install some sort of ext2fs or whatever filesystem driver on that machine and then you can use that to edit the grub configuration.

Another possibility if you have a hex editor and search for the file and edit the file that way...very carefully...

You may be SOL, especially if the editing fails and you don't have some sort of remote management hardware...

----------

## DeIM

Maybe setting default grub boot option will be more easy from gentoo.

I've found command:

```
grub2-reboot
```

But it's not working for me   :Sad: 

When I set to boot windows:

```
grub2-reboot 0
```

It changes default entry to first entry - windows. But when I reboot it is still set to 0, but default in config is 1 (gentoo). It simply didn't returned to default config before grub2-reboot command.

Is there a bug or am I doing something wrong?

----------

## DeIM

Solved myself:

in /etc/default/grub needs to be GRUB_DEFAULT=saved

then

```
grub2-mkconfig -o /boot/grub/grub.cfg
```

```
grub2-set-default 0

grub2-reboot 1
```

now works   :Smile: 

----------

