Upgrading 12.3 -> 13.1 (repo update method); now with broken grub

Last night I upgraded from 12.3 to 13.1 using the repo update method (change repos from 12.3 to 13.1 then zypper dup). During the install, I had a message that grub2 could not be installed.

Now my system boots to the ‘grub rescue’ prompt.

I followed the instructions from this post: https://forums.opensuse.org/content/128-re-install-grub2-dvd-rescue.html

All works as expected until I actually try to configure grub:

Rescue:/> grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/bin/grub2-editenv: error: cannot open '/boot/grub2/grubenv.new' No such file or directory
/usr/bin/grub2-mkconfig: line 253: boot/grub2/grub.cfg.new: No such file or directory

Do I need to re-install Grub2? I don’t think I know how to do that from outside the system.

Oh. I think I may be on to something…

I tried Cafe’s instructions again, but this time also added

mount /boot

Then I tried ‘grub2-mkconfig’ and got a respose:

cat: write error: No space left on device

So, I’m wondering if the problem all along was that there isn’t enough space on my boot partition to update Grub2 in the first place (though, there is not complaint if I re-install Grub)

Do you have a separate “/boot” partition?

If you do, then check whether it is full. That would explain your symptoms.

If it is full, then you probably need to delete some old kernels to make space. While in rescue mode, and while you are in that chroot environment, you can run “yast” in a terminal. Go to software manager, search for kernel, check the installed versions, and delete the older versions that you don’t need.

Or, more crudely, just delete the old kernels and “initrd” files for those kernels from “/boot”. Once you have the system up and running, use Yast from within the system to clean up remaining remnants of the old kernels.

Thanks, nrickert

Don’t know whether this represents progress or not, but it’s different…

I tried first through Yast but still could see linux 3.7 kernels if I looked into the /boot dir. So I used your ‘more crude’ method and just deleted the 3.7 kernels and initrd files.

This time, when I try to run ‘grub2-mkconfig’ I get a different response:

Rescue:/> grub2-mkconfig -o /boot/grub2/grub-cfg
Generating grub.cfg ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-3-11.6.4-desktop
Found initrd image: /boot/initrd-3.11.6-4-desktop
Found linux image: /boot/vmlinuz-3-11.6.4-default
Found initrd image: /boot/initrd-3.11.6-4-default
Found linux image: /boot/vmlinuz-3.11/6-4-xen
Found initrd image: /boot/initrd-3.11.6-4-xen
ERROR: opening path /mounts/initsys/sys/block
ERROR: failed to discover devices
ERROR: opening path /mounts/initsys/sys/block
ERROR: failed to discover devices
ERROR: opening path /mounts/initsys/sys/block
ERROR: failed to discover devices
ERROR: opening path /mounts/initsys/sys/block
ERROR: failed to discover devices
  /dev/mapper/control: mknod failed: No such file or directory
  Failure to communicate with kernel device-mapper driver.
  Check that device-mapper is available in the kernel.
  No volume groups found
Found Windows 7 (loader) on /dev/sda1

Does that mean something useful to you?

You probably didn’t do the rescue properly.

From memory:

Boot the live media.
Mount your root partition at “/mnt”

Mount your “/boot” at “/mnt/boot”

Mount any other important partitions.


# mount --bind /dev  /mnt/dev
# mount --bind /sys  /mnt/sys
# mount --bind /proc  /mnt/proc
# chroot /mnt

If grub2 is already installed, then:

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

If you are not sure whether it is already installed, you might instead need to run yast (at the command line) and go into the bootloader section. Or possibly use “/usr/sbin/grub2-install” and I think that might need to be told where to install.

Your error message suggests to me that you skipped one of those “–bind” mounts.

OK, that makes some sense (probably, you’ve guessed by now that I really have very little idea what I’m doing).

I tried verbatim what you suggested but ran into an error

My boot partition is at /sdb1 and my root partition is at /sdb3 so I did:

mount /dev/sdb3 /mnt
mount /dev/sdb1 /boot
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc


chroot /mnt
grub2-mkconfig -o /boot/grub2/grub.cfg

and I get the same error as before.

The bootloader is set to boot from the master boot record, which seems right but I added also to boot from the boot partition (it’ll try those in order, correct?)

Anyway, grub2-install (as well as ‘grub2-install.unsupported’) is visible in /usr/sbin/

I’d kind of like to learn how to fix this but I may be time ahead if I just install 13.1 over the top of the existing and spend the weekend re-installing/configuring software.

That was…

mount /dev/sdb3 /mnt
mount /dev/sdb1 /mnt/boot

I went back out to the rescue disk prompt and added:

mount --bind /boot /mnt/boot
chroot /mnt
grub2-mkconfig -o /boot/grub2/grub.cfg

and I get

/usr/sbin/grub2-probe: error: failed to get canonical path of 'tmpfs'.

I’m assuming ‘tmpfs’ refers to the swap partition. Do I need to mount the swap partition too?

No, that should not be needed. Something else is wrong, but I’m not sure what at the moment.

If your installed system is 64-bit, then your rescue boot (live CD or whatever) must also be 64-bit. Similarly, if the installed system is 32-bit, then the rescue boot must be 32-bit.

I’m not sure if that is the problem, but I would expect weird messages if you have an architecture mismatch.

No, this message simply means that your /boot is not mounted on real device and remains just a directory on RAM disk (used by rescue system as root).

I don’t think it’s the problem. I’ve been using only 64bit systems for several years now.

OK, so I ignored it and proceeded to the next ‘grub2-install’ instruction and got:

mkdir: cannot create directory at ?/boot/grub2?: File exists 

So I did:

Rescue:/ # cd boot
Rescue:/boot #  mv grub2 grub2.old
Rescue:/grub2-install /dev/sdb

and I get:

Path '/boot/grub2' is not readable by Grub on boot. Installation is impossible. Aborting.

So I took a look back at ‘fdisk -l’ and notice that my Windows partition (at sda1) is the only partition with a Boot flag. Is that relevant?

Error messages should not be ignored, but fixed. Please post full output of

cat /proc/self/mountinfo

in chroot immediately before you execute grub2-install.

OK, I’m not exactly sure what it was that I did to make it work, but I kept playing with the mount locations and the ‘grub2-mkconfig’ worked without errors. Sorry, I know that’s not very helpful for the next reader…

Anyway, when my system finally booted again, I had nearly 4,000 packages in need of update (mostly, the texlive stuff. I do a lot with LaTeX). I did a ‘zypper dup’ and left while the system updated.

I rebooted and still had another 700+ package in need of update but I just updated those through Yast.

Other than having to go back and rework the video configurations I think I’m in pretty good shape now. (I have the Ivy bridge and an Nvidia card; the kernel really wants to use Nouveau. …but that’s another issue entirely and I’ve solved it before so I think I’ll be OK.)

Appreciate all the help from both arvidjaar and nrickert.

That many packages sounds like a version upgrade So you were still at 12.3 I guess???

Anyway if you see a huge number of packages to upgrade you need to stop and think if you don’t know why ask here for help