OpenSuse Set time to zero in grub and default booting OS is Windows - how to rectify problem

I have a computer with dual boot - one is Windows XP, the other is Opensuse Leap. I wanted to have grub let me choose between which OS to be loaded (typically it was loading XP after a few seconds). So now, once grub appears, it will immediately boot in windows. I thought that a time of zero will make grub wait for user selection of the OS, but it is not. I also read on a few forums that pressing the shift key during booting of the system may bring up the grub menu, but unfortunately that is just a myth (or a desired future for many of us :slight_smile: ). It makes me wonder why the developers don’t provide an easy way to access the grub configuration menu when a silly user changes the time to zero and default boot OS to non-linux.

Anyway, I used an older Linux installation disk and I selected the rescue option.
Now I have root access. I read all kind of advice about configuring grub from the rescue prompt, but some of them appear to be missing some important steps. They advise to start grub and then modify the grub configuration file.
In my case, once I am under Rescue:~ #, when I type ls, I can only see the directories .gnupg, .local and bin. Does this mean I can’t access the directory boot?
What can I do in this case?

Thanks,
Nick

run yast from command line

When I type yast, I get: -bash: yast: comand not found
I did a search using find . -name yast and I found it under ./etc/sbl/profile/yast, but even when I go to that directory and type yast, it tell me command not found.

I’m still trying to fix it using various methods and I found out that I can reach the directory /etc/default, where there is a grub file.
I edited that file using vim editor. In the notes it says that afterwards we have to use grub2-mkconfig -o /boot/grub2/grub.cfg

I found grub2-mkconfig under ./usr/sbin/grub2-mkconfig, but there is no such thing as /boot/grub2/grub.cfg file to be upgraded.

Thanks,
Nick

In my case, once I am under Rescue:~ #, when I type ls, I can only see the directories .gnupg, .local and bin. Does this mean I can’t access the directory boot?
What can I do in this case?

I discovered if I enter cd / and then ls, I can see more directories: bin, boot, dev, etc, home, lib, media, mnt, mounts, parts, proc, root, run, sbin, sys, tmp, usr, var.

However, if I try to find a file called grub.cfg, using the command find . -name grub.cfg, nothing comes up.

I wonder if I get access to my hard disk, or if I need to do something else - I would expect that at some stage, I should be asked to enter the root password - at this time, I have the # prompt, but I am guessing I have root privilege only for the rescue cd, not for my hard disk

Nick

ok since you ae in emergency shell I guess you don’t have paths set so full paths are needed so /sbin/yast

Also I assume you are logged in as root

Yes, I am logged in as root in the rescue shell (although I was never asked for my password).
I don’t know how to set the paths to /sbin/yast (and I think that path is different in my case).

I can find yast under /etc/sbl/profile/yast and under /mounts/mp_0001/etc/sbl/profile/yast.
If I go to /etc/sbl/profile and type yast, it says “-bash: yast: command not found”
Same for the other directory.

Thanks,
Nick

Run this command in full as you see it:

/sbin/yast

BTW:

You can set Grub so it immediately defaults to the OS you desire.

You can also set it so it does that without showing the Grub menu, with a setting that would then let you press and hold the Shift key when you want the Grub menu to show up.

But, that is a setting you would apply (actually, a script you would add). If you want that, I could show you how. But, first, just launch Yast by using the above command with its full path as shown. In there, change your timeout setting.

… wait a minute. If you are at the Rescue prompt and were able to log in as root without a password, then I guess you are booting from the install disk. Am I right?

If so, you need to go through the chroot process to get proper control over what you are doing.

Also, are you sure you are looking at the directories on your hard drive, or are you looking at the directories from your running install Rescue system? There is a difference.

… ahhh, I see.:frowning:

First, you absolutely must use the same installation version as the version of openSUSE you have installed. So, your first step would be to get the matching install media and burn it to DVD (if you do not have it around already).

If you are using LEAP, you must use the LEAP install disk and use the Rescue system from that.

Check back when you have done that.

Mr Bell,

You are right, I used the install disk to boot and I selected rescue system. And I am most likely looking at the directories created by the install disk. I had the suspicion I can’t see my hard disk because I could not find my home/username folder.

Nick

OK, I found my original Leap disk and although I managed to scratch it in the meantime, I can boot in Rescue System. Based on what you said, I looked at how to use the command chroot at https://wiki.archlinux.org/index.php/Change_root , but it’s not easy - the command

# swapon /dev/sda1 

does not work for me

Nick

Okay, good for you, trying to hunt down the solutions yourself! You will learn a lot more by doing that!:good:

Here is what to do:

Start again. Boot with the install DVD and go to the Rescue system. As you have discovered, the password for root in the Rescue system is blank, so you will not need to enter one.

At the Rescue:~# prompt, do:

parted -l

Post the output back here between code tags. To get those code tags, look at the menu icons at the top of this post editor, middle row near the right, you will see the “#” symbol. Click on that, and your cursor will be blinking between two CODE tags. Paste in there.

If you do not know how to copy and paste that, then just copy what you see to paper and type it as accurately as you can between those CODE tags when you reply back here.

The first thing we need to determine is what your HD is listed as in that particular output and which partition is your Linux system partition.

It will also help if you remember where you installed Grub (a special boot partition, perhaps?).

On 20/12/15 11:56, NickFi wrote:
>
> I have a computer with dual boot - one is Windows XP, the other is
> Opensuse Leap. I wanted to have grub let me choose between which OS to
> be loaded (typically it was loading XP after a few seconds). So now,
> once grub appears, it will immediately boot in windows. I thought that a
> time of zero will make grub wait for user selection of the OS, but it is
> not. I also read on a few forums that pressing the shift key during
> booting of the system may bring up the grub menu, but unfortunately that
> is just a myth (or a desired future for many of us :slight_smile: ). It makes me
> wonder why the developers don’t provide an easy way to access the grub
> configuration menu when a silly user changes the time to zero and
> default boot OS to non-linux.
>
> Anyway, I used an older Linux installation disk and I selected the
> rescue option.
> Now I have root access. I read all kind of advice about configuring grub
> from the rescue prompt, but some of them appear to be missing some
> important steps. They advise to start grub and then modify the grub
> configuration file.
> In my case, once I am under Rescue:~ #, when I type ls, I can only see
> the directories .gnupg, .local and bin. Does this mean I can’t access
> the directory boot?
> What can I do in this case?
>
> Thanks,
> Nick

Hi Nick,
I am not one of the Linux gurus around here but I have been in a
situation where I needed to reinstall Grub/Grub2 back to MBR or to
edit the old menu.lst or the new /etc/default/grub configuration
file and used a grub boot disk (floppy until not long ago) to
achieve that easily. Super Grub2 boot disk is fantastic for
situations like yours - it will probe hdd for all installed
OSes and give you the option to boot directly into any of them.

http://www.supergrubdisk.org/super-grub-disk-and-super-grub2-disk-difference/

>>Super Grub Disk and Super Grub2 Disk Difference

GRUB2 is a complete rewrite of GRUB, and Super GRUB2 Disk is a complete
rewrite as well. As Super GRUB2 Disk uses GRUB2, the differences between
GRUB Legacy and GRUB2 also apply to the different versions of Super GRUB
Disk.

Perhaps the most notable difference between Super GRUB Disk based on
grub legacy and Super GRUB2 Disk is that Super GRUB2 Disk does not write
to the disk at all, and so cannot rewrite the MBR. Super GRUB2 Disk can
only be used to boot a broken system, it cannot fix it directly. Though
once a system is booted, re-installing grub is usually just a matter of
running “grub-install /dev/sda”.

While there are some features of Super GRUB Disk based on GRUB legacy
that will never be included in Super GRUB2 Disk, the opposite is also
true. For instance, Super GRUB2 Disk supports booting OSX, loop booting
from iso files, booting an OS from USB without USB support in the BIOS,
and other features that are not possible with GRUB legacy.<<

You can download iso from here (approx 14 MB):
http://www.supergrubdisk.org/category/download/supergrub2diskdownload/super-grub2-disk-stable/

… waiting for your

parted -l

output …:wink:

You will find the rest is very easy, once we get that.

Oh boy,

I spent already 5 hours trying to find a solution to grub. Using fdisk -l I can see I have /dev/sda1 to /dev/sda7. sda1 appears to be the container for sda2… sda7. sda2 contains my Windows. sda5 has a Linus swap/Solaris. sda6 and sda7 are Linux partitions. I have no idea which one contains the grub configuration file. They are not accessible because they are not mounted. I run the commands

mkdir /mnt/arch 
mount /dev/sda6 /mnt/arch/

At this moment, I have no idea what I should expect anymore… I feel that the directory /arch is a stupid name. I should have created a directory called sda6 instead of arch.

Nick

Hi Fraser,

I already burned the SuperGrub2 disk, but for the sake of finding a method to manually fix this, I will provide the output here:

disk /dev/sda 200GB
Disk Flags:

Number Size Type File System Flags
1 137GB primary NTFS type=07
2 62.6GB extended - boot, lba, type=0f
5 1.6GB logical linux-swap(v1) type=82
6 21.5GB logical btrfs type=83
7 39.5GB logical ext4 type=83

Thanks Peter,

I just created the SuperGrub disk, but before running it, I will go along with what Fraser has to say - probably there is more to learn that way than using this software.
For me, it would be enough to be able to boot into Linux, because from there I can use Yast and reconfigure grub. It is very easy to do that, even for myself - the problem is that before I could not boot in Linux anymore.

Nick

Okay, forget those instructions you are following. I will be giving you the correct instructions for openSUSE. But, I need to know which partition is your root partition.

To do that, boot to the Rescue prompt again, then mount the partition you think is your root partition (possibly sda6 or sda7?).

You would do that like this:

mount /dev/sda6 /mnt

Then do:

ls -l

If you see output like this:

ls -l
total 236
drwx------   4 root root   4096 Apr 25  2015 .kde4
-rw-r--r--   1 root root 161675 Dec 19 18:05 .readahead
drwxr-xr-x   2 root root   4096 Nov  7 17:10 bin
drwxr-xr-x   4 root root   4096 Jul  4 22:16 boot
drwxr-xr-x  21 root root   3680 Dec 19 18:16 dev
drwxr-xr-x 132 root root  12288 Dec 19 18:05 etc
drwxr-xr-x   4 root root   4096 Oct 15  2014 home
drwxr-xr-x  17 root root  12288 Nov 15 19:11 lib
drwxr-xr-x   6 root root   4096 Aug 18 02:00 opt
dr-xr-xr-x 161 root root      0 Dec 19 10:04 proc
drwx------  35 root root   4096 Dec 19 21:37 root
drwxr-xr-x  30 root root    800 Dec 19 19:04 run
drwxr-xr-x   2 root root  12288 Nov 30 00:10 sbin
drwxr-xr-x   5 root root   4096 Oct 15  2014 srv
dr-xr-xr-x  12 root root      0 Dec 19 18:04 sys                                                                                                                                    
drwxrwxrwt  20 root root   4096 Dec 19 21:30 tmp                                                                                                                                    
drwxr-xr-x  12 root root   4096 Nov  6  2013 usr                                                                                                                                    
drwxr-xr-x  16 root root   4096 Jun  3  2015 var

You will see the directories bin, boot, dev, etc, home, lib and so on, most of what you see for directories should be the same as what you see above.

The boot directory listed above is where Grub resides.

If you do not get the similar list, then do:

umount /dev/sd6

Then, mount another partition, probably sda7, using the above example.

Once you have found the root partition, let me know. I am sitting here waiting.

I will then show you how to chroot and do the rest.

Hi Gerry,

I mounted both partitions and both of them show a very similar output with what have.
Don’t I need to change directory to /mnt before running ls -l?
I think it should be
<code>
mount /dev/sd6 /mnt
cd /mnt
ls -l
</code>

I believe that /mnt/sda6 is the correct one, since I have more folders in it than in sda7. Directory /mnt on /dev/sda7 contains one trash, one lost+found and two directories with my usernames.

Nick

…er, heh, heh. Yep…:shame:

I think it should be
<code>
mount /dev/sd6 /mnt
cd /mnt
ls -l
</code>

correct.

I believe that /mnt/sda6 is the correct one, since I have more folders in it than in sda7

Nick

It should have the bin, boot, dev, etc, home, lib, opt, proc, root, run, tmp, usr, and var directories listed, that would be the root. Check for those directories, we are almost there.:slight_smile: