0

I executed the following script to create a bootable SD card, but the raspberry pi doesn't boot. The sd cards are fine, they arrived today in the mail and badblocks found none. What am I missing?

#!/usr/bin/env sh
sudo parted --script /dev/sdb \
    mklabel msdos \
    mkpart primary fat32 1MiB 256MiB \
    mkpart primary ext4 256MiB 100% \
    set 1 boot on \
    set 1 lba on
sudo mkfs.vfat /dev/sdb1
sudo mkfs.ext4 /dev/sdb2

Edit: I checked the output of parted print and fdisk -l here are the results, they look fine to me.

The result if I execute fdisk -l is

Disk /dev/sdb: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Disk model: SD/MMC/MS PRO   
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x93bfb447

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdb1  *      2048   524287   522240  255M  c W95 FAT32 (LBA)
/dev/sdb2       524288 62521343 61997056 29.6G 83 Linux

The output of parted is

Model: Generic- SD/MMC/MS PRO (scsi)
Disk /dev/sdb: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  268MB   267MB   primary               boot, lba
 2      268MB   32.0GB  31.7GB  primary  ext4

Edit: I follow this guide on the Alpine Wiki: https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi#Preparation

Edit: I made some progress on trying. If I run the following script and copy the files it will boot.

sudo mkfs.fat /dev/sdb -I
  • Are you following some instructions to make the bootable SD card? You've formatted the SD card but not yet installed the bootloader or OS, it seems. – Kevin Kruse Feb 19 at 20:19
  • I do follow the instructions of the alpine wiki. I updated my question. – Knerd Feb 19 at 20:31
0

I found the issue. The script was completely fine. My sd card reader was a bit jacked after using a card with a ton of bad blocks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.