Updates to installed packages do not persist

6 posts / 0 new
Last post
#1 Tue, 2017-08-15 03:33
fouc_
  • fouc_'s picture
  • Offline
  • Last seen: 7 months 2 weeks ago
  • Joined: 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

Tue, 2017-08-15 09:01
Ianux
  • Ianux's picture
  • Offline
  • Last seen: 7 months 2 weeks ago
  • Joined: 2016-06-05

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 with
mount -o remount,rw Get your UUID with blkid, update your fstab, then run
lbu package path/to/apkovl or just lbu ci then reboot.

Tue, 2017-08-15 11:53
fouc_
  • fouc_'s picture
  • Offline
  • Last seen: 7 months 2 weeks ago
  • Joined: 2017-08-15

So this is quite strange. This is my fstab when the device boots

/dev/cdrom              /media/cdrom  iso9660  noauto,ro  0 0
UUID=[sda UUID here]    /media/usb    ext4     defaults   0 0

However /media/usb is not present in the output of mount | grep usb, however /dev/sda is. Indeed there is a ro 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.

Tue, 2017-08-15 12:42
Ianux
  • Ianux's picture
  • Offline
  • Last seen: 7 months 2 weeks ago
  • Joined: 2016-06-05

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.

Tue, 2017-08-15 14:37
fouc_
  • fouc_'s picture
  • Offline
  • Last seen: 7 months 2 weeks ago
  • Joined: 2017-08-15

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 doing apk 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 remounted rw before syncing the cache and b) causes lbu 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

Tue, 2017-08-15 23:30
Ianux
  • Ianux's picture
  • Offline
  • Last seen: 7 months 2 weeks ago
  • Joined: 2016-06-05

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/

Log in or register to post comments