Score:1

What is the difference between Cloud-Init and Autoinstall?

nl flag

So I have been trying to essentially install Nixos from the official site with a Cloud-Init for Ubuntu Server 22.04. I want to really understand how to install packages that I potentially might have to compile or other ways of installing packages like with Curl or Wget within in the user-data.yaml file.

So far I have a user-data.yaml in which I am trying to use runcmd: to install Nox via the recommended way from there site.

My whole config is below and at the bottom is the runcmd: which I just can't get to install. The whole file looks like this.

#cloud-config
autoinstall:
  version: 1
  locale: en_GB.UTF-8
  refresh-installer:
    update: true
  keyboard:
    layout: "gb"
  apt:
    geoip: true
  identity:
    hostname: ubuntu-server
    password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
    username: ubuntu
  storage:
    layout:
      name: lvm
      match:
        size: largest
  packages:
    - libreoffice
    - sway
    - i3
    - kitty
  snaps:
    - name: firefox
  timezone: geoip
  manage_resolv_conf: true
  resolv_conf:
    nameservers:
      - 1.1.1.3
      - 8.8.8.8
  updates: all
  runcmd:
    - [mkdir, -m, 0755, /nix]
    - [chown, ubuntu, /nix]
    - [wget, "https://nixos.org/nix/install"]
    - [bash, install, --daemon]

If you run the installer via the command line you get prompt if you want to make the dir '/nix' hence the command for it. I'm at my wits end!

I have tried for the past 7 hours to get this package manager installed so I can install Wayland which would be a lot easier to install from here than installing it from source if I was to use RunCmd: the whole time.

Which from what I understand is the way to run bash commands

So far I have tried:

  • Puting it to root so no \s\s before the runcmd: keyword
  • Trying the commands in quotes like "sh -c 'curl ....'"
  • Puting it in brackets like `[sh, -c, curl, "https://nixos.org/down.../install", |, bash]
  • Other configuration of it in brackets like `[bash, -c, 'curl "https://nixos.org/down.../install" | bash'] *So many configurations!!
  • Gone onto GitHub and search for examples of other people using runcmd:
  • Following a DigitalOcean guide on Cloud-Init with runcmd: examples
  • Read the reference for Cloud-init
  • Read the reference for Autoinstall
  • read the reference for Curtin

And I just don't know what to do next...

I'm using Qemu to test these configs with an Ubuntu 22.04 Jammy Server ISO.

How do I just install stuff from a setup file that has an install script from the web?

Thanks :)

Score:1
br flag

What is the difference between Cloud-Init and Autoinstall?

Subiquity uses cloud-init, and it does so by overloading the cloud-init's config file with its own custom keys. This is why subiquity's docs (confusingly) call it a "cloud-config" - it is a cloud-config in the same way that most YAML files that start with #cloud-config are valid cloud-configs: undefined keys are ignored by cloud-init.

Cloud-init doesn't use the autoinstall key to configure anything, as described in the docs of both cloud-init and the subiquity autoinstaller.

My whole config is below and at the bottom is the runcmd: which I just can't get to install.

Maybe someone else might be able to help with subiquity in more detail, but a glance at subiquity's jsonschema, it looks like you're trying to use keys that aren't valid for the autoinstaller. I don't see runcmd in the jsonschema.

How do I just install stuff from a setup file that has an install script from the web?

I would recommend clarifying what, exactly, you're trying to ask.

Score:1
in flag

I was struggling with the same thing for hours!

Here's what seems to work (at least for me), so try this;

#cloud-config
autoinstall:
   version: 1
   ...
   user-data:
      runcmd:
        - mkdir -m 0755 /nix
        - chown ubuntu /nix
        - wget "https://nixos.org/nix/install"
        - bash install --daemon

Not sure about the brackets. My command worked without them so try that first for better readability.

https://ubuntu.com/server/docs/install/autoinstall-reference#user-data

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.