How to temporatily disable Grub2

Hi,
I have a Microsoft security fix pending that apparently will not install so long as Grub2 is active.
I have very little knowledge of Linux 12 and am wondering whether there is a way to disable Grub2, boot directly into Windows, and then re-instate Grub2.
Any help would be greatly appreciated,
Thanks,
s660117

Where is grub2 installed?

If you are not sure, then look in “/etc/default/grub_installdevice”.

I can’t say exactly what to do without knowing that. However, it is probably a matter of changing the active partition. You can use “fdisk” for that, typically

# fdisk /dev/sda

The “p” command prints (displays) the partition table. The “*” on a line means that partition is active.

The “a” command toggles the active bit for a partition. You normally need to use it twice - once to turn off the active bit on the currently active partition, and once to turn it on for the Windows partition. Then use “w” to save the changes. Ignore the message about error rereading partition table.

If you do that, make a note of what was the active partition. That should be on paper, since you might be locked out of linux.

After Windows is happy, boot from a live linux CD or similar, or from the install DVD or similar – but in rescue mode – and use the “fdisk” command to put it back the way it was.

I’m assuming that your problem is with Windows update KB3033929. There’s actually a short thread about that.

Thanks for your reply.
Yes, I am trying to install KB3033929.
Doing a cat of grub_installdevice yields –
/dev/sda4
activate.
Does that indicate where the Linux partitions are located on the disk?
s660117

Also…
I am unfamiliar with fdisk and am not sure how to execute it in this context.

It indicates where you boot from. You can use


df

to see mounted partitions. “/dev/sda4” might be your linux root. Or it might be “/boot” if you have a separate partition for that. Or it might be the extended partition.

You might prefer “cfdisk”. I’ll describe that first.

Open a terminal (“konsole” in KDE or “gnome-terminal” in Gnome, or just “xterm”). If you are not familiar with that, try “xterm”.

Become root:

 su - root 

Then, as root, enter the command:

# cfdisk /dev/sda

Do not type the “#”. That’s the shell prompt character if you are root (with possible a path). I put it there when suggesting root commands, as a hint.

The “cfdisk” command will give a simple display of the partitions. You can move up and down with the up/down arrows on your keyboard. You can use the TAB key to move to different fields in a line.

Move down to the line for “sda4”. The “Boot” flag is probably highlighted. Hit ENTER to toggle that (turn it off). Now move to the Windows partition - it will be a partition with NTFS file system, probably the larger of two. I’m guessing that it is probably “sda3”. Again, toggle the Boot flag with Enter.

Now look over the result to see if you like it. It should be the same as when you started, except for the boot flags. If you like the result, use TAB to move to the “Write” indicator to write the results to disk. If you screwed up, use TAB to go to the QUIT indicator to exit without making changes. If you really really screwed up and are lost, use CTRL-C to just abort.

Now for “fdisk”. It is plain text, and does not even try to be graphical. But it is almost certain to be on your rescue CD or DVD or USB when you are trying to restore things. If using “fdisk” do this: (I assume you are still root)


# fdisk /dev/sda
p
a
4
a
3
p
w

The “p” prints the partition table. The “a” toggles the active flag. There will be a prompt asking which partition. The “4” answers that prompt. The “a” again. I used “3” for the partition, but change that to whatever is the Windows boot partition. Again, “p” to look at the result. The “w” writes it back. If you messed up, use “q” instead of “w” to just quit. Or use CTRL-C to abort (which is safe if you have not used a “w”).

If you are not sure which is the Windows boot partition: The grub boot menu might tell you. Or it might be mounted at “/windows/C” and the “df” command will tell you what is mounted there.

I hope that helps.

Ok…
IF I execute fdisk -l, I see, amongst all the information above individual partitions –
Device Boot Start End Blocks Id System
/dev/sda1 63 80324 40131 de Dell Utility
Partition 1 does not start on physical sector boundary.
/dev/sda2 81920 45522943 22720512 7 HPFS/NTFS/exFAT
/dev/sda3 45522944 929136639 441806848 7 HPFS/NTFS/exFAT
/dev/sda4 * 929136640 1953521663 512192512 f W95 Ext’d (LBA)
/dev/sda5 929138688 1194340351 132600832 7 HPFS/NTFS/exFAT
/dev/sda6 1194342400 1447673855 126665728 7 HPFS/NTFS/exFAT
/dev/sda7 1447675904 1703673855 127998976 7 HPFS/NTFS/exFAT
/dev/sda8 1703677952 1707886591 2104320 82 Linux swap / Solaris
/dev/sda9 1707888640 1749831679 20971520 83 Linux
/dev/sda10 1749833728 1953519615 101842944 83 Linux

