Subject: Some packages not restored after diskless mode reboot

From: [email-masked]
Date: Sun, 08 Dec 2024 08:33:00 +0000

I set up a diskless system following the instructions on the wiki. After rebooting the system, some packages are not being reinstalled. The missing packages come back after running `apk fix` manually. There are no errors displayed in the boot output (with quiet disabled) while the other packages are being installed.

```
# cat /etc/apk/world
alpine-base
busybox-mdev-openrc
cfdisk
chrony
file
htop
iftop
iotop
lsblk
openssh
samba
vim
```

One package that's not installing is `samba`. I've confirmed that samba packages are in the cache:
```
# ls /etc/apk/cache/ | grep samba
libauth-samba-4.20.6-r1.3c28fdae.apk
samba-client-4.20.6-r1.c1461f5a.apk
samba-client-libs-4.20.6-r1.c5095c38.apk
samba-common-4.20.6-r1.fe1d4120.apk
samba-common-server-libs-4.20.6-r1.8ec624e9.apk
samba-common-tools-4.20.6-r1.06ae6656.apk
samba-libs-4.20.6-r1.fa3bccb2.apk
samba-server-4.20.6-r1.a8602cf5.apk
samba-server-openrc-4.20.6-r1.a3abe0ae.apk
samba-util-libs-4.20.6-r1.68790877.apk
```

Inspecting the APKINDEX file in the cache, there's an entry for samba including its dependencies:
```
# tar -xvf /etc/apk/cache/APKINDEX.33b75773.tar.gz -O APKINDEX | grep -B
1 -A12 'P:samba$'
C:Q1FyDtEli/WhTz5qGizq/rDkJaLzk=
P:samba
V:4.20.6-r1
A:aarch64
S:1266
I:0
T:Tools to access a server's filespace and printers via SMB
U:https://www.samba.org/
L:GPL-3.0-or-later AND LGPL-3.0-or-later
o:samba
m:Natanael Copa <[email-masked]>
t:1733128458
c:ca678c267486553e3a9046371475ded651977772
D:samba-server=4.20.6-r1 samba-client=4.20.6-r1 samba-common-tools=4.20.6-r1
```

Interestingly, manually attempting to install `samba` from the cache without the network also fails:
```
# apk add samba --no-network
ERROR: unable to select packages:
  samba-4.20.6-r1:
    masked in: --no-network
    satisfies: world[samba]
```

It appears that samba is somewhat special, in that it's a meta-package that has no apk file, but has dependencies on `samba-common-tools`, `samba-server`, and `samba-client`.  I've confirmed that if I explicitly add those three dependencies to my world, the packages do get installed after a reboot.

This feels to me like a bug with how apk handles populating at boot from its offline cache. It took me a long time to figure out that the meta-package was the issue, since apk silently continues during the boot process, never mentioning that it can't select the package.

-ian

---

From: Paul Zinselmeyer <[email-masked]>
Date: Tue, 10 Dec 2024 12:13:35 +0100

Hello,
I've had a similar issue for 'grub-xenhost' on a diskless install.
I sadly cannot find where I've found the solution to this issue, but
I've fixed the issue by removing the reference to the installation media 
from '/etc/apk/repositories' (e.g. '/media/cdrom/cache') and updating 
the package cache with 'apk fix && apk cache download' (after setting up 
apkcache with 'setup-apkcache').

Kind Regards
Paul / pfzetto

---

From: [email-masked]
Date: Tue, 10 Dec 2024 18:11:11 +0000

I ended up filing a bug report over to apk, and Timo Teräs has already authored a commit with a fix!

https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/11056

https://gitlab.alpinelinux.org/alpine/apk-tools/-/commit/78c3bdc03cbd8cd62d2f13526d86291b0585b71c