Unattended Boot and Install: Difference between revisions

From Alpine Linux
Line 32: Line 32:


= Wifi Support =
= Wifi Support =
Create a text file named '''wifi.txt''' with the SSID and PSK on the first line of the file:
Create a text file named '''wifi.txt''' with the SSID and PSK on the first line of the file:
 
<code>SSID Password</code>
<code>SSID Password</code>



Revision as of 00:23, 30 April 2022

This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Sodface on 30 Apr 2022.)

Introduction

This wiki describes a modified version of the original method I posted for Headless installation on a Raspberry Pi. While the original version worked for other architectures, like x86_64, it was targeted at and posted in the Raspberry Pi section since that was my primary focus at the time. Revisions to that page by other authors removed the mention of x86_64 altogether so this version will be more generally written in the hopes that it will be easier to find and that it's applicability will be clearer.

Additionally, this version improves upon the original (in my opinion) by automatically logging in the root user and optionally running a shell script. This provides a means to perform unattended installations or other scripted tasks and does not require modification of the stock Alpine installation media / files.

The following functionality is provided:

  • Automatic DHCP configuration of a network interface, either wired or wireless
  • Automatic configuration of sshd with password-less root login enabled
  • Automatic login of the root user on tty7
  • Automatic script execution (optional)

This is accomplished by using an overlay file that Alpine extracts at boot. Download a pre-built overlay file here.

Basic Use

For Alpine supported Raspberry Pi models:

  1. Download the applicable Alpine installation tarball and extract it to an SD card formatted with a single FAT partition.
  2. Copy the headless.apkovl.tar.gz file to the root of the SD card.
  3. Optionally, create a file named wifi.txt in the root of the SD card. See below for file format.
  4. Optionally, create a file named unattended.sh in the root of the SD card. See below for an example.
  5. Boot the Pi with the SD card.

For other architectures (tested on various x86_64 hardware and a Qemu VM)

  1. Download the applicable Alpine installation file and write it to usb stick or other media as needed.
  2. Copy the headless.apkovl.tar.gz file to a second usb stick or other media separate from the installation media.
  3. Optionally, create a file named wifi.txt in the root of second media. See below for file format.
  4. Optionally, create a file named unattended.sh in the root of the second media. See below for an example.
  5. Boot the device with both the installation and the secondary media connected.

For basic interactive ssh access, only the headless.apkovl.tar.gz file is required. The wifi.txt file can be omitted if wired ethernet is used. The unattended.sh file can be omitted.

Wifi Support

Create a text file named wifi.txt with the SSID and PSK on the first line of the file:

SSID Password

Contents of /etc/network/interfaces

auto lo iface lo inet loopback auto wlan0 iface wlan0 inet dhcp hostname wyse3030-3 auto eth0 iface eth0 inet manual pre-up ifconfig $IFACE up pre-down ifconfig $IFACE down

Notice that the wireless interface (wlan0) uses dhcp from the home network as usual and that an IP address is not used at all on the wired interface (eth0).

Enable and create a local start-up script to add route entries at boot:

# rc-update add local default # touch /etc/local.d/RouteAdd.start # chmod +x /etc/local.d/RouteAdd.start