1

I'm having some issues with Alpine Linux, running in "diskless" mode on ESXi. I have configured it following the instructions in the wiki.

Here's the content of the fstab file:

/dev/cdrom  /media/cdrom    iso9660 noauto,ro 0 0
/dev/sda /media/usb vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro 0 0

(This was configured exactly as per instructions in the wiki)

However, at boot, the /dev/sda disk is mounted on /media/sda, and nothing gets mounted on /media/usb. The consequence is that my local backup isn't restored.

How can I fix this?

2 Answers 2

1

TLDR:

  1. re-mount /dev/sda to /media/sda as rw
  2. edit fstab to use /media/sda instead of /media/usb
  3. re-run setup-lbu to use sda
  4. re-run setup-apkcache to use /media/sda/cache
  5. run lbu ci

Background and longer answer:

Apparently alpine mounts the available partitions (and r/o at that) before /etc/fstab is parsed. And in case an fstab entry overlaps with one of the partitions, it fails to mount.

I have not been able to find the exact spot where it happens in alpine source code, but found that the behaviour is mentioned here: https://oscillate.gr/words/router-pt2/

Quote from that link:

For example if the formatted device is sda1 mount it under /media/sda1. It seems that alpine’s initrd scripts mount every available filesystem under /media using the device name, ignoring your fstab. This kind of makes sense since fstab is not available in the pre-boot environment. So in order to avoid any further complications I recommend that we stick to that convention.

The answer by Francesco Colista cannot really be used when booting from cdrom iso as was my case (VirtualBox) and I assume the OP's as well (ESXi).

However, it seems that setup-lbu detects the available mounts in /media directory, so the simplest way is to use the automatic mount and run setup-lbu to specify sda as the lbu storage device.

Example:

alpine:~# setup-lbu
Enter where to store configs ('floppy', 'sda', 'usb' or 'none') [usb]: sda

The same applies to setup-apkcache which can also be configured to use /media/sda mount.

Note

If you start from a clean boot, just configure the mount this way from the start and setup-alpine will pick it up for the initial setup

# mount /dev/sda /media/sda
# grep /dev/sda /proc/mount >> /etc/fstab
# setup-alpine
0

This is an option passed by the bootloader.

If you have syslinux (the default bootloader used by alpine), check boot/syslinux/syslinux.cfg and modify the alpine_dev option from usbdisk to sda like this example:

serial 0 9600
timeout 20
prompt 1
default grsec
label grsec
    kernel /boot/vmlinuz-grsec
    append initrd=/boot/initramfs-grsec alpine_dev=sda:vfat modules=loop,squashfs,sd-mod,usb-storage quiet console=tty1,38400 console=ttyS0,9600

Since is an example, adapt it according with your settings (especially the kernel and initrd).

.: Francesco

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .