0

I want to create some Alpine VMs in VirtualBox.

To do so, I first downloaded both the Standard and the Virtual versions (see https://alpinelinux.org/downloads/), and then I created two vdi from their .iso with VBoxManage convertfromraw --format VDI alpine-standard-3.10.3-x86_64.iso vm_1.vdi.

Finally, I created both machines in VirtualBox with the two vdi. Everything ok.

However, if I install a package or simply vi hello.txt in the folder after log in, after reboot, everything is gone. The installed packages, the new files created by me...

Why does this happen? Why is nothing persistent?

note: I've originally wanted to install the Extended version, but I changed my mind when I read that it "runs from RAM" and I associated it with "everything is wiped after reboot", but I may be wrong, of course.

2

It looks like you've missed a step:

Now Alpine are complete running from the media source, you can install it by running the setup-alpine command.

Before runs setup-alpine there's many ways and use cases in the Alpine install manual for beginners

What you've actually done is to create a virtual hard drive that is a byte-for-byte copy of the ISO file intended to be burned to a CD. You're effectively booting Alpine Linux as a Live CD.

The file system on the ISO is ISO9660 and Linux will mount this in read-only mode. When this boots, a clever trick is used with a ram-disk and overlayfs. This gives the impression of being read-writable. In fact all changes are just stored in RAM.


You need to actually install alpine, rather than run it as a Live-CD. To do this:

  • create a new VM with a fresh empty VDI image as a hard drive.
  • add the ISO file as a CD (insert CD)
  • ensure the VM's boot priority boots from CD first
  • boot up the VM
  • inside this run setup-alpine
  • shutdown
  • remove the ISO (eject CD)
  • boot up the VM
  • add your packages as you did before

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.