~alpine/users

2 2

Help installing in data mode

Details
Message ID
<28a77818-9007-469a-94d6-c421e0591b0e@net-c.cat>
DKIM signature
missing
Download raw message
Hi all,

I've been trying to install Alpine in data mode for the past couple of 
days without success. I was using the wiki[0,1] and the handbook[2] as 
references; today I realized that the handbook is largely untouched for 
about a year[3]. Wonder if the content is still up-to-date.

Some details on what I need/want, and what I tried so far.

I want to install Alpine in data mode on an Intel x86_64 SBC with 16GB 
of internal memory. The board only supports UEFI (I think[4]). The disk 
should have at least two partitions: a data partition (e.g. 1GB); and 
the root filesystem partition filling the rest of the disk (minus 
whatever is necessary for boot &c).

In case it does make a difference, I'm currently trying Alpine out with 
QEMU, because it's a little easier than having the board powered on next 
to me. One small (maybe big) problem is I couldn't figure out how to run 
QEMU in UEFI mode, so this makes the install process slightly different 
from what I'll need on the real board, but I figured the difference 
should be easy to overcome once the rest of process is nailed down.

These are the commands I use to create a disk and to start the VM, as 
per [5,6]:

qemu-img create -f qcow2 disk.qcow2 16G
qemu-system-x86_64 -m 2G -nic user -boot d -cdrom 
alpine-standard-3.18.2-x86_64.iso -hda disk.qcow2 -display gtk

After booting and logging in, I run setup-alpine and follow along. When 
it asks which disk to use, and where to store configs, I reply "none" to 
both (I understood from the wiki that setup-alpine can't automatically 
install Alpine the way I want it, and so have to do some steps manually 
later).

I partition the disk according to the plan, adapting the instructions 
from the handbook[7]:

alias p="parted -sa optimal /dev/sda"
p mklabel gpt
p mkpart p 1MiB 2MiB  # none
p mkpart p 2MiB 1G    # boot
p mkpart p 1G 2G      # data
p mkpart p 2G 100%    # rootfs
p set 1 bios_grub
p set 2 boot
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
mkfs.ext4 /dev/sda4

And now comes what confuses me most: setup-disk and setup-bootable. Do I 
need to run both? Only one of them? Which one? setup-bootable is used to 
make a whole disk the bootable system? What does setup-disk do?

If I now run the following, it complains /dev/sda3 is not a block device 
suitable for partitioning:

setup-disk -m data -s 0 /dev/sda3

But if I mount /dev/sda3 at e.g. /mnt/data/, and run again I get this:

# setup-disk -m data -s 0 /mnt/data/
extlinux: Not a directory: /mnt/data/boot
# ( a progress bar )
=> initramfs: creating /boot/initramfs-lts
/boot is device /dev/sda3
extlinux: no previous syslinux boot sector found
You might need fix the MBR to be able to boot

So it apparently made the data partition the boot partition? In any 
case, after poweroff the VM doesn't boot from the disk...

With setup-bootable I get the following:

# setup-bootable /media/cdrom/ /dev/sda4
installing /dev/sda4 to alpine-standard-3.18.2 230508
Making /dev/sda4 bootable...
syslinux: invalid media signature (not an FAT/NTFS volume?)


I'm very confused by this all, as you can probably tell (having read 
through many wiki pages other than those already referenced). I would 
really appreciate it if anyone could help me understand what I'm doing 
wrong, and what I should be doing instead.


[0]: https://wiki.alpinelinux.org/wiki/Installation
[1]: https://wiki.alpinelinux.org/wiki/Create_a_Bootable_Device
[2]: https://docs.alpinelinux.org/user-handbook/0.1a/Installing/manual.html
[3]: 
https://gitlab.alpinelinux.org/alpine/docs/user-handbook/-/commits/master
[4]: at least other distros are installed in UEFI, so I'd go for that 
with Alpine too because I don't really need to worry about this otherwise
[5]: https://wiki.alpinelinux.org/wiki/Install_Alpine_in_QEMU
[6]: https://wiki.alpinelinux.org/wiki/QEMU
[7]: 
https://docs.alpinelinux.org/user-handbook/0.1a/Installing/manual.html#_bios_gpt


