Include:Copying Alpine to Flash: Difference between revisions

From Alpine Linux
m (Propose for deletion. Completely unused and obsolete include.)
 
(21 intermediate revisions by 10 users not shown)
Line 1: Line 1:
=== Boot Alpine Linux CD-ROM ===
{{Delete|This include has become obsolete. It is completely unused on the wiki}}
# 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.
 
{{Tip|If you're not able to boot from the CD, then another option is to boot from a regular Alpine installation, and [[Burning_ISOs|manually mount the ISO image to {{Path|/media/cdrom}}]].}}
 
=== Determine the Device Name of the {{{1|Flash Medium}}} ===
Determine the name your computer uses for your {{{1|flash medium}}}. The following step is one way to do this.
# After inserting the {{{1|flash medium}}}, run the command:
#* {{Cmd|dmesg}}
#* At the end of this command you should see the name of your {{{1|flash medium}}}, likely starting with "sd". (For example: "sda").
#* The remainder of this document will assume that your {{{1|flash medium}}} is called /dev/sda
 
{{Warning|If you are not using a virtual machine, be very careful about this. You do not want to mistakenly wipe your hard drive if it's on /dev/sda}}
 
=== Format {{{1|Flash Medium}}} ===
Run fdisk (replacing sda with your {{{1|flash medium}}} name):
{{Cmd|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''' Partition 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''' <big>Make the partition bootable (set boot flag)</big>
#** '''1''' Partition number 1
#'''w''' Write your changes to the device
 
=== Add Alpine Linux to the {{{1|Flash Medium}}}  ===
To boot from your {{{1|flash medium}}} you need to copy the contents of the CDROM to the {{{1|flash medium}}} and make it bootable. Those two operations can be automated with the [[setup-bootable]] tool or can be done manually.
 
{{Note|If the following commands fail due to 'No such file or directory', you may have to remove and reinsert the {{{1|flash medium}}}, or even reboot, to get /dev/sda1 to appear}}
 
==== 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.}}
{{Note|The target partition has to be formatted. Use the <code>mkdosfs</code> command from the Manual steps below if needed.}}
# Run the [[setup-bootable]] script to add Alpine Linux to the {{{1|flash medium}}} and make it bootable (replacing sda with your {{{1|flash medium}}} name):
#: {{Cmd|setup-bootable /media/cdrom /dev/sda1}}
{{Note|If you get something like '<code>Failed to mount /dev/sda1 on /media/sda1</code>' when running the above [[setup-bootable]] command, you might want to try running:
{{Cmd|modprobe vfat}}
and then try re-run the [[setup-bootable]] command as described above.}}
{{Warning|If you are installing to a USB Stick, you may need to modify the {{Path|syslinux.cfg}} file to say <code>usbdisk</code> as [[#Wrong_Device_Name|described below]], or you will face possible problems booting and definite problems with the package cache. Recent versions of <code>setup-bootable</code> will specify the alpine_dev using a UUID instead, so it should work properly by default.}}
 
==== Manual ====
# (''Optional'') - If you created a new partition above, format the {{{1|flash medium}}} with a FAT32 filesystem (replacing sda with your {{{1|flash medium}}} name):
#: {{Cmd|apk add dosfstools<BR>mkdosfs -F32 /dev/sda1}}
# Install syslinux and MBR (replacing sda with your {{{1|flash medium}}} name):
#: {{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):
#: {{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>}}
# (''Optional'') Remove any apkovl files that were transfered as part of the copy process.  This should be done if you wish to have a fresh install.  Replace sda with your {{{1|flash medium}}} name)
#: {{Cmd|<nowiki>mount -t vfat /dev/sda1 /media/sda1
rm /media/sda1/*.apkovl.tar.gz
umount /media/sda1</nowiki>}}
 
== Troubleshooting ==
=== Wrong Device Name ===
If you cannot boot from the {{{1|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 {{Path|syslinux.cfg}} is wrong. You should replace the device name in this 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 <code>cat /proc/partitions</code> to see the available disks (i.e. 'sda' or 'sdb')
 
=== Non-FAT32 Filesystems ===
When your {{{1|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 {{{1|flash medium}}} and change the {{Path|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:'''ext3''' 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).

Latest revision as of 00:50, 15 December 2021

This material is proposed for deletion ...

This include has become obsolete. It is completely unused on the wiki (Discuss)
Make sure no other pages link here and check the page's history before deleting.