Subject: System functionality questions

From: Genoperno Translucente <[email-masked]>
Date: Mon, 30 Nov 2020 02:53:58 +0100

In the past I was a user of Tinycore linux, I liked the distro but
there were a couple of things I didn't like (not rollingrelease, with
new major versions you could lose support for old packages until
someone rebuild them and the repository building system was not based
on a script system).
For other things it was really nice and I didn't understand if I can
replicate these things in Alpine because I'm not very experienced.
The things I liked so much in Tinycore and I would like to replicate in Alpine:

1) I could start the distro in a write-protected sd, the distro was
loaded all in ram without creating any problem. If I wanted to
download new packages I had to unmont and extract it, remove the
protection and put it back and remount.
    In theory with Alpine's "diskless mode" or "data mode" it should
be possible, it is possible to start Alpine on phisically write
protected sd and eventually unmount an remount to download new
package?

2) If I wanted to back up system customizations I had to specify in a
text file which directories to save and then make a backup (a simple
archive). Obviously if the backup directory was on the same sd, it
should not be write-protected during the backup.
In theory it should be possible to do the same thing with "lbu", but
afterwards in Tinycore I could unmount my sd again, this means that it
was possible to have all the data on the ram and back up only what was
needed when necessary without the need to have a partition always
mounted with the customizations. For me it was very convenient because
I used the distro on a netbook with internal hd just to save the data
and the sd with all the configurations.
In this way I had my minimal system very fast, the most shock
resistant netbook because I mounted the internal (magnetic and not
ssd) hd only if I had to access the data, a longer battery life (with
the hd off) and the ability to load the programs I needed just in time
(so I did not have to load every time my entire collection of programs
in ram).
    So the question is, is it possible to selectively backup data on
an archive (that is reloaded everytime at boot) without needing to
have our data saved in a partition with direct access that need to be
always mountend, leaving the disk free to be unmounted?

3)the system was virtually "reinstalled" at every boot, i.e. the
packages and backup files were decompressed in ram at boot time. The
packages to install at boot time were listed in a text file, so each
time I could modify the distro by simply adding or removing the
packages to install in this text file.  At the time, there was no
"clean" way to uninstall things with the system running, but in this
way after rebooting the system was definitely cleaner than
uninstalling on a normal distro like debian, where things could remain
installed on the system becasue all saved stuff is tracked in someway.
    So the question is, diskless/data mode work in the same way? for
example every time I could bring the system back to a "vanilla"
initial state by simply editing some files?

Excuse me for asking these long questions, I've known Alpine for a
long time but I've never been able to answer clearly by myself with
the time I could dedicate.
Thanks in advance for clarifications :)

---

From: Kevin Daudt <[email-masked]>
Date: Tue, 1 Dec 2020 10:24:05 +0100

> protected sd and eventually unmount an remount to download new

This should work out of the box, indeed. For booting, Alpine Linux does
not need write access to the boot medium (the ISO is read-only, and it
can boot from that)

> always mountend, leaving the disk free to be unmounted?

Alpine Linux has LBU, which is used to persist data on a run-from-ram
system. You explicitly commit any changes that need to be persisted. By
default, it only includes `/etc`, but you can include other files /
directories as well. This will create an apkovl on the boot medium
(Which at that point should indeed be writable).

After boot, make sure that all the kernel modules that you need are
loaded (you can add them to `/etc/modules-load.d/` to do this
automatically). Then you can run `rc-service stop modloop`, after which
you should be able to unmount the sd card.

> initial state by simply editing some files?

The run-from-ram mode (diskless / data modes) work like this. The
explicitly installed packages are listed in `/etc/apk/world`. On boot,
these packages (+ dependencies) are automatically installed, and the
apkovl applied. This gives you a clean system.

On a running system, you can even modify `/etc/apk/world/` and run `apk
fix` to automatically add / remove packages based on what's in that
file.

> Thanks in advance for clarifications :)

No problem, I hope this helps.

Kevin