Thanks,
siiky
Steffen Nurpmeso <steffen@sdaoden.eu>
Details
Message ID
<20230808211438.UPazY%steffen@sdaoden.eu>
In-Reply-To
<28a77818-9007-469a-94d6-c421e0591b0e@net-c.cat> (view parent)
DKIM signature
missing
Download raw message
i have no idea about the rest, but

siiky wrote in
 <28a77818-9007-469a-94d6-c421e0591b0e@net-c.cat>:
 ...
 |of internal memory. The board only supports UEFI (I think[4]). The disk 
 |should have at least two partitions: a data partition (e.g. 1GB); and 
 |the root filesystem partition filling the rest of the disk (minus 
 |whatever is necessary for boot &c).

no need for a boot loader since EFI_STUB is available in the
kernel -- if you place the kernel on the DOS EFI partition.

  ...
 |In case it does make a difference, I'm currently trying Alpine out with 
 |QEMU, because it's a little easier than having the board powered on next 
 |to me. One small (maybe big) problem is I couldn't figure out how to run 
 |QEMU in UEFI mode, so this makes the install process slightly different 
 ...

This is very easy with QEMU since v8.* as it now ships with EDK2
included.  Here (different Linux) for example

  $ l /usr/share/qemu/edk2-*
  /usr/share/qemu/edk2-licenses.txt
  /usr/share/qemu/edk2-i386-secure-code.fd
  /usr/share/qemu/edk2-arm-code.fd
  /usr/share/qemu/edk2-x86_64-code.fd
  /usr/share/qemu/edk2-i386-code.fd
  /usr/share/qemu/edk2-aarch64-code.fd
  /usr/share/qemu/edk2-i386-vars.fd
  /usr/share/qemu/edk2-arm-vars.fd
  /usr/share/qemu/edk2-x86_64-secure-code.fd

so my "QEMU driver script" does

  QEMU_EFI=/usr/share/qemu
  ...
  : ${vmefi:=}
  ...
  if [ -n "$vmefi" ]; then
          case "$vmsys" in
          x86_64|i386|aarch64|arm)
                  vmefi="${QEMU_EFI}"/edk2-$vmsys-code.fd
                  #vmefi="${QEMU_EFI}"/$vmsys.fd
                  ;;
          *)
                  echo >&2 '$vmefi: unsupported $vmsys='$vmsys
                  syno
                  ;;
          esac

          if [ ! -f "$vmefi" ]; then
                  echo >&2 '$vmefi: no such edk2-ovmf firmware: '$vmefi
                  syno
          fi
          vmefi='-bios '$vmefi
  fi
  ..
  eval $xexec /bin/ip netns exec vm /usr/bin/qemu-system-$vmsys $vmefi \
    ...

  ...
 |p mkpart p 1MiB 2MiB  # none

hm, seems to me you want an EFI partition like

  /dev/nvme0n1p1      2048     534527    532480   260M EFI System

no?  And then an efibootmgr entry like

  Boot0001* kent HD(1,GPT,5d6d756b-5de2-4e5d-b043-8d4ae1bb6eb0,0x800,0x82000)/File(\ideapad-stage1.efi)root=/dev/nvme0n1p1 rootfstype=vfat init=/kent.sh

Hmm, i do have only one AlpineLinux VM with EFI at the moment,

  /x/vm/img/alp-2022-3#vmsys=aarch64#vmcpu=cortex-a57#vmmachine=virt#vmefi.qcow2

let's see.

  #?0(0.40 1/69)|alp-2022-aarch64:steffen$ fdisk -l
  Disk /dev/vda: 8192 MB, 8589934592 bytes, 16777216 sectors
  16644 cylinders, 16 heads, 63 sectors/track
  Units: sectors of 1 * 512 = 512 bytes

  Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
  /dev/vda1    2,0,33      262,1,33          2048     264191     262144  128M ef EFI (FAT-12/16/32)
  /dev/vda2    262,1,34    489,10,26       264192   14944255   14680064 7168M 83 Linux
  /dev/vda3    489,10,27   260,1,1       14944256   16777215    1832960  895M 82 Linux swap

  $ mount|grep vda1
  /dev/vda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro)

So i simply use EFI as /boot.

  $ apk info|grep efi
  efivar-libs
  efibootmgr