When I execute df, I see –
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 20905860 4624472 15232812 24% /
devtmpfs 2986288 44 2986244 1% /dev
tmpfs 2995296 96 2995200 1% /dev/shm
tmpfs 2995296 656 2994640 1% /run
/dev/sda9 20905860 4624472 15232812 24% /
tmpfs 2995296 0 2995296 0% /sys/fs/cgroup
tmpfs 2995296 0 2995296 0% /media
tmpfs 2995296 656 2994640 1% /var/run
tmpfs 2995296 656 2994640 1% /var/lock
/dev/sda10 101680700 27005284 73656988 27% /home

I am assuming that dev/sda4 is the Linux partition, although if I look at a diskmap, the first of the three Linux partitions is at position 7 (counting up from 0). I am also assuming, based on size, that dev/sda3 is Windows.

My problem with the fdisk command is that the only way I get any output is to type fdisk -l, which does not put my in interactive mode.
Bear with me here. I know I have successfully used fdisk to remove Linux in the past, but cannot remember how to use the command.

Ok…
I found an online tutorial on fdisk and used the a option to toggle the boot partition from 4 to 3.
I then booted the system, but got the message that the boot loader was gone and that I should press alt/ctrl delete to restart.
It booted up to the same error.
I then went into rescue system in an attempt to set the boot partition back to 4.
But I was then prompted for a rescue userid and password.
I entered my root credentials but was told that they were invalid.
I was then forced to do an update install to get the boot loader back.
What did I do wrong?
s660117
.

I’m quoting your output, but in code blocks for better readability.

I am assuming that dev/sda4 is the Linux partition, although if I look at a diskmap, the first of the three Linux partitions is at position 7 (counting up from 0). I am also assuming, based on size, that dev/sda3 is Windows.

Actually, “/dev/sda4” is the extended partition. That means that it is a big chunk of space that is then subdivided into logical partitions. So “/dev/sda9” (your linux root partition) is inside that extended partition. At this stage, it’s okay if that is confusing.

My problem with the fdisk command is that the only way I get any output is to type fdisk -l, which does not put my in interactive mode.

Yes, you are working a bit blind. But, at any time, you can use the “p” command (just the letter “p” on a line by itself and followed by the ENTER key), to get the same output that you will get with “fdisk -l”. So it isn’t that bad. Looking at the commands that I suggested, you can add another “p” command at each stage to see what has changed.

What you want to change, is to remove that “*” from the line for sda4, and put it on the line for sda3. Nothing else should change.

The sequence of commands that I gave previously is still correct. Just put in extra “p” lines so that you can better see what you are doing. And, remember, you can always use the “q” command to quit without actually changing anything. Unless you use the “w” command, nothing is saved to disk.

Bear with me here. I know I have successfully used fdisk to remove Linux in the past, but cannot remember how to use the command.

I’m doing whatever hand-holding I can. Just give it a try. And remember that either the “q” command (quit without saving the changes) or CTRL-C (hold down the CTRL key and hit C) will safely get you out. Or, if you are really confused, rebooting before you save anything would also work. Closing that terminal window without saving anything would work, too.

What version of Windows is installed? What version of openSUSE and what desktop? Is the machine 32 or 64 bit?

For Windows 7, there is a long thread on the issue at https://social.technet.microsoft.com/Forums/windows/en-US/a08ad884-6b05-4632-8f28-2568eb97b636/update-kb3033929-fails-with-error-code-80004005?forum=w7itprosecurity

Looking at the fdisk output, I think sda2 is the Windows system partition, sda3 is the Windows C drive, and the system boots from the extended partition, sda4.

