Hi
I’m trying to figure out how to reboot just once in a different OS (Windows 10) and after rebooting from W10 it automatically comes back to opensuse at the boot screen order as default.
I’ve tried some methods like these (no matter if the GRUB2_DEFAULT=0 or saved - 0 is the TW:
Method 1:
sudo grub2-set-default 2
which is the W10 place at the boot order and then
sudo reboot
but it fixed the boot order to always boot on W10 although I have an option to manually change it in the boot loader screen.
Method 2:
same as 1 but editing /etc/default/grub and setting
GRUB_SAVEDEFAULT="false"
follwed by
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
but the result was the same as 1
Method 3:
same as 2 but instead of
sudo grub2-set-default 2
I used
sudo grub2-reboot 2
But it did a mess in the boot! It even give me the boot options to choose from, booting directly on W10. The only solution to come back to opensuse is a recovery.
0 openSUSE Tumbleweed
1 Advanced options for openSUSE Tumbleweed>openSUSE Tumbleweed, with Linux 5.1.7-1-default
2 Advanced options for openSUSE Tumbleweed>openSUSE Tumbleweed, with Linux 5.1.7-1-default (recovery mode)
3 Advanced options for openSUSE Tumbleweed>openSUSE Tumbleweed, with Linux 5.1.5-1-default
4 Advanced options for openSUSE Tumbleweed>openSUSE Tumbleweed, with Linux 5.1.5-1-default (recovery mode)
5 Windows 10 (on /dev/sda1)
6 Ubuntu 18.04.2 LTS (18.04) (on /dev/sda3)
7 Advanced options for Ubuntu 18.04.2 LTS (18.04) (on /dev/sda3)>Ubuntu (on /dev/sda3)
8 Advanced options for Ubuntu 18.04.2 LTS (18.04) (on /dev/sda3)>Ubuntu, with Linux 4.18.0-20-generic (on /dev/sda3)
9 Advanced options for Ubuntu 18.04.2 LTS (18.04) (on /dev/sda3)>Ubuntu, with Linux 4.18.0-20-generic (recovery mode) (on /dev/sda3)
10 Advanced options for Ubuntu 18.04.2 LTS (18.04) (on /dev/sda3)>Ubuntu, with Linux 4.18.0-15-generic (on /dev/sda3)
11 Advanced options for Ubuntu 18.04.2 LTS (18.04) (on /dev/sda3)>Ubuntu, with Linux 4.18.0-15-generic (recovery mode) (on /dev/sda3)
12 Advanced options for Ubuntu 18.04.2 LTS (18.04) (on /dev/sda3)>Memory test (memtest86+, serial console 115200) (on /dev/sda3)
13 Start bootloader from a read-only snapshot> openSUSE Tumbleweed (5.1.7-1,2019-06-19T13:45,post,yast services-manager)
and many other snapshots.
I reverted the grup2.cfg as per original state.
If I run:
sudo grub2-once 5
sudo reboot
pc reboots in windows as expected but without passing through the boot loader screen anymore and after I reboot from W10 it is always keeping booting into W10 with no boot loader screen options to choose.
As far as I know, “grub2-once” works by storing information in “/boot/grub2/grubenv”. And grub2 is supposed to remove that information on the next boot. But grub2 is unable to write to “grubenv” if it is on a “btrfs” file system.
Or, at least, that used to be the problem. I don’t know whether it is still a problem.
mount | grep boot
/dev/mapper/system-root on /boot/grub2/i386-pc type btrfs (rw,relatime,space_cache,subvolid=266,subvol=/@/boot/grub2/i386-pc)
/dev/mapper/system-root on /boot/grub2/x86_64-efi type btrfs (rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/x86_64-efi)
ls /boot/grub2/
device.map fonts grub.cfg grubenv i386-pc locale themes x86_64-efi
fdisk -l /dev/sda
Disco /dev/sda: 298,1 GiB, 320072933376 bytes, 625142448 setores
Modelo de disco: WDC WD3200BEKT-6
Unidades: setor de 1 * 512 = 512 bytes
Tamanho de setor (lógico/físico): 512 bytes / 512 bytes
Tamanho E/S (mínimo/ótimo): 512 bytes / 512 bytes
Tipo de rótulo do disco: dos
Identificador do disco: 0xc9415531
Dispositivo Inicializar Início Fim Setores Tamanho Id Tipo
/dev/sda1 * 2048 1026047 1024000 500M 7 HPFS/NTFS/exFAT
/dev/sda2 1026048 508813311 507787264 242,1G 7 HPFS/NTFS/exFAT
/dev/sda3 508813312 566771711 57958400 27,7G 83 Linux
/dev/sda4 566771712 625142447 58370736 27,9G 8e Linux LVM
I guess the sda1 is the initializer/bootable one and I suspect sda is the whole disk as it seems windows is on sda2.
Well if you use ext4 file system rather then BTRFS (downside no snapshots) grub will be able to write. Or you could create a small ~500 meg partition and set /boot to as the mount and formatted ext4. let the main root partition be BTRFS. But the downside of this is that grub would not be able to boot to a snapshot since the BTRFS is on a different partition. So it looks like you won’t be able to do this unless you toss BTRFS and live without snapshots. I figure the problem is that grub runs before the kernel and thus does not have access to the BTRFS code and porting said code into the grub may not be possible or break other stuff. All sorts of cache 22’s
I think I can live without snaps, it’ll even save me some Mib. Could you point me out to a step by step process of changing the grub2 stuff and /boot to the formatted ext4 sda1 partition, considering the need to boot in win10 and ubuntu? I’m just a beginner with very few knowledge in linux. I dont have much to lose btw but I dont wanna lose w10 :shame:
One thing that I cant understand is why bootloader change its behavior when I reboot using grub2-once 5 or grub2-reboot 5 (booting straight into w10 without asking what os to boot) but it works well when using grub2-set-default 5 asking what to boot!
It will require reinstall and going to expert mode and setting the file system ext4 and format for each partition. Be sure that the installer is pointing to the old partitions since doing a new install it will think it needs to create new partition. Note you can keep any old home partition which is probably formatted as XFS if you want just mount it as /home and Not to format
If you have any detail question ask
That’s the purpose of grub2-once as long as it is active it will go to the designated OS. It should be deactivated after that boot but grub does not know BTRFS and can’t properly deactivate it
Do I need to reinstall all tumbleweed or is there a way to reinstall only the /boot part itself?
If need to reinstall do I lose all settings already done in the actual installation e.g. themes, kontact, kde, etc?
If the settings are stored in home partition (I dont know), how can I mount it? before or during the reinstall?
will i lose all the packages, gpg keys etc?
No you can’t just do boot (at least not easily). All personal setting are in your home you do lose system settings back to the defaults but most of those are in /etc so backing that directory should save them.So just don’t format your home (assuming home is on a separate partition and not on root) and mount it as /home.
I see you have a LVM defined but also a regular Linux so not certain of exactly how things are setup. You do have to take care and explain when you use exotic configurations.
hmmm my home is not a separate partition, it is inside the root/home. Can I still mount it outside the root?
the other Linux is an Ubuntu partition i’m testing.
Can I move /home and /etc to Ubuntu partition, make the entire reinstall process and move them back to suse? is it just a simple copy of folders process? what about the dependencies of the packages?