Bug 27376

Summary: Partition Table gets damaged after poweroff.
Product: Mageia Reporter: Ezequiel Partida <ezequiel_partida>
Component: RPM PackagesAssignee: Kernel and Drivers maintainers <kernel>
Status: NEW --- QA Contact:
Severity: critical    
Priority: Normal CC: fri
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:

Description Ezequiel Partida 2020-10-09 09:12:51 CEST
Hello,

I got a SATA to MicroSD Adapter like the one on the link below. I installed Mageia 8 Beta 1 64bit using the netinstaller on a 32bg microSD.

https://www.amazon.es/Wendry-Adapter-Tarjeta-Adaptador-Adaptadora/dp/B07SMFPHDW

I used automatic allocation and it added a / around 27gb and a swap file of 3.9 Gb.

My plan is to replace 5 80gb hard drives on 5 Desktop Pcs that boots, autologsin and runs freerdp and connect to one of my terminal server as a thinclient.

Once Mageia is istalled on the MicroSD cards everything works great.. I can reboot Mageia with no problems.. but once I poweroff the PC I lost the partition table.

I lost it 2 times already, I first used poweroff on the terminal an later using poweroff on LXDE.

This setup has been working on the desktop for more than 5 years using Mangeia 2, and 2 of the PCs have been working great with mageia 7 since Mageia 7 was released, I already tested Mageia 8 on a normal HD and it also works great except with this adapter on a MicroSD card.. (I used the same microSD cards on my raspberry Pi using a thinclient debian base linux)

It seems to me that Mageia is probably powering off to soon before unmounting the drives.... is there a way to unmount the drives before powering off the PC? 

What could be the problem?  Please help!

Regards
Ezequiel
Comment 1 Morgan Leijström 2020-10-09 10:25:11 CEST
Thank you for reporting this.

Loosing partition table is critical.

I believe this is for the kernel team.

System should definitely flush and make sure everything is written correctly before powering off.

I wonder if your setup makes it think writing is done while it is not.  Maybe that adapter buffer a lot of writing and system do not know data is not safely written all way to the card.

Have you tested to make the same install to a USB stick inserted into a conventional USB port?

Assignee: bugsquad => kernel
CC: (none) => fri
Severity: normal => critical

Comment 2 Ezequiel Partida 2020-10-09 21:53:38 CEST
(In reply to Morgan Leijström from comment #1)
> Thank you for reporting this.
> 
> Loosing partition table is critical.
> 
> I believe this is for the kernel team.
> 
> System should definitely flush and make sure everything is written correctly
> before powering off.
> 
> I wonder if your setup makes it think writing is done while it is not. 
> Maybe that adapter buffer a lot of writing and system do not know data is
> not safely written all way to the card.
> 
> Have you tested to make the same install to a USB stick inserted into a
> conventional USB port?

No I haven't, but I will do it as soon as possible.

I will try another MicroSD and adapter to test if it's a bad MicroSD or bad adapter.

I'll keep you posted. ;-)

Thank You.
Comment 3 Ezequiel Partida 2020-10-12 17:55:23 CEST
Hello,

I reinstalled Mageia 8 Beta 1 with all latest updates using LXDE and rebooting works great but once I turned off the PC I could not boot.

I later tested the microSD with an Insignia USB Multicard reader and I was able to boot with the microSD card.

I found a video on Youtube that mentions that some of this sintechi high speed sd to cf adapter wont give the correct structure to the bios so they won't boot.

I'm in the process of testing if this is the same issue.

The strange thing here is that when Mageia 8 is installed and rebooted it works great except when turned off.

Regards
Ezequiel Partida
Comment 4 Ezequiel Partida 2020-10-14 03:28:40 CEST
I was able to boot from the microSD card..

I could not install windows 7 either. I just get an error while trying to format.

The only way to make it boot is by doing the next steps.

On Windows I used diskpart.

diskpart
list disk
select disk 3
clean
create partition primary
active
format fs=fat32
assign letter=y
exit

Once the SD was formated.. I copied a bootable USB key (Windows 7).

Once the data was copied I rebooted and it works.

I think this would be possible with a Mageia Installer USB Key.

Now the question is how to make it boot with a mageia installation.

Regards
Comment 5 Morgan Leijström 2020-10-14 09:42:48 CEST
You mean (In reply to Ezequiel Partida from comment #4)
> I was able to boot from the microSD card..

What system did boot from SD?


 
> I could not install windows 7 either. I just get an error while trying to
> format.

Was the error thrown by Windows 7 installer?
What did it say was the problem?
 

> The only way to make it boot is by doing the next steps.
> 
> On Windows I used diskpart.
> 
> diskpart
> list disk
> select disk 3
> clean
> create partition primary
> active
> format fs=fat32
> assign letter=y
> exit
> 
> Once the SD was formated.. I copied a bootable USB key (Windows 7).
>
> Once the data was copied I rebooted and it works.


So you had a bootable working Windows 7 USB stick, and copied it to the SD 
card.  How did you copy ? - Using what operating system, program / command?

The Mageia way of copying the Installer or Live isos will overwrite partition table thus it does not matter how you format it before.  Apparently Windows7 copy procedure is different?


 
> I think this would be possible with a Mageia Installer USB Key.

If i get it right, your computer can boot the Mageia installer from a USB.

It could be interesting to know if your system can boot Mageia Installer or Live when you have put it on the SD card.



 
> Now the question is how to make it boot with a mageia installation.
 
Yes. I believe what we are choosing here is when/what make your computer boot on the SD card or not.

It do sound like issues with computer BIOS or SD interface, but anyway interesting to see...

Both Microsoft and Mageia installers fail, so...  Have you checked with computer and SD interface manufacturers?  I think they should have the ball now...
Comment 6 Ezequiel Partida 2020-10-14 22:15:24 CEST
(In reply to Morgan Leijström from comment #5)
> You mean (In reply to Ezequiel Partida from comment #4)
> > I was able to boot from the microSD card..
> 
> What system did boot from SD?

I just formated the MicroSD in fat32 and copied the whole content of a my windows 10 (Correction) bootable USB with file manager. The directories are:

boot
efi
sources
support
upgrade


And it boots great but it runs the windows installer.

> 
>  
> > I could not install windows 7 either. I just get an error while trying to
> > format.
> 
> Was the error thrown by Windows 7 installer?
> What did it say was the problem?

It said that no partition could be created on the HD.. I had to clean the microSD using DiskPart to be able to start windows 7 installation again but I stop windows 7 installation at 52%

>  
> 
> > The only way to make it boot is by doing the next steps.
> > 
> > On Windows I used diskpart.
> > 
> > diskpart
> > list disk
> > select disk 3
> > clean
> > create partition primary
> > active
> > format fs=fat32
> > assign letter=y
> > exit
> > 
> > Once the SD was formated.. I copied a bootable USB key (Windows 7).
> >
> > Once the data was copied I rebooted and it works.
> 
> 
> So you had a bootable working Windows 7 USB stick, and copied it to the SD 
> card.  How did you copy ? - Using what operating system, program / command?

I just drag and drop the content of the bootable USB stick to the fat32 MicroSD. 

> The Mageia way of copying the Installer or Live isos will overwrite
> partition table thus it does not matter how you format it before. 
> Apparently Windows7 copy procedure is different?
> 
> 
>  
> > I think this would be possible with a Mageia Installer USB Key.

> If i get it right, your computer can boot the Mageia installer from a USB.
> 
> It could be interesting to know if your system can boot Mageia Installer or
> Live when you have put it on the SD card.
> 
I created a bootable USB Disk using Win32DiskImager in windows.. The USB boots fine but it only has a folder called EFI. I copy it to the MicroSD and it didn't boot, I later copied the whole content of a MGA8 DVD and it didn't work.

 
> > Now the question is how to make it boot with a mageia installation.
>  
> Yes. I believe what we are choosing here is when/what make your computer
> boot on the SD card or not.
> 
> It do sound like issues with computer BIOS or SD interface, but anyway
> interesting to see...
> 
> Both Microsoft and Mageia installers fail, so...  Have you checked with
> computer and SD interface manufacturers?  I think they should have the ball
> now...
Comment 7 Morgan Leijström 2020-10-14 22:50:19 CEST
> I created a bootable USB Disk

From a Mageia live iso?

> using Win32DiskImager in windows...

Yes that tool is listed at our wiki
https://wiki.mageia.org/en/Dump_Mageia_ISO_on_a_USB_flash_drive_-_Alternative_tools

> The USB boots fine 

Only to boot menu, or further and it seem to work as intended?

> but it only has a folder called EFI.

I presume you mean partition, no?
What partitions are there?
What operating system and tool do you use to see that?

A common limitation of a bunch of tools including gparted and diskdrake in Mageia 7, is that they do not see hybrid isos - like the Mgeia isos are - correctly.

The only GUI tool i know to work is diskdrake in Mageia 8 / Cauldron.

A bootable media made from a Mageia contain a partition for the system (type iso9660 if i remember correctly), and an EFI partition.  If it is a Live iso and you have selected to make it persistent, it additionally have an ext4 partition on the rest of the available space.

> I copy it to the MicroSD and it didn't boot, 

How, using what tool?

> I later copied the whole content of a MGA8 DVD and it didn't work.

How, using what tool?


Sorry to repeat myself, tool choice is important here.

You can not copy it using a file tool, because the Mageia iso should be copied to the bare bones *device* (not into a partition nor into a filesystem).

The very simple linux dd command should work perfectly to dump a Mageia iso to any kind of media a PC can access at boot.  For a GUI tool use Mageia IsoDumper.

(That said i have personally never even tried any other tool, never from MSWindows)
https://wiki.mageia.org/en/Installation_Media#Dump_Mageia_ISO_on_a_USB_flash_drive
Comment 8 Ezequiel Partida 2020-10-15 03:33:39 CEST
It works now.

This is what I did..

Using Rufus from https://rufus.ie/ I made the microSD bootable by installing freeDOS. This will format the microSD as FAT32 and install freedos.

Once I made sure it booted even after turning off the PC I shink the FAT32 partition to 300mb using gparted...(I read that the smallest is 260mb).

I tested that it booted after the shink and later installed MGA8 using legacy installation and using auto allocate option and it assigned 24gb / and 3.9gb SWap.

Everything installed correctly and it boots great.

I just disable probe Foreign OS on Setup Boot System in Mageia Control Center.

Now I can reboot or turn off the PC.

On the other hand. it did reboot great with normal MGA8 Installation but once turned off it didn't boot..

One weird problem is that MGA8 Installer on one of the MicroSD it left an empty BIOS partition but on the other one it didn't.. they are both the same brand, size and model.

Will Continue test.

Regards
Comment 9 Morgan Leijström 2020-10-15 09:38:34 CEST
OK good.

It would be interesting to know if our preferred tool isodumper works for the task.  Or dd.

Did you try?
Comment 10 Morgan Leijström 2020-11-12 23:35:39 CET
Regarding another bug, this is interesting, if you remember: 

(In reply to Ezequiel Partida from comment #3)
> I reinstalled Mageia 8 Beta 1 with all latest updates using LXDE and
> rebooting works great

And you had no problem logging in to LXDE desktop?
We have currently: Bug 27585 - LXDE first login fail - lxsession segfault
Comment 11 Ezequiel Partida 2020-11-17 03:29:48 CET
(In reply to Morgan Leijström from comment #9)
> OK good.
> 
> It would be interesting to know if our preferred tool isodumper works for
> the task.  Or dd.
> 
> Did you try?

Yes I did but it did not work. It seems this devices only boot from DOS partitios MBR or by formating in fat32 and dragging a dvd content to them.
Comment 12 Ezequiel Partida 2020-11-17 03:33:55 CET
(In reply to Morgan Leijström from comment #10)
> Regarding another bug, this is interesting, if you remember: 
> 
> (In reply to Ezequiel Partida from comment #3)
> > I reinstalled Mageia 8 Beta 1 with all latest updates using LXDE and
> > rebooting works great
> 
> And you had no problem logging in to LXDE desktop?
> We have currently: Bug 27585 - LXDE first login fail - lxsession segfault

Yes I did had the first logon problem. It seems that leaving it as Default does not work so I changed it to LXDE and chose the languate... it worked on the second attempt.

This happend to me on 3 different installations.

Regards
Ezequiel Partida