Bug 31209

Summary: dualboot win10/mga installation: loss of win10 and HP recovery
Product: Mageia Reporter: Alain Choucroot <choucroot>
Component: InstallerAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED INVALID QA Contact:
Severity: critical    
Priority: Normal CC: lewyssmith, mageia, mageiatools
Version: 8   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:
Attachments: disk partitions after mga8 automatic install

Description Alain Choucroot 2022-12-01 10:29:34 CET
Description of problem:

   After automatic installation of mga8 onto a win10 HP computer, windows AND HP recovery were corrupted.


Version-Release number of selected component (if applicable):

mga8


How reproducible:


Steps to Reproduce:
1. PC ((HP 820-G3 ) with functionnal win10 (resetted factory configuration)
2. Installation of mga8 with live-cd on usb key in "automatic" mode

=At reboot, mga is functionnal. But when selecting Windows boot manager (on /dev/sda1), Windows is not functional. Nether the windows recovery. Worst thing is that the HP recovery is not functional tool.


A big warning should be displayed at "automatic" mode when the Windows partition occupies the whole disk. A message should invite the user from resizing the Windows partition using Windows. Otherwise, the win10 resizing by the mga installer is risky (dommageable in my case !)

I join a copy of the disk partition after installation
Comment 1 Alain Choucroot 2022-12-01 10:31:14 CET
Created attachment 13539 [details]
disk partitions after mga8 automatic install
Comment 2 Lewis Smith 2022-12-01 21:37:08 CET
Sorry for your angst. The disc partition picture was useful: it looks good. Let me check...

I happen to have a computer here, a Lenovo laptop with Win10, on which I added Mageia. In addition to the main Windows partition, there are a couple of small extra recovery partitions: one 16Mb between the ESP & Windows, shown 'Windows Recovery', which I think corresponds to the grey partition in your picture; a second of 1Gb right at the end of the disc, which is also shown on your disc. I think these have been left alone by the installer.

I had started by shrinking the main Windows partition - to make room for Mageia - from Windows: this is always recommended: defrag, reboot, shrink, reboot.
In your case, the main Windows partition is still 196Go, which is huge; so it is unlikely that the shrinkage done by the installer messed it up by over-doing it. You should not assume that the installer has messed up Windows.

Personally, I always manually set up the partitions in advance with Gparted from a Live USB, in this case using the free space left by previously shrinking the Windows partition. In your case, it seems you left it all to the Installer; other people do. The picture looks correct: all the Windows bits seem to be there.

You can at least boot into Mageia. With what? Grub2 or rEFInd?
So, please post the output of:
 $ inxi -Dop
and as root (or sudo)
 # fdisk -l /dev/sda
 # efibbootmgr
 # ls -l /boot/EFI/EFI/Boot/
 # ls -l /boot/EFI/EFI/mageia/
 # ls -l /boot/EFI/EFI/Microsoft/Boot/
 # ls -l /boot/EFI/EFI/refind          [if it is there]
[One can do this in one go, but there can be very many files listed]

Do not despair yet.

CC: (none) => lewyssmith

Comment 3 Alain Choucroot 2022-12-02 10:35:03 CET
Thanks for your response.

I am so sorry to tell that I reinstalled mga8 in a "single-boot" configuration. Meaning I chose to format the whole disk.Bby consequence windows and HP recovery are definitely erased. I bought this PC in order to use mageia. Keeping Windows would have been a "plus"

So it's over for further investigating. I am so sorry not to contribute more.

Now I know that the proper way is to prepare the disk with free space. Actually this is what is recommended in many other distributions. Even some recommend to proceed using the windows disk manager rather than Gparted. May Windows (and HP) consider an "external" partion resizing as a possible "attack", and set itslef in a "recovery mode" ? Apparently no, because you succeed with Gparted.

This bug entry just to wonder if the installer should prevent from installing in automatic mode if there isn't free space. AT this time, there is a "chkdsk under Windows" invitation. May the installer better indicate the proper way to the user? More radically, should the installer not "touch" the windows partitions and interrupt installation process without available free space?
Comment 4 Lewis Smith 2022-12-02 20:13:54 CET
Thank you for your reply. Your last pount is interesting: do not let the installer shrink the Windows partition, but instead tell the user to do that beforehand *from Windows*. This is actually fairly involved if you do it thoroughly, and innocent users would rather leave it to the Linux installer.  Remember: this automatic shrinking of that partition to make room for Linux has been going on for years, and clearly normally works.

I had a thought about what might have caused your grief - if you had actually used Windows. It is bad about closing down un/tidily, and leaving its filesystem in an unfinished state. If that then gets shrunk externally, it may end up in a mess. I trod this path twice recently, and it was quite intricate to oblige Windows to close down properly. Then to safely shrink its partition. All sorts of things: disable 'fast boot' (Windows &/or BIOS), sometimes the pagefile, defrags, chkdsk.

There is a presumption that the user who wants to keep his Windows will have done these things; there is plenty of advice around. If it is still not right, if you can actually boot Windows somehow (EFI boot menu, rEFInd), chkdsk should fix things. But this is all hypothesis.
BTW I now wonder whether the second grey partition is the HP special recovery one.

Final note: I had to replace the disc on one of the two machines I fiddled with recently, and try to keep Windows through that. That involved creating a special 'windows recovery' USB stick [back to factory state], which worked; except it took many hours to create (accepting that the original disc was flaky), and many hours to restore on the new one...

I am CC'ing the installer people in case thay have anything to add.

Status: NEW => RESOLVED
Resolution: (none) => INVALID
CC: (none) => mageiatools

Comment 5 Alain Choucroot 2022-12-03 10:03:28 CET
"There is a presumption that the user who wants to keep his Windows will have done these things"

Yes, you're right. It didn't take precautions. A Windows user would have thought twice!

Yet, I still can't understand what happened to the HP recovery. I thought this add-on was able to reset the computer in any cases (a reason these PCs are more expensive!) There is a direct access at boot with F11 touch. The PC was nearly in its "out of factory" state. A reset had been done by the guys in the reconditionning shop I bought it. I just used windows for a couple of hours. 
And the HP recovery was broken when I tried to use it. How can mageia corrupt that !!? A simply explanation: it is not an independant HP tool, just an overlay of the Windows recovery ;-) ! I don't know.

