possible data loss with dual-boot configurations
From #adelie-support
on 2023-11-15:
14:41 < creatxr> lose a partition after installation
14:43 < creatxr> i use vm. in the vm i've a alpine linux installed at /dev/sda3. i manual selected /dev/sda2 to install adelie linux.
14:46 < creatxr> i use a live cd to start. with gparted, i found that /dev/sda3 lost its partition type (btrfs) after installation adelie linux.
14:47 < creatxr> adelie-live-xfce-x86_64-1.0-beta5-20231027.iso
15:11 < creatxr> or maybe, it writed grub2 core.img to the /dev/sda3 cause i set /dev/sda3 with flag grub_bios to boot alpine linux before. it means that the data is losed.
15:15 < creatxr> after reboot, adelie linux stopped at "starting local" for a long time and cannot boot until login window. ( my install only selected xfce package while installation. )
15:19 < creatxr> if i boot alpine live, it could list all the partition with "fdisk -l", but it losed /dev/sda3 with "blkid".
15:19 <&zv> I am sorry to hear this, thank you for reporting it
15:19 < creatxr> that's the detail.
...
15:29 <&zv> creatxr: how did you install alpine? default `sys` installation to disk?
15:30 <&zv> was /dev/sda2 swap?
15:32 < creatxr> setup-disk -m sys /mnt (that's /dev/sda3)
15:33 < creatxr> swap is a /dev/sda4
15:35 <&zv> and /dev/sda2 was free space?
15:35 < creatxr> the /dev/sda2 is prepare for try other os , is free space
15:36 < creatxr> the /dev/sda1 is efi, it's unuseful in vm
15:37 <&zv> ok. was this what you did? https://git.adelielinux.org/adelie/horizon/uploads/0e405720bfa8c1b2f545e7a179dd8682/Screenshot_2023-11-15_at_9.34.02_AM.png
15:37 < creatxr> sda1: efi, sda2: free space, sda3: alpine linux, sda4: swap
15:37 <&zv> or did the installer find the free space?
15:38 < creatxr> yes
15:38 <&zv> yes it found the free space, or yes you did what's in the screenshot?
15:39 < creatxr> only selected the sda2 without format
15:40 < creatxr> this issue maybe come with the step installing grub
15:41 <&zv> I quickly tried the following: fresh alpine installation, vda1=efi, vda2=swap, vda3=alpine. then I tried to install adelie into the swap, but it failed to install. I am trying again with an
actual free space partition
15:42 <&zv> did you installation succeed?
15:42 < creatxr> the issue that cannot boot maybe has relation with selecting package to install
15:42 < creatxr> yes, i can boot
15:43 < creatxr> i success boot alpine first (grub-install)
15:43 <&zv> and you selected the box 'install bootloader' ?
15:43 < creatxr> then install adelie
15:43 < creatxr> i think yes
15:44 < creatxr> after success boot alpine, then install adelie
15:45 < creatxr> to boot alpine, it needs set the partition with flag bios_grub with like gparted.
15:45 <&zv> are you following https://wiki.alpinelinux.org/wiki/Dualbooting ?
15:47 < creatxr> yes, almost. just to boot, the wiki is not completely. i means that it must have flag bios_grub.
15:47 < creatxr> if not, grub-install will get error
15:48 < creatxr> after set flag bios_grub for /dev/sda3 (alpine), the mount it to /mnt,
15:48 < creatxr> then grub-install --boot-directory=/mnt/boot /dev/sda
15:51 < creatxr> apk add grub grub-bios
...
16:14 <&zv> do you have more information you want to add to this?
16:18 < creatxr> the step select partition, is to select a existed used /dev/sda2 which has formated with btrfs. all the partitions is made by gparted before.
I tried (but failed) to reproduce a successful Adélie installation in two cases.
Attempt 1: default Alpine installation to disk, type sys
, then Adélie on top of the swap partition (quick test).
Results in a failure to install Adelie because of failing to mount something?
Attempt 2: recreate partitions 1=efi 2=(free) 3=alpine 4=swap, which was done by dd
zero into /dev/vda2
, then deleting the partition, and is correctly detected as free space.
Results in a failure to install Adelie:
Unfortunately I can't seem to "Save Script/Log" because of #362 (closed).
Now we have this recipe to try:
16:31 < creatxr> the stepss are:
16:31 < creatxr> use a linux live cd to boot
16:31 < creatxr> make partitions with gparted (gpt)
16:31 < creatxr> /dev/sda1 efi
16:31 < creatxr> /dev/sda2 btrfs
16:31 < creatxr> /dev/sda3 btrfs
16:31 < creatxr> /dev/sda4 swap
16:31 < creatxr> and set /dev/sda3 with flag bios_grub with gparted
16:31 < creatxr> boot alpine linux cd
16:31 < creatxr> setup-alpine
16:31 < creatxr> apk add btrfs-progs grub grub-bios
16:31 < creatxr> modprobe btrfs
16:31 < creatxr> mount -t btrfs /dev/sda3 /mnt
16:31 < creatxr> setup-disk -m sys /mnt
16:31 < creatxr> grub-install --boot-directory=/mnt/boot /dev/sda
16:31 < creatxr> now reboot to check that it could boot alpine linux
16:31 < creatxr> boot adelie linux cd (xfce)
16:31 < creatxr> at the step of select partition to install, to select /dev/sda2
16:31 < creatxr> at the step of select packages, to select only xfce desktop
16:31 < creatxr> at the install bootloader select yes
16:31 < creatxr> issue 1: losed /dev/sda3 (alpine)
16:31 < creatxr> if boot alpine live, it could list all the partition with "fdisk -l", but it losed /dev/sda3 with "blkid".
16:31 < creatxr> with gparted, it shows "grub2 core.img" with the /dev/sda3
16:31 < creatxr> issue 2:
16:31 < creatxr> to boot installed adelie, it stops at "starting local ..." message
TODO:
- Reproduce this and understand what is exactly happening, and if there is a real bug here or if this is "user error".
- Document the correct way to set up a dual-boot configuration.