How to remove grub2 and install grub OS 12.2

Hi,

I would like to know, in OS 12.2 64bits, how to remove grub2 and use grub.

Yast2 as ususual does have a great menu to do it.
Some of the things I have made under Yast2 did indeed generate the menu.lst under /boot/grub/.
But it does not seem to me like grub was installed.
Rather grub2 continued to boot the laptop.

I am a bit scared to make a grub-install and mkinitrd.
So if someone could let me know how to do this in a Safe way, i would be very much appreciated.

Regards.

You should tell a bit more about the PC you use.

How old is it?
Does it boot in UEFI mode?

That sounds a bit like that you installed in UEFI boot mode earlier and can’t get rid of that now.

Hi,

I would not ask for the removal of grub2 if the pc booted with a uefi bios … no that is not the case.
It is not UEFI fortunately, it is a very good old BIOS. So grub is more then sufficient, and highly preferable.
And yes the computer is a bit old … an Athlon Turion-X2 dual core.

Regards.

Could you show content of /var/log/YaST2/y2log_bootloader?

Installing Grub Legacy is an option in openSUSE 12.2, but its only a temporary thing. You need to make the transition to Grub 2 else you will be swimming upstream. I have a nice little bash script that can help you learn how to use Grub 2. Have a look here:

GNU Grub2 Command Help/Config Editor - Version: 1.90 - Blogs - openSUSE Forums

AND

FastBoot for Grub 2 or Grub Legacy Menu using Kexec - Version 2.13 - Blogs - openSUSE Forums

And we have some great articles on the subject you can find here:

http://forums.opensuse.org/content/102-booting-opensuse-uefi-bios-elilo-grub2-linux-only-multi-booting.html

http://forums.opensuse.org/content/102-booting-opensuse-uefi-bios-elilo-grub2-linux-only-multi-booting.html

http://forums.opensuse.org/content/128-re-install-grub2-dvd-rescue.html

Please have a look before you give up on Grub 2 and good luck.

Thank You,

Don’t remove it since it is the default! Install Legacy Grub in another boot sector (than the one where Grub2 is installed).

Yes, I tried that once, and it didn’t work. As I’m not a big YaST fan, I didn’t insist.

Here’s another method (that works).

  • install updategrub from my repo;
$ su -l
# zypper ar http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_12.2/  PTA
# zypper --gpg-auto-import-keys refresh -r PTA
# zypper in updategrub

# findgrub
Find Grub Version 4.4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> SUSE Generic MBR (Sig: 0xf4523c46)
 - skipping partition  /dev/sda1      (NTFS Win RE)  
 - searching partition /dev/sda2      (NTFS)          ... --> Windows7/Vista Loader found in /dev/sda2

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sda2
    rootnoverify (hd0,1)
    chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - searching partition /dev/sda3      (NTFS)          ...
** - reading bootsector  /dev/sda4   *  (Extended)      ... --> Grub2 (2.00) found in /dev/sda4   => sda10  0x83 (openSUSE)**
 - skipping partition  /dev/sda5      (swap)         
 - reading bootsector  /dev/sda6      (LINUX)         ... --> Grub2 (2.00) found in /dev/sda6   => sda6   0x83 (Ubuntu)
 - reading bootsector  /dev/sda7      (LINUX)         ...
 - reading bootsector  /dev/sda8      (LINUX)         ...
 - reading bootsector  /dev/sda9      (LINUX)         ...
 - reading bootsector  /dev/sda10     (LINUX)         ...
 - reading bootsector  /dev/sda11     (LINUX)         ...
 - reading bootsector  /dev/sda12     (LINUX)         ...
 - reading bootsector  /dev/sda13     (LINUX)         ...
 - reading bootsector  /dev/sda14     (LINUX)         ...

There are a lot of Linux partitions where we could put Legacy Grub boot loader, and you can have as many occurences of stage1 as you have (linux) boot sectors available. openSUSE root partition is sda10, as we can see with this command:

# df -hl -x rootfs | awk '/\/$/ { print $1}'
/dev/sda10

or that command:


# blkid -U $(cat /proc/cmdline | sed 's|.*UUID=\(^ ]*\) .*|\1|')
/dev/sda10

or many other ones. We can install Legacy Grub in this partition boot sector by simply typing** installLegacyGrub** as root and entering “sda10” when asked for the partition.


# **installLegacyGrub**
Please specify a partition: **sda10**

Allright, you know what you are doing.
Please wait while Writing Grub menu...
Scanning...
Installing grub...