On the HP site, there is a procedure to dowload a recovery of the recovey (with an HP cloud tool). At that point, I gave up. I knew that the tool would analyze the disk and notice a "Linux" installation ... which might not be in the guarantee clause ;-)

Thanks for your listening
Comment 6 Martin Whitaker 2022-12-03 11:10:45 CET
Unfortunately, with the whole disk now reformatted, we can't investigate further to find out what happened.

Are you sure the HP recovery worked before you installed Mageia?

Before proceeding to resize the Windows partition, the installer does display a big message that starts by warning you that it is a dangerous operation. I have never trusted it myself - in the days when I still had a machine I wanted to dual-boot, I created a Windows recovery disk and reinstalled Windows into a smaller partition before installing Mageia.

CC: (none) => mageia

Comment 7 Alain Choucroot 2022-12-03 11:56:21 CET
_ "Are you sure the HP recovery worked before you installed Mageia?"

_ "the installer does display a big message that starts by warning you that it is a dangerous operation".

Maybe this 2 points are linked. I thought the HP recovery would worked in any case. Thus I minimized the warning, thinking I would be able to recover even if the mga installer would damage Windows or something else.

The second point: I had not used Windows for 7 years. Buying this new PC, I just wanted to keep the preinstalled Windows. I logged once, Windows downloaded its upgrades. I installed and used 1 little soft (in order to flash Samsung devices). That's all. I also executed the "chkdsk" as the inslaller warning advices.

I know it is totally my fault. 

Yet you say that experimented users never install dual-boot without precautions. Now let's imagine a "beginner"; if there isn't any free space on a (Windows) disk, why should the mageia installer continue instead of aborting? 

I know the cursor for implementing such behavior depends on the level of mageia users, and expected new users also! In my case (==not an expert), aborting would have been a good option. 

I entered this "bug", wondering if such an evolution would be interesting. But I am not representative of all mageia users. You guys have the global "vision" ;-)
Comment 8 Martin Whitaker 2022-12-03 12:52:29 CET
(In reply to Alain Choucroot from comment #7)
> Maybe this 2 points are linked. I thought the HP recovery would worked in
> any case.

I would have thought so too, but as you say this is a refurbished machine, maybe it was already broken.

> Yet you say that experimented users never install dual-boot without
> precautions.

No, I say *I* never install dual-boot without precautions. I'm just another Mageia user.

With Linux, I know I can recreate my system on a blank disk if something goes wrong (and I always keep a backup of my home directory on another machine). I can't be sure I can recreate a Windows installation, so I was always extra cautious about that.

> Now let's imagine a "beginner"; if there isn't any free space
> on a (Windows) disk, why should the mageia installer continue instead of
> aborting? 

Because it finds there is unused space in the Windows partition and offers to use some of that. This is meant to be a beginner-friendly option - a beginner is unlikely to know how to manually shrink their Windows partition to make space. Personally I wouldn't trust it, but I'm not the person who made the installer. That was done back in the Mandrake days, when there were people employed to make this stuff work, and to fix it when it didn't.

> I entered this "bug", wondering if such an evolution would be interesting.
> But I am not representative of all mageia users. You guys have the global
> "vision" ;-)

Mageia is a community-developed distribution - all users' opinions count :-)