Updates to installed packages do not persist
-
- Offline
- 7 months 2 weeks ago
- 2017-08-15
Hi! I followed the installation instructions for a diskless installation based on the standard iso. Here are my basic configuration files. I am using a small internal hard driver formatted with ext4 and no partitions (although I have tried partioning the disk as well). This holds the apkovl
and the package cache. I have managed to persist newly installed packages that are present after reboot, however updates to installed packages do not persist. For example when I run
apk update && apk upgrade
Updates to the installed packages are fetched to /media/usb/cache
(I see the newer version apks in the cache directory). However after rebooting the previous versions of the packages are present in the system, i.e. if I run apk update && apk upgrade
the packages are updated yet again (of course I lbu commit
'ed everything first). Initially I thought that this happens because packages are pulled from the CDROM instead of the cache, but even if I comment out /media/cdrom/apks
and the cache is sync'ed to the remote repository the problem persists. I also tried apk cache sync
but without any results.
Could you please give me some guidelines on how to debug this issue?
Configuration files
/etc/apk/repositories
/media/cdrom/apks http://dl-4.alpinelinux.org/alpine/v3.6/main
/etc/lbu/lbu.conf
DEFAULT_CIPHER=aes-256-cbc LBU_MEDIA=usb BACKUP_LIMIT=2
/etc/apk/cache
links to /media/usb/cache
I think your problem ist the fstab. Pleas post the result from
cat /etc/fstab
. It should be like this:UUID=xxxx /media/usb ext4 defaults 0 0
Is your /media/usb partition mounted with rw? run
mount
cmd, you should see it. Remount it withmount -o remount,rw
Get your UUID withblkid
, update your fstab, then runlbu package path/to/apkovl
or justlbu ci
then reboot.So this is quite strange. This is my fstab when the device boots
However
/media/usb
is not present in the output ofmount | grep usb
, however/dev/sda
is. Indeed there is aro
mount on/media/sda
despite the fact that I have never asked for it be mounted on fstab there. Still I tried to move the link in/etc/apk/cache
to/media/sda/cache
in hope that the packages will be picked up on boot however still, packages on cache are not installed, only the versions present in cdrom do.Alpine unpacks the apkovl during boot, if devices are not in fstab, it mounts it under /media/sdx. Try to unpack your apkovl and examine links, fstab,...
Good luck! I have automated usb creation and apkovl creation, since then I have not such problems. But I know troubles like this.
Alpine search for apkovl from the first partition to the last, all devices. First it finds, it use it. So, if by accident you have a usb stick with a spare apkovl still pluged in, it could use the wrong.
It seems there are two distinct issues.
The first is that CDROM apk repo has higher priority than the cache for a reason I cannot fathom. However, removing
/media/cdrom/apks
from/etc/apk/repositories
AND doingapk cache download
will force all installed packages to be downloaded into the cache. So on boot the packages will be picked up from there. After that packages are up-to-date as it would be expected. This however only happens if the cache is located in the same disk as the apkovl (because it is mounted early, probably by initramfs). This is probably linked to the second issue.The second is that apparently
/etc/fstab
is not honored on (early) boot. The disk will not be mounted on/media/usb
because it is already mounted read only on/media/sda
. This does not really pose a problem by itself however a) prevents the cache from being written so it must be remountedrw
before syncing the cache and b) causeslbu commit
to fail because it expects the apkovl to be saved on/media/usb
rather than on/media/sda
and it cannot mount it since it already mounted on/media/sda
Is there a bug in Alpine or is your setup somehow broken? I have similar configurations, with ext4, btrfs on my servers without problems.
If you want to understand the relevant code (nlplug) better:
https://git.alpinelinux.org/cgit/user/ncopa/nlplug/
https://github.com/saintdev/mkinitfs/blob/master/nlplug-findfs.c
https://github.com/rnalrd/apkovl-builder
The developers/users sometimes discuss nlplug, apkovl, boot to ram on irc, maybe you'll find some hints here. I don't know the best way to grep for old irclogs:
https://dev.alpinelinux.org/irclogs/