Running** findgrub** again will show that the boot loader has been installed:

# findgrub
Find Grub Version 4.4.1 - Written for openSUSE Forums

 - reading MBR on disk /dev/sda                       ... --> SUSE Generic MBR (Sig: 0xf4523c46)
 - skipping partition  /dev/sda1      (NTFS Win RE)  
 - searching partition /dev/sda2      (NTFS)          ... --> Windows7/Vista Loader found in /dev/sda2

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can add the following entry to /boot/grub/menu.lst :

###Don't change this comment - YaST2 identifier: Original name: WindowsBootLoader###
title Windows on /dev/sda2
    rootnoverify (hd0,1)
    chainloader +1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 - searching partition /dev/sda3      (NTFS)          ...
 - reading bootsector  /dev/sda4   *  (Extended)      ... --> Grub2 (2.00) found in /dev/sda4   => sda10  0x83 (openSUSE)
 - skipping partition  /dev/sda5      (swap)         
 - reading bootsector  /dev/sda6      (LINUX)         ... --> Grub2 (2.00) found in /dev/sda6   => sda6   0x83 (Ubuntu)
 - reading bootsector  /dev/sda7      (LINUX)         ...
 - reading bootsector  /dev/sda8      (LINUX)         ...
 - reading bootsector  /dev/sda9      (LINUX)         ...
** - reading bootsector  /dev/sda10     (LINUX)         ... --> Legacy GRUB  found in /dev/sda10  => sda10  0x83 (openSUSE)**
 - reading bootsector  /dev/sda11     (LINUX)         ...
 - reading bootsector  /dev/sda12     (LINUX)         ...
 - reading bootsector  /dev/sda13     (LINUX)         ...
 - reading bootsector  /dev/sda14     (LINUX)         ...

/boot/grub/menu.lst has been written and includes a chainloader for Grub2.

###Don't change this comment - YaST2 identifier: Original name: Grub2 2.00 on /dev/sda4###
title Grub2 2.00 in /dev/sda4
    rootnoverify (hd0,3)
    chainloader +1

  • finally use updategrub
    with the option -a to add a chainloader for Legacy grub in Grub2 boot menu.
# updategrub -a

It will add an entry in /etc/grub.d/40_custom:

###Don't change this comment - UpdateGrub2 identifier: Original name: (openSUSE)_Legacy_Grub_in_sda10###
menuentry "(openSUSE) Legacy Grub in sda10" {
    set root=(hd0,msdos10)
    chainloader +1
}

which will be appended to the boot menu everytime is is refreshed, whether with updategrub or otherwise - but the first time, you have to use updategrub.

Since you’ll keep Grub2 as default, YaST shouldn’t touch nor mess up /boot/grub/menu.lst (hopefully) after a kernel update - which is rather a good news for multibooters. You should use updateLegacyGrub (or interactively updateLegacyGrub -i) after each kernel update to refresh the boot menu.

Notice that:

When you install the updategrub package under openSUSE 12.1 or previous, updategrub is a symlink to updateLegacyGrub. Under 12.2 it is a symlink to updateGrub2. In any case, updategrub is a symlink.

Related links:

Hi,

Thanks for all the comments so far they were a great help.
To make things clear:

My idea is upgrade with a Fresh install from 11.4-12.2. And to do so with the Current partition setup …no changes there allowed.
So that means to boot with encrypted /, /home and swap from the previous install.

  • I do not have LVM based partitions.
  • All of those filesystems are primary partitions on hdd.

I tried to re-install 12.2 64bits and had huge troubles booting something that apparently should be easy and straightforward …

No being very proficient with the new grub2 lingo I decided to take the most secure route: Install grub legacy instead of the problematic grub2.
What is the Exact nature of my problem:

The instal/up-grade process:
I can not install directly with the encrypted partitions, so I will install on the local remaining primary partition (sda4), like I always have done so far.
The process is simply:

1- Install as usual in non-encrypted sda4

2 -Then I will change manually all the grub/grub2 configs, and /etc/fstab, and /etc/crypttab in order remake initrd for the

3 -Remake the new initrd in order to boot with the New version of the partitions setup

4 - Rsync / to the older encrypted partition

and boot … with the new system installed.

I tried this with grub2 and all teh passwords were asked at the beginning but an error occured at boot after entering the passwords for the encrypted partitions:


device-mapper: table 253:0: crypt: Error allocating crypto tfm
device.mapper: reload ioctl failed:No such file or directory
Failed to setup dm-crypt key mapping for device /dev/sda3.
Check that kernel supports aes-cbc-essiv:sha256 cipher (check syslog for more info).
Failed to read from key storage.

