Template:Copying Alpine to Flash: Difference between revisions
(Changed order of manual commands) |
|||
Line 33: | Line 33: | ||
#'''w''' Write your changes to the device | #'''w''' Write your changes to the device | ||
=== | === Creating bootable USB/Flash from CDROM === | ||
To boot from USB or CF we need copy the contents of the CDROM to the USB/CF and make it bootable. Those two operations can be done automated with the ''setup-bootable'' tool or it can be done manually. | |||
==== Automated ==== | ==== Automated ==== | ||
{{Tip|If using Alpine Linux 1.10.4 or newer, you can use this section to complete the install. Otherwise, follow the Manual steps below.}} | {{Tip|If using Alpine Linux 1.10.4 or newer, you can use this section to complete the install. Otherwise, follow the Manual steps below.}} | ||
# Run the setup-bootable script to | # Run the setup-bootable script to make a bootable Alpine Linux from ISO image (replacing sda with your {{{1|flash medium}}} name): | ||
#* {{Cmd|setup-bootable /media/cdrom /dev/sda1}} | #* {{Cmd|setup-bootable /media/cdrom /dev/sda1}} | ||
{{Warning|If you are installing to a USB Stick, the setup-bootable script will not use 'usbdisk' in the syslinux.cfg file. You should modify it to say 'usbdisk' as described in ''Wrong Device Name'' below, or you will face possible problems booting and definite problems with the package cache.}} | {{Warning|If you are installing to a USB Stick, the setup-bootable script will not use 'usbdisk' in the syslinux.cfg file. You should modify it to say 'usbdisk' as described in ''Wrong Device Name'' below, or you will face possible problems booting and definite problems with the package cache.}} | ||
Line 48: | Line 49: | ||
#* {{Cmd|{{{|apk add syslinux<BR>dd if=/usr/share/syslinux/mbr.bin of=/dev/sda}}}<BR>syslinux /dev/sda1}} | #* {{Cmd|{{{|apk add syslinux<BR>dd if=/usr/share/syslinux/mbr.bin of=/dev/sda}}}<BR>syslinux /dev/sda1}} | ||
#Copy the files to the {{{1|flash medium}}} (replacing sda with your {{{1|flash medium}}} name): | #Copy the files to the {{{1|flash medium}}} (replacing sda with your {{{1|flash medium}}} name): | ||
#* {{Cmd|mkdir -p /media/sda1 | #* {{Cmd|<nowiki>mkdir -p /media/sda1 | ||
mount -t vfat /dev/sda1 /media/sda1 | |||
cd /media/cdrom | |||
cp -a .alpine-release * /media/sda1/ | |||
umount /media/sda1</nowiki>}} | |||
== Troubleshooting == | == Troubleshooting == |
Revision as of 16:24, 22 December 2011
Boot Alpine Linux CD-ROM
- Insert the Alpine Linux CD-ROM into a computer.
- Boot the computer from the Alpine Linux CD-ROM.
- This step may require changes to the BIOS settings to select booting from CD.
- Login with the username root. No password is needed.
Determine the Device Name of the Flash Medium
Determine the name your computer uses for your flash medium. The following step is one way to do this.
- After inserting the flash medium, run the command:
dmesg
- At the end of this command you should see the name of your flash medium, likely starting with "sd". (For example: "sda").
- The remainder of this document will assume that your flash medium is called /dev/sda
Format Flash Medium
Run fdisk (replacing sda with your flash media name):
fdisk /dev/sda
- (Optional) - Create new partition table with one FAT32 partition
- d Delete all partitions (this may take a few steps)
- n Create a new partition
- p A primary partition
- 1 Partition number 1
- Use defaults for first and last cylinder (just press [Enter] twice).
- t Change partition type
- c Type: Win95 FAT32 (LBA)
- Verify that the primary partition is bootable
- p Print list of partitions
- If there is no '*' next to the first partition, follow the next steps:
- a Make the partition bootable (set boot flag)
- 1 Partition number 1
- w Write your changes to the device
Creating bootable USB/Flash from CDROM
To boot from USB or CF we need copy the contents of the CDROM to the USB/CF and make it bootable. Those two operations can be done automated with the setup-bootable tool or it can be done manually.
Automated
- Run the setup-bootable script to make a bootable Alpine Linux from ISO image (replacing sda with your flash medium name):
setup-bootable /media/cdrom /dev/sda1
Manual
- (Optional) - If you created a new partition above, format the flash medium with a FAT32 filesystem (replacing sda with your flash medium name):
apk add dosfstools
mkdosfs -F32 /dev/sda1
- Install syslinux and MBR (replacing sda with your flash medium name):
apk add syslinux
dd if=/usr/share/syslinux/mbr.bin of=/dev/sda
syslinux /dev/sda1
- Copy the files to the flash medium (replacing sda with your flash medium name):
mkdir -p /media/sda1 mount -t vfat /dev/sda1 /media/sda1 cd /media/cdrom cp -a .alpine-release * /media/sda1/ umount /media/sda1
Troubleshooting
Wrong Device Name
If you cannot boot from the flash medium and you see something like:
Mounting boot media failed. initramfs emergency recovery shell launched. Type 'exit' to continue boot
then it is likely that the device name in syslinux.cfg is wrong. You should replace the device name in the syslinux.cfg line:
append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet
with the proper device name.
- For boot from USB, the device name should be 'usbdisk' (as shown above)
- For other options, you can run cat /proc/partitions to see the available disks (i.e. 'sda' or 'sdb')
Non-FAT32 Filesystems
When your flash medium is formatted with a filesystem other than FAT32, you might have to specify the necessary filesystem modules in the boot parameters.
To do so, mount the flash medium and change the syslinux.cfg file line from
append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet
to
append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage,ext3 quiet
in the case of an ext3 formatted partition. A similar procedure might apply to other filesystems (if they are supported by syslinux and the Alpine Linux kernel).