Need to toggle the active flag of my linux partition... how?

I have a dual-booting Windows/OpenSuse machine, and I’m having this exact problem:

http://stevendcampbell.blogspot.fi/2015/03/update-kb3033929-fails-with-error-code.html

A way around the problem is given at the end of the article:

“For computers dual booting Windows and Linux using Grub, boot into Linux and turn the Linux active flag on the partition off. When you reboot you should go directly into Windows and the update should install successfully. You will have to use a Linux boot CD to turn the active flag on for the Linux partition to restore access.”

However, I have no idea how to do this. Could someone give me specific instructions?

(I assume that I can turn the active flag off (whatever that means) in the partitioner. However, after that I have no idea how I should turn it back on with the Linux boot CD. I would need quite specific instructions for that.)

We’ve just been through this on another thread (for another user). So maybe we can avoid the same mistakes.

Start by giving us the output from


# fdisk -l
df

The first of those commands should be done as root (hence the ‘#’ prompt as a hint). Put the result in a code block. You can generate a code block by clicking the ‘#’ symbol in the edit box. Then copy your output into that code block.

Also tell us the version of opensuse that you are using.

And give us the content of the file “/etc/default/grub_installdevice” (also in a code block), assuming that file exists.

I’ll give explicit details when I have the needed information.

You could do this with diskpart in Windows as well.

Run cmd.exe as Admin, run diskpart -> list disk -> select disk X where X is the disk in question and then list partition, select partition X where X is the Linux partition , inactive and that should do it.

I’m running OpenSuse 13.1. uname -a says:
Linux dhcppc1 3.11.10-25-desktop #1 SMP PREEMPT Wed Dec 17 17:57:03 UTC 2014 (8210f77) x86_64 x86_64 x86_64 GNU/Linux

The other info:

Disk /dev/sdb: 500.1 GB, 500107862016 bytes, 976773168 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 label type: dos
Disk identifier: 0x8548e86c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sdb2          206848   669571071   334682112    7  HPFS/NTFS/exFAT
/dev/sdb3   *   669571072   976773119   153601024    f  W95 Ext'd (LBA)
/dev/sdb5       669573120   673781759     2104320   82  Linux swap / Solaris
/dev/sdb6       673783808   715728895    20972544   83  Linux
/dev/sdb7       715730944   976752639   130510848   83  Linux

Disk /dev/sda: 80.0 GB, 80026361856 bytes, 156301488 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 label type: dos
Disk identifier: 0x000aa312

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   156299263    78148608    7  HPFS/NTFS/exFAT
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sdb6       20510716   8350644  11095064  43% /
devtmpfs         8171248        32   8171216   1% /dev
tmpfs            8189132        80   8189052   1% /dev/shm
tmpfs            8189132      6100   8183032   1% /run
tmpfs            8189132         0   8189132   0% /sys/fs/cgroup
tmpfs            8189132      6100   8183032   1% /var/lock
tmpfs            8189132      6100   8183032   1% /var/run
/dev/sda1       78148604  21076112  57072492  27% /media/tempdisc
/dev/sdb2      334682108 102830840 231851268  31% /windows/C
/dev/sdb7      128331460  72553684  54717308  58% /home

There is no “/etc/default/grub_installdevice” in my system.

Okay. That’s a file from installing grub2. You possibly have grub1 (or legacy grub).

The active flag is currently set on your partition 3, which is the extended partition. You need it to instead be on partition 2 (the main Windows partition).

It’s a bit unusual for the main disk to be “/dev/sdb” rather than “/dev/sda”. So recheck that before you do these commands. I’ll assume it is still “/dev/sdb”. If not, you will need to change the “fdisk” command to the appropriate device.

The idea is to use “fdisk” as root. If you are not familiar with using “fdisk” then you are going to feel that you are doing this somewhat blind.

I’ll start with what you enter. Then I’ll comment on it.


# fdisk /dev/sdb
p
a
3
a
2
p
w

The first of those lines starts “fdisk” on “/dev/sdb”. Check first with “df” to see if root is still “/dev/sdb6”.

The “p” line will print out (show on the screen) the partition table. It should similar to the output that you provided from “fdisk”.
The “a” line is to toggle the active bit. You will be prompted for which partition. You enter ‘3’ because you want to turn off the active bit from partition 3.

The second “a” command is again to toggle the active bit. Again you will be prompted. This time, enter ‘2’ because you want to turn on the active bit for partition 2.

The next “p” again prints the partition table. It should be almost the same, except that the active bit (shown as a “*” in the second column) should now be on partition 2.

The “w” saves the changes.

Extra hints:

You can use additional “p” commands to see the progress if you like.
Instead of that final “w”, you can use “q” to quit without saving. Do that if you made a mistake and want to start over.
If you really screw up, use CTRL-C to abort the “fdisk” session. Nothing on disk will have changed unless you did that “w”.

I should have mentioned that after the “w” you will see what looks like an error message about failure to reread the partition table. You can ignore that. (If you were making more extensive changes, then it is warning you to reboot before you do anything else. But, for changing the active flag it doesn’t matter).

If all of that went well, then reboot should take you into Windows to deal with that update problem.

When done with Windows, boot from a live linux CD, or boot the install DVD or similar in rescue mode. And again run “fdisk”. You will need to do almost exactly the same thing in “fdisk”. But this time it will switch the active bit from partition 2 back to partition 3.

Let us know how it all works out.

In some cases with GRUB2, after changing the boot flag, GRUB2 still runs on reboot. However, selecting to boot Windows and applying the update does work. I do not know what legacy GRUB will do.
Howard

I figured I’d boot to the rescue disk first, just to make sure it still works and I can run fdisk from there. And while I was at it, I just changed the active partition from there. (Seemed “cleaner” and safer to do it like that than from the installed linux itself.)

I changed the partition 2 to active, but when I rebooted, Windows complained that it can’t find BOOTMGR. So I figured I’d try setting partition 1 to active instead, and that worked. It booted directly to Windows.

I installed that dreaded update, and this time there was no error when rebooting Windows, and now Windows Update log reports that particular update to have been installed successfully. Changing the active partition back to 3 was non-problematic as well.

So it seems that everything worked nicely. Thanks for your help.

Ah, ok. Partition 1 seems to be the recovery partition, and partition 2 the main Windows partition.

For my Windows 7, either of those works for booting Windows. I guess it depends on how the manufacturer sets up Windows.

I’m glad everything worked out.