This may not be related to grub2, rather with systemd … or something in the kernel lacking some encription modules.

But just to Separate and isolate the problems I just installed 12.2 with Grub … i will explain latter how.

Lets see if the things work better this time.

Regards.

AFAIK if you upgrade, it will keep using Legacy Grub. A user in the french forum reported this issue: http://forums.opensuse.org/franaais-french/aide-et-support/installation-boot-et-login/480367-migration-11-4-12-1-12-2-a.html

On 2012-11-20 13:46, keyb user wrote:
>
> Hi,
>
> Thanks for all the comments so far they were a great help.
> To make things clear:
>
> My idea is upgrade with a Fresh install from 11.4-12.2.

If you do an upgrade, really an upgrade, your choice of grub is kept
unmodified.

Online upgrade
method

Offline upgrade
method


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

Hi,

Je vous remerci beaucoup pour le url, trés interessant spécialement la partie sur le paradis/asil fiscal :slight_smile: .
Mais:

My problem is far more complex.
If I had a simple setup like the one mentioned I would gladly install grub2 with no problem.
My issues have to do with encryption, grub2 is just a component that I do not yet handle and hence I want to remove from the scenario in order to solve the puzzle in a far more effective way.
Also I notice some complains kernico29 about boot times … strange I notice 12.2 out of the box quite fast …

Another post will reveals more details on the ongoing investigation.

Regards.

note:
Sorry for my bad French … I can speak with no problems … but writing is always more difficult … it reveals immediately … the accent :slight_smile:

Hi Carlos,

I think I mentioned it before, I will try this when everything else fails :slight_smile:
First I want to know What Really happened and how to Manually make this work.
This is: “The Linux Way”, the only way :slight_smile:

And like that I also help others with the same problem.

Regards.

Ok lattest news:

What I have done …
Installed 12.2

  • On Software selection removed grub2
  • once the installer asked to go on adverted that grub2 was not available, complained about it, then a Yast prompt to choose a bootloader appeared.
    I choose Grub and selected purposed config.
    Just added a checkbox on boot on MBR and place bootloader on /boot

Remember this time I was using a flash usb as the /boot.

The setup I made is like this:
/sdc1 /boot

/sda1 old swap encrypted (enc) not touched
/sda2 old / encrypted (enc) not touched
/sda3 old /home encrypted (enc) not touched

/sda4 the new / only for this first install. It will be copied latter for the encrypted sda2.

System complains about not having swap … ignore move on.

The install completed with no problems and grub was the bootloader. As expected.

Ok now the part about migrating to the old setup, that is using sda1 as swap, sda2 as the new / and sda3 as the new /home

I basically followed the steps I usually take on :

http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/459912-11-1-11-4-luks-encryption.html

So, like the above link shows I made:

0 - backuyp fstab, vmlinuz, initrd, menu.lst
1 - Change /etc/fstab,
2 - Change /boot/grub/menu.lst
3 - cryptsetup luksOpen the partitions sda1, sda2,sda3… and mounted sda2 as /mnt/root
4 - made a swapon on the new /dev/mapper/swap
5 - rsync / with old sda2 now mounted on /mnt/root
6 - make a new mkinitrd with:

mkinitrd -d /dev/mapper/root -f "dm luks"

and rebooted the new system.

During boot I noticed that the password was asked twice all the time after each partition and that in the end there was an error like this:

device-mapper: create ioctl failed: Invalid argument 

But the boot continued and finally I could see some boot going.
Too soon to be happy …it all stopped after:


Started Show Plymouth Boot Screen
Starting udev Coldplug all Devices ...
Started Load Kernel Modules 
Starting Apply Kernel Variables
Strated Configuration File System
Started FUSE Control File System
Started Apply Kernel Variables

All of this is OK on screen, all green.
Then everything stops and after a long wait I press esc key and return to the text-base boot screen and there is message:

 Enter your passphrase, only US keyboard layout is supported

I press Enter because this is obviously a mistake maybe induce by wrong kernel parameters.
but to no avail.
After a long while the messages start to pop


Dependency failed. Aborted start of /home
Dependency failed. Aborted start of Loging Service
Dependency failed. Aborted start of Network Manager
Dependency failed. Aborted start of Network Manager Wait Online
Dependency failed. Aborted start of Avahi mDNS/DNS-SD Stack
Dependency failed. Aborted start of D-Bus System Message Bus
Welcome to emergency mode. Use "systemctl default" or ^D to enter default mode.
Give root password for login:

and it accepts root password.

→ I severely suspect that kernel params might be wrong on this one !

My kernel line is

kernel /vmlinuz root=/dev/mapper/root luks_root=/dev/sda2  luks_swap=/dev/sda1 luks_home=/dev/sda3 luks="root swap home" vga=0x317  resume=/dev/mapper/swap splash=silent showopts

Is there something wrong with this in the current kernel version 3.2, specially in what concerns the luks part of the problem ?

Regards.

You have encrypted /home, have not you? So it most likely asks for it. mkinitrd decrypts only those file systems that are required for booting.


Dependency failed. Aborted start of /home
...
Welcome to emergency mode. Use "systemctl default" or ^D to enter default mode.
Give root password for login:

Exactly. It could not mount /home because you did not provide pass phrase to decrypt its device.

Yes, all partitions are encrypted.
But the passphrase is entered Twice Before that.
So there is really no reason to ask for the passphrase except if Systemd is making something really really bad …

Dependency failed. Aborted start of /home

Welcome to emergency mode. Use “systemctl default” or ^D to enter default mode.
Give root password for login:

Exactly. It could not mount /home because you did not provide pass phrase to decrypt its device.

That would be correct if the prompt worked … and also boot already asked for the password right in the beginning of the process.
Also Not having a /home would not stop the boot … could generate a lot of errors but it would not stop, also my experience is that once / is decrypted inside I have a /home, so no big problem would occur.
This is a issue with decrypting or systemd or kernel … grub seems to be doing all it is supposed to do.

Regards.

Then mark it as “nofail” in /etc/fstab.

I have a bash script useful in editing system files like the /etc/fstab file that you can find here:

SYSEdit - System File Editor - Version 1.00 - Blogs - openSUSE Forums

Here is an example where nofail is used in the fstab file and I always add notime to each drive partition mapping entry.

/dev/disk/by-id/usb-ST31500541AS_5XW14NDQ-part1                     /Software            ntfs-3g    defaults,noatime**,nofail**                                  0 0

Your fstab entry will not have the same drive name, but the example shows where nofail is to be placed for external USB drives that you want to map to a fixed location but may not be connected all of the time.

Thank You,

Hi,

Well, I proceeded has explained in:
http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/459912-11-1-11-4-luks-encryption.html

That is, normal install with no encryption on a remaining partition.
Then by editing fstab and making a new initrd I could boot with the configuration I wanted.

Right now the last development is quite strange.

I thought something was really really not right on 12.2 so yesterday I re-installed it and made an up-grade with yast.
So yesterday at night everything was up-dated and! Aha!
I made the exact same procedures as before and …
Voila! I could boot on the encrypted partition!
After making a rsync and editing menu.lst in order to boot with different initrd’s so that I can boot Both configurations.
Now I can boot on both configurations, with / on sda4 (non-encrypted ) and with the rsynced / on the encrypted sda2.
I also change a single file on root sda4 and on sda2 (the encrypted partition) in order to make sure were / was mounted.
And is confirmed I can boot on the encrypted partition with no problems

But the other most Important problem remains :

How do I get to boot With encrypted /home and swap ?
Better question:
I have discovered that in the current up-dated install whn I use the mkinitrd command it does not “process” the encrypted /home (sda3) and swpa (sda1)

On boot it asks for the passwords has commanded by the kernel parameter but those mount are simply not there.

This is way Strange!

Once I make

mkinitrd -d /dev/mapper/root -f "dm luks"

sda2 and sda1 are not “processed”.

Even when mentioned in fstab
I checked this twice.

Regards,

Note:
I have been in Austin, TX, great nice town! :slight_smile:

Hi Good folks!!

DOne IT !
YEAH!

Got both the ebncrypted / and the older sda3 /home up and running …
The problem was not the initrd generation.

The problem was the … never thought about it before … crypttab …

Also the fstab was ok.
I promise to remake all the process from scratch and post a brand new how to in order to be registered for all to see.

Basically the migration is Almost like the same has previously done. That is:

install in a free partitions the New system … luksOpen the older / mount it, errase everything on it , rsync it with the current /.

Then make all the changes on menu.lst, fstab and remake initrd. Watch crypttab also.

After rebooting there is not even the need remake initrd in order take into account the new /home.

In 12.2 Systemd takes care of decrypting partitions, hence it Looks into —> crypttab !

I will detail the process latter.
Also right now I am inserting the passwords for every single Twice !
I will handle that latter.

Regards.

Regards.