Initramfs init: Difference between revisions

From Alpine Linux
m (→‎Usage: cmd and path templates used.)
(Add a short intro)
Line 1: Line 1:
{{draft}}
{{draft}}
==Usage==
 
[https://gitlab.alpinelinux.org/alpine/mkinitfs '''mkinitfs'''] is a tool to create initramfs images. Initramfs images are small images which contain a small filesystem with everything required to boot Alpine. For example, when booting a setup with [[Setting up encrypted volumes with LUKS|full disk encryption]], the initramfs contains the binaries required to prompt for a password and mount the encrypted disk.
 
== Usage ==
Under a running alpine machine, the following command can be used if for some reason the initramfs has not been created properly for a new kernel.  
Under a running alpine machine, the following command can be used if for some reason the initramfs has not been created properly for a new kernel.  
  {{cmd|mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>}}
  {{cmd|mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>}}

Revision as of 00:32, 7 January 2023

This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by WhyNotHugo on 7 Jan 2023.)

mkinitfs is a tool to create initramfs images. Initramfs images are small images which contain a small filesystem with everything required to boot Alpine. For example, when booting a setup with full disk encryption, the initramfs contains the binaries required to prompt for a password and mount the encrypted disk.

Usage

Under a running alpine machine, the following command can be used if for some reason the initramfs has not been created properly for a new kernel.

mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>

The script is located in /sbin/ and is created with ash. It expects /lib/modules to be populated with the <kernelvers> listed. For variations on this command (e.g. for chroot) Search "mkinitfs".

initramfs init cmdline options (work in progress)

In addition to the kernel boot parameters are a number of parameters that the init script understands.

Although you may specify your own init script when building an initramfs, these parameters allow for extensive control over the initial startup of an Alpine Linux system.

quiet : less verbose init script execution

debug_init : sets '-x' in the init script and -d for mdev

chart : Enables bootchartd for measuring system startup speed.

ip=dhcp : use DHCP for network configuration.

ip=client-ip:server-ip:gw-ip:netmask:hostname:device:autoconf:dns1:dns2 : use static IP configuration, each field is separated by a colon :

  • client-ip ip address of the guest VM where we are going to run the installer
  • server-ip not used, leave blank or fill with none
  • gw-ip the gateway ip address
  • netmask the netmask
  • hostname not used, leave blank or fill with none
  • device the network interface of the guest VM, default is eth0 if left blank
  • autoconf not used, leave blank or fill with none or off
  • dns1 address of the DNS server
  • dns2 address of the 2nd DNS server

modloop=URL : the remote location of the image containing kernel's modules, required for LVM and raid setup.

The remote location of the modloop image is the same as the kernel and initramfs (see below).

blacklist=MODULE{,MODULE} : This comma-separated list names kernel modules that modprobe will reject to load.

alpine_repo=URL : the location of the Alpine repository from which packages are downloaded.

For stable release, use http://dl-cdn.alpinelinux.org/alpine/v3.9/main
For rolling release, use http://dl-cdn.alpinelinux.org/alpine/edge/main

ssh_key=URL : the remote location of your SSH public key. It will be added to root's authorized_keys. Also triggers OpenSSH-server to be installed and started.

apkovl=URL : Unpack the APK Overlay file from this URL. Happens immediately after network is up . This option will set the default for service install and setup to false. (see .default_boot_services).

(work in progress)

  • init=
  • init_args=
  • dasd=
  • s390x_net=
  • rootfstype=
  • modules=
  • crytptroot=
  • cryptdm=
  • cryptheader=
  • cryptoffset=
  • cryptkey=
  • nbd=
  • root=
  • resume
  • rootflags
  • usbdelay
  • pkgs=
  • ssh_key=
  • keep_apk_new
  • splash=
  • ...