Score:0

Installing packages via autoinstall vs user-data

pt flag

I've read the entire autoinstall documentation and the entire cloud-init documentation, but I still don't understand the apparent overlap/redundancy between the ability to install packages in autoinstall, vs the ability to install packages via the user-data section.

What I want is to install packages and bake them into my image. I don't want to have to wait for packages to install when I clone the image.

This post isn't specific to installing packages, but it opened my eyes to the fact that there's an "installation environment" and an "installed environment" (or is "target" the better term?). I think it would help if I understood how this works.

Also related, I think, does "first boot" happen during the autoinstall procedure, or does "first boot" happen when I clone the image?

There are other redundancies between autoinstall and user-data... But I think it will help if I can better understand the things above.

For the record, I'm using packer to create templates in Proxmox.

Alex Dresko avatar
pt flag
@user535733 As far as I know, there's never any install media present. My process starts with Packer and ends up with a template in Proxmox. I never insert or remove installation media. I think that's part of my confusion.
Score:2
jp flag

If you use an autoinstall configuration like this

#cloud-config
autoinstall:
  packages:
  - cowsay
  user-data:
    packages:
    - rolldice

The package cowsay will be installed during the installation. The package rolldice will be installed by cloud-init during first boot.

If the package goal is to "bake" the packages into the image then the method for cowsay should be used.

Anything in the user-data section gets used by cloud-init. You can see it get put into /etc/cloud/cloud.cfg.d/99-installer.cfg on the installed system.

notes

  • I also avoid using the user-data method because cloud-init will attempt to install or upgrade the package(s) during every boot.
  • There is no significance to the packages in the example. They are just tiny, simple, and easy to test with.
  • I tested using Ubuntu 22.04 (subiquity 22.04.2).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.