Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mkinitfs mkinitfs
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 19
    • Issues 19
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • alpinealpine
  • mkinitfsmkinitfs
  • Issues
  • #5
Closed
Open
Issue created Jul 10, 2020 by pszenher@pszenher

Initramfs-init does not respect apkovl device fstab entry

When booting with an attached device containing an apkovl file, the overlay will be detected and applied, but the disk storing the apkovl will not be remounted to comply with the newly unpacked fstab.

This is problematic on systems that may have disks added or removed, as nlplug-findfs mounts drives by SCSI disk device name, which can change upon reboot. If the apkovl device is also used as an apk cache, this mount point change will cause the cache to not be found.

Functionality is already implemented in the initramfs-init script to remount drives, but is only applied to boot media found by nlplug-findfs, not apk overlay devices.

Steps to verify:

  1. Configure an apkovl device with a fstab configuring that disk's mount point
  2. Boot a diskless installation using the apkovl device
  3. Verify that apkovl disk is incorrectly mounted at /media/sdX by nlplug-findfs, not its fstab configuration

Workaround: Create an empty .boot_repository file on the apkovl device to detect the device as a boot drive and thus automatically remount in accordance with the fstab.

Proposal: Modify the relocate_mount() function (reproduced below) to iterate over boot devices (found through the $repofile variable) and apk overlay devices (found through the $ovl variable).

# relocate mountpoint according given fstab
relocate_mount() {
	local fstab="${1}"
	local dir=
	if ! [ -e $repofile ]; then
		return
	fi
	while read dir; do
		# skip http(s)/ftp repos for netboot
		if ! [ -d "$dir" ]; then
			continue
		fi
		local dev=$(df -P "$dir" | tail -1 | awk '{print $1}')
		local mnt=$(find_mnt $dev $fstab)
		if [ -n "$mnt" ]; then
			local oldmnt=$(awk -v d=$dev '$1==d {print $2}' /proc/mounts)
			if [ "$oldmnt" != "$mnt" ]; then
				mkdir -p "$mnt"
				mount -o move "$oldmnt" "$mnt"
			fi
		fi
	done < $repofile
}
Assignee
Assign to
Time tracking