r/AlpineLinux • • 1d ago

Raspberry Zero 2W installation failed

Hi,

I flashed a 32bit Alpine image (ver. 3.25.0) with Raspberry imager to an sd card, but setup-alpine seems fails.

I prepared a headless installation method followed macmpi's guide: https://github.com/macmpi/alpine-linux-headless-bootstrap

I successfully booted it up with his headless.apkovl.tar.gz but it seems after that setup-alpine is failing at Disk,Install step and it doesn't recognize sd card as a disk, so it seems normal installation fails at this step and . I got this:

 Disk & Install
----------------
No disks available. Try boot media /media/mmcblk0p1? (y/n) [n] y
 * WARNING: you are stopping a sysinit service
 * Unmounting /.modloop ...                                                            [ ok ]
rm: can't remove '/lib/modules': No such file or directory
No disks available. Try boot media /media/mmcblk0p1? (y/n) [n]

I tried to create the dir with command "mkdir -p /lib/modules" but that didn't help.

Tried to remount "/' with littlebit bigger size, but didn't help either.

Tried to give answer with no disk, where I can choose cache etc after that, but that didn't help at all in the installation process.

I had to force exit setup-alpine or it just ended by own while I tried different answers.
So I ran out of ideas now.

The initial mounts:

alpine-headless:~# df -h
Filesystem                Size      Used Available Use% Mounted on
devtmpfs                 10.0M         0     10.0M   0% /dev
shm                     212.6M         0    212.6M   0% /dev/shm
/dev/mmcblk0p1          128.8M     75.2M     53.6M  58% /media/mmcblk0p1
tmpfs                   212.6M     11.4M    201.2M   5% /
tmpfs                    85.0M    152.0K     84.9M   0% /run
/dev/loop0               37.1M     37.1M         0 100% /.modloop
2 Upvotes

6 comments sorted by

View all comments

2

u/macmpi 2h ago edited 2h ago

PiZero2W is meant to be run with aarch64 as per wiki sorry thought you tried armhf, must be armv7 then.
Are you trying sysdisk install?
Can you try setup-alpine with no disk, and then:
ERASE_DISKS=/dev/mmcblk0 setup-disk -m sys /dev/mmcblk0

2

u/macmpi 1h ago edited 47m ago

hum...indeed seems sth broken on SD disk-install: did replicate the issue.
Will investigate further...

1

u/Csipotle 30m ago edited 26m ago

AI gave that explanation of the install script issue, without uploading those scripts for analyzing them tho:

This error occurs because setup-alpine tries to unmount the boot media (mmcblk0p1) to reformat the SD card, which stops the modloop service and deletes the /lib/modules symlink while the installer still needs kernel modules to detect storage disks.

On a Raspberry Pi, Alpine Linux boots from the SD card into RAM. Because the SD card is currently mounted as your live boot media, setup-alpine hides it from the available disks list (No disks available) and asks to unmount it (Try boot media /media/mmcblk0p1?). When you answer y, it unmounts /.modloop, breaking /lib/modules and preventing the script from partitioning or recognizing the card.

.

1

u/Csipotle 52m ago

device is fully backward compatible with armv7, armhf, I intentionally chose 32bit installation.

thanks for your suggestion. does erasing whole sd-card is really necessary in this case? my plan is to install Alpine in sys mode, as device has only 512MB RAM.

my original plan was after that to try the workaround guide that AI recommended me that doesn't wipe the original boot partition and preserving its contents.

AI has suggested to manually create secondary ext4 partition on sd card and after choosing no disk in setup-alpine and exiting script and to run setup-disk with these parameters:

Assuming you have already finished setup-alpine (answering n to boot media and none to disks/configs/cache): 

# 1. Install tools & create mmcblk0p2 in cfdisk
apk add cfdisk e2fsprogs
cfdisk /dev/mmcblk0

# 2. Format with SD-friendly flags & mount
mkfs.ext4 -m 1 -E lazy_itable_init=0,lazy_journal_init=0 /dev/mmcblk0p2
mount /dev/mmcblk0p2 /mnt

# 3. Install Alpine sys mode to mmcblk0p2
FORCE_BOOTFS=1 setup-disk -m sys /mnt

# 4. Optimize fstab & add /boot mount
sed -i 's|/dev/mmcblk0p2.*|/dev/mmcblk0p2 / ext4 noatime,commit=60 1 1|' /mnt/etc/fstab
echo "/dev/mmcblk0p1 /boot vfat defaults 0 0" >> /mnt/etc/fstab

# 5. Update bootloader cmdline.txt & disable headless overlay for next boot
mount -o remount,rw /media/mmcblk0p1
sed -i 's|$| root=/dev/mmcblk0p2|' /media/mmcblk0p1/cmdline.txt
mv /media/mmcblk0p1/headless.apkovl.tar.gz /media/mmcblk0p1/headless.apkovl.tar.gz.bak

# 6. Reboot into your persistent system
reboot

.