r/AlpineLinux • • 2d 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

9 comments sorted by

2

u/macmpi 22h ago edited 22h 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 22h ago edited 21h ago

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

1

u/Csipotle 21h ago edited 21h 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/macmpi 1h ago

a (tested) fix is under review: if you are familiar with vi editor, you may do the small change yourself before running setup-alpine: vi /usr/sbin/copy-modloop and modify line 44 as mentioned.
Please report there if it works for you.

1

u/Csipotle 21h ago edited 10h 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|rw,relatime|rw,noatime,commit=60|' /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

Edit:

This workaround guide is worked for me, except I closed out myself from the installed system as I didn't create regular user with setup-alpine, as chose [prohibit-password] on question: "Allow root ssh login?" And didn't gave an ssh key either. So I had revert cmdline.txt, re-rename apkovl file, and rerun setup-alpine, create regular user, and copy the passwd, shadow, group files from "/etc" to the system partition and redo cmdline, apkovl file rename steps.

1

u/sky-shredder 1d ago

you're booting from the sd card. Do you want to erase that sd card and install alpine one it? or do you want to use a diskless installation with lbu?

1

u/Csipotle 21h ago

Right. My plan was to follow setup script and as in the wiki, choose to install in system disk mode (as this device has only 512MB RAM), so it should create a secondary system partition and install system onto it.

2

u/sky-shredder 19h ago

I don't know what wiki you are referring to, but you can install sys by flashing your sd card with 32-bit Alpine, boot your pi and run setup-alpine. ctrl-c after you configure networking at timezone setup. then run

setup-ntp busybox
rm /etc/apk/repositories
setup-apkrepos -1
umount -fl /dev/mmcblk0p1
umount -fl /dev/loop0
setup-disk -m sys /dev/mmcblk0
reboot

2

u/macmpi 20h ago

as a workaround for now, you may install 3.24, reboot and then do a full upgrade to 3.25...