No boot manager.

  $ efibootmgr  -u
  BootCurrent: 0001
  Timeout: 5 seconds
  BootOrder: 0000,0001,0002,0003,0004,0005,0006
  Boot0000* UiApp FvVol(64074afe-340a-4be6-94ba-91b5b4d0f71e)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
  Boot0001* UEFI Misc Device      PciRoot(0x0)/Pci(0x3,0x0)걎脈鼑䵙ⱒ뉙
  Boot0002* UEFI PXEv4 (MAC:54720101001B) PciRoot(0x0)/Pci(0x1,0x0)/MAC(54720101001b,1)/IPv4(0.0.0.00.0.0.0,0,0)걎脈鼑䵙ⱒ뉙
  Boot0003* UEFI PXEv6 (MAC:54720101001B) PciRoot(0x0)/Pci(0x1,0x0)/MAC(54720101001b,1)/IPv6([::]:<->[::]:,0,0)걎脈鼑䵙ⱒ뉙
  Boot0004* UEFI HTTPv4 (MAC:54720101001B)        PciRoot(0x0)/Pci(0x1,0x0)/MAC(54720101001b,1)/IPv4(0.0.0.00.0.0.0,0,0)/Uri()걎脈鼑䵙ⱒ뉙
  Boot0005* UEFI HTTPv6 (MAC:54720101001B)        PciRoot(0x0)/Pci(0x1,0x0)/MAC(54720101001b,1)/IPv6([::]:<->[::]:,0,0)/Uri()걎脈鼑䵙ⱒ뉙
  Boot0006* EFI Internal Shell    FvVol(64074afe-340a-4be6-94ba-91b5b4d0f71e)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)

Seems to me i did not even have created something here.  It is
just a test VM that does not real work.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
Details
Message ID
<5d8ced1d-4155-454a-bfc5-93960be04f1b@net-c.cat>
In-Reply-To
<20230808211438.UPazY%steffen@sdaoden.eu> (view parent)
DKIM signature
missing
Download raw message
Thanks for the reply!

> hm, seems to me you want an EFI partition like
> 
>    /dev/nvme0n1p1      2048     534527    532480   260M EFI System
> 
> no?  And then an efibootmgr entry like
> 
>    Boot0001* kent HD(1,GPT,5d6d756b-5de2-4e5d-b043-8d4ae1bb6eb0,0x800,0x82000)/File(\ideapad-stage1.efi)root=/dev/nvme0n1p1 rootfstype=vfat init=/kent.sh

I'll make a UEFI install on the board itself, but since I was having 
problems running QEMU with UEFI I settled for a BIOS install on the VM. 
In the meantime I may have found how to run QEMU with UEFI on Debian.

> Hmm, i do have only one AlpineLinux VM with EFI at the moment,
> 
>    /x/vm/img/alp-2022-3#vmsys=aarch64#vmcpu=cortex-a57#vmmachine=virt#vmefi.qcow2
> 
> let's see.
> 
>    #?0(0.40 1/69)|alp-2022-aarch64:steffen$ fdisk -l
>    Disk /dev/vda: 8192 MB, 8589934592 bytes, 16777216 sectors
>    16644 cylinders, 16 heads, 63 sectors/track
>    Units: sectors of 1 * 512 = 512 bytes
> 
>    Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
>    /dev/vda1    2,0,33      262,1,33          2048     264191     262144  128M ef EFI (FAT-12/16/32)
>    /dev/vda2    262,1,34    489,10,26       264192   14944255   14680064 7168M 83 Linux
>    /dev/vda3    489,10,27   260,1,1       14944256   16777215    1832960  895M 82 Linux swap
> 
>    $ mount|grep vda1
>    /dev/vda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro)
> 

Is this a data install or a sys install? Do you happen to remember (or 
have documented somewhere) how you got it running?

I guess that, other than which setup-* commands can be used to achieve 
what I need, more importantly, I'm failing to understand how the pieces 
fit together. (TBH I have never had to learn about BIOS/EFI, 
bootloaders, etc, so I'm a noob in this area)

I don't yet understand much of the details you've shared, but I suspect 
(and hope) they will make more sense to me and prove to be useful 
eventually! :)

siiky
Reply to thread Export thread (mbox)