I got KB3033929 to install on a laptop that is 64-bit and dual-boots openSUSE 13.1 and Windows 7 on a single drive. It boots with GRUB2 in the extended partition, and has both a 100 MB Windows system (sda1) partition, and a 50 GB Windows C drive (sda2). It runs Windows 7 Ultimate. On this machine, when I moved the boot flag from sda4 (the extended partition) to either sda1 or sda2, GRUB2 still ran. I put the boot flag on sda2 (C drive), selected Windows in GRUB2, and started it. KB3033929 then installed correctly; it had previously failed. For some reason on this machine, GRUB2 seems to not care where the boot flag is. It runs in all cases, and will start either operating system. Windows did care; it installed KB3033929 correctly only when the boot flag was on the C drive.

I did all the flag changing by booting gparted-live-0.21.0-1-i586.iso written to a USB memory stick.

Since moving the boot flag did not work on your system, something must be different. In YaST boot loader setup, I checked the box to write generic boot code to MBR. Does yours have that?

Regards,
Howard

And cfdisk shows the first partition as the boot partition.

Thanks for your reply, Howard.
I am running Windows 7 SP1 64bit Home Premium on a Dell Inspiron 660 desktop.
My version of Linux is 12.
Yast boot options say to boot from an Extended Partition; write generic boot code to MBR is not checked and I’m having a problem setting it on.

There is probably already generic boot code (from Windows) in the MBR. Otherwise your system would not boot at all.

Maybe “cfdisk” is confusing at first. It confused me when I tested it an hour or two ago. I normally use plain “fdisk”.

I am aware of the Microsoft article regarding kb3033929 - that’s how I know it’s a boot loader problem.
Now, after moving the location of grub, my cfdisk looks like this –

                                            cfdisk (util-linux 2.21.2)

                                                Disk Drive: /dev/sda
                                        Size: 1000204886016 bytes, 1000.2 GB
                               Heads: 255   Sectors per Track: 63   Cylinders: 121601

  Name               Flags            Part Type        FS Type                   [Label]                Size (MB)

  sda1                                 Primary         vfat                      [DellUtility]              41.13        
                                                       Unusable                                              0.82       *
  sda2                                 Primary         ntfs                      [RECOVERY]              23265.81       *
  sda3                                 Primary         ntfs                      [OS]                   452410.22       *
  sda5               NC                Logical         ntfs                      [Photos]               135784.31       *
  sda6               NC                Logical         ntfs                      [Music]                129706.76       *
  sda7               NC                Logical         ntfs                      [Videos]               131072.00       *
                                       Logical         Free Space                                            1.71       *
  sda8               NC                Logical         swap                                               2155.22       *
  sda9               NC                Logical         ext4                                              21475.89       *
                                       Logical         Free Space                                            0.13       *
  sda10              NC                Logical         ext4                                             104288.10       *
                                       Logical         Free Space 

I have no idea why sda1, which previously was the boot partition is now unusable, nor do I understand why no partition is marked as the boot partition.
(And sorry for the unstructured paste, but I don’t know how to set it off properly.)

Please post the output from

fdisk -l

but please, please paste the output between CODE tags. To do that, in the forum message editor, click on the “#” symbol to the right of the 2nd row of editor icons right above the message window.

Same with this output you just posted. Regenerate it, then paste it between CODE tags, so it is readable.:wink:

sda1 is usable. There is a small (.82MB) unallocated, unusable disk segment between sda1 and sda2. It appears that for some reason, cfdisk does not report the entire extended partition sda4, which is the boot partition.
Howard

Here’s where things stand now -
Fdisk -l shows –

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xe6b3bb69

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63       80324       40131   de  Dell Utility
Partition 1 does not start on physical sector boundary.
/dev/sda2           81920    45522943    22720512    7  HPFS/NTFS/exFAT
/dev/sda3        45522944   929136639   441806848    7  HPFS/NTFS/exFAT
/dev/sda4   *   929136640  1953521663   512192512    f  W95 Ext'd (LBA)
/dev/sda5       929138688  1194340351   132600832    7  HPFS/NTFS/exFAT
/dev/sda6      1194342400  1447673855   126665728    7  HPFS/NTFS/exFAT
/dev/sda7      1447675904  1703673855   127998976    7  HPFS/NTFS/exFAT
/dev/sda8      1703677952  1707886591     2104320   82  Linux swap / Solaris
/dev/sda9      1707888640  1749831679    20971520   83  Linux
/dev/sda10     1749833728  1953519615   101842944   83  Linux
Note: sector size is 4096 (not 512)

Disk /dev/sdb: 3000.6 GB, 3000592977920 bytes
255 heads, 63 sectors/track, 45600 cylinders, total 732566645 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x9a210fa3

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   732565503  2930253824    7  HPFS/NTFS/exFAT

Disk /dev/sdc: 1500.3 GB, 1500301909504 bytes
1 heads, 63 sectors/track, 46512335 cylinders, total 2930277167 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5324add6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63  2930272127  1465136032+   7  HPFS/NTFS/exFAT

Disk /dev/sdd: 2047 MB, 2047681024 bytes
255 heads, 63 sectors/track, 248 cylinders, total 3999377 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009030c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *        2048     3999376     1998664+   e  W95 FAT16 (LBA)

Disk /dev/sde: 7969 MB, 7969177600 bytes
255 heads, 63 sectors/track, 968 cylinders, total 15564800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00cdbefe

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1   *        2048    15564799     7781376    c  W95 FAT32 (LBA)

Cfdisk shows –

                                                  Disk Drive: /dev/sda
                                            Size: 1000204886016 bytes, 1000.2 GB
                                   Heads: 255   Sectors per Track: 63   Cylinders: 121601

      Name               Flags            Part Type        FS Type                   [Label]                Size (MB)
 ---------------------------------------------------------------------------------------------------------------------------
      sda1                                 Primary         vfat                      [DellUtility]              41.13        
                                                           Unusable                                              0.82       *
      sda2                                 Primary         ntfs                      [RECOVERY]              23265.81       *
      sda3                                 Primary         ntfs                      [OS]                   452410.22       *
      sda5               NC                Logical         ntfs                      [Photos]               135784.31       *
      sda6               NC                Logical         ntfs                      [Music]                129706.76       *
      sda7               NC                Logical         ntfs                      [Videos]               131072.00       *
                                           Logical         Free Space                                            1.71       *
      sda8               NC                Logical         swap                                               2155.22       *
      sda9               NC                Logical         ext4                                              21475.89       *
                                           Logical         Free Space                                            0.13       *
      sda10              NC                Logical         ext4                                             104288.10       *
                                           Logical         Free Space 

And df shows –

Filesystem     1K-blocks     Used Available Use% Mounted on
rootfs          20905860  4626528  15230756  24% /
devtmpfs         2986288       44   2986244   1% /dev
tmpfs            2995296       96   2995200   1% /dev/shm
tmpfs            2995296      656   2994640   1% /run
/dev/sda9       20905860  4626528  15230756  24% /
tmpfs            2995296        0   2995296   0% /sys/fs/cgroup
tmpfs            2995296        0   2995296   0% /media
tmpfs            2995296      656   2994640   1% /var/run
tmpfs            2995296      656   2994640   1% /var/lock
/dev/sda10     101680700 27006672  73655600  27% /home

From the fdisk output above, sda1 is Dell Utility, and apparently not bootable. It looks like the boot flag got on sda1 and not sda3, which is indicated to be the Windows C drive.

For moving the boot flags, you need a way to go back to the original setting to have GRUB2 dual-booting. I suggest you put either Knoppix (http://www.knopper.net/knoppix-mirrors/index-en.html) or gparted live (http://gparted.org/) on a CD or USB memory stick and boot to one of those for the flag moving. Using an update install to recover seems cumbersome.

Try again to get the boot flag on sda3 and boot Windows 7.

Howard

That was much easier to read with the code tags.

It looks as if “cfdisk” does not show the extended partition. So I gave bad advice when I suggested that. You will need to make the changes with “fdisk”.

Here, again, are the suggested commands – just what you enter:


# fdisk /dev/sda
p
a
4
a
3
p
w

You can use additional “p” commands to check on what is changing. Change that final “w” to “q” if you want to abort without making any changes. Or use CTRL-C to abort (if you mess up).

The output from the final “p” should be the same as from the first “p”, except that the “*” should now be on partition 3 instead of partition 4. You can safely ignore the message “Partition 1 does not start on physical sector boundary.” That message is very common. When you save the changes (that final “w” command), you can ignore the message about a failure to reread the partition table.