From 484515d591e60740b7ecf7b35d4093730d3d16d4 Mon Sep 17 00:00:00 2001 From: Mischa Taylor <57647141+taylorific@users.noreply.github.com> Date: Sat, 1 Jun 2024 14:59:17 -0400 Subject: [PATCH] Update LIBVIRT_MANUAL_INSTALL_ISO.md --- docs/LIBVIRT_MANUAL_INSTALL_ISO.md | 749 +++++++++++++++++++++++++++++ 1 file changed, 749 insertions(+) diff --git a/docs/LIBVIRT_MANUAL_INSTALL_ISO.md b/docs/LIBVIRT_MANUAL_INSTALL_ISO.md index e6c5247..768da42 100644 --- a/docs/LIBVIRT_MANUAL_INSTALL_ISO.md +++ b/docs/LIBVIRT_MANUAL_INSTALL_ISO.md @@ -460,6 +460,755 @@ virsh destroy ubuntu-desktop-2404 virsh undefine ubuntu-desktop-2404 --nvram --remove-all-storage ``` +> **Note:** +> All of the subiquity-based installers make use of cloud-init + +## Ubuntu Server 24.04 ISO cloud-init + +``` +$ ls -l /etc/cloud +total 24 +drwxr-xr-x 2 root root 4096 Jun 1 17:18 clean.d +-rw-r--r-- 1 root root 3718 Apr 5 23:18 cloud.cfg +drwxr-xr-x 2 root root 4096 Jun 1 17:18 cloud.cfg.d +-rw-r--r-- 1 root root 132 Jun 1 17:20 cloud-init.disabled +-rw-r--r-- 1 root root 16 Jun 1 17:18 ds-identify.cfg +drwxr-xr-x 2 root root 4096 Apr 23 09:40 templates +``` + +``` +$ cat /etc/cloud/cloud-init.disabled +Disabled by Ubuntu live installer after first boot. +To re-enable cloud-init on this image run: + sudo cloud-init clean --machine-id +``` + +``` +$ cat /etc/cloud/ds-identify.cfg +policy: enabled +``` + +``` +$ ls -l /etc/cloud/clean.d +total 4 +-rwxr-xr-x 1 root root 484 Jun 1 17:18 99-installer +``` + +``` +$ cat /etc/cloud/clean.d/99-installer +#!/usr/bin/env python3 +# Remove live-installer config artifacts when running: sudo cloud-init clean +# Autogenerated by Subiquity: 2024-06-01 17:18:27.949965 UTC + + +import os + +for cfg_file in ["/etc/cloud/cloud-init.disabled", "/etc/cloud/cloud.cfg.d/20-disable-cc-dpkg-grub.cfg", "/etc/cloud/cloud.cfg.d/90-installer-network.cfg", "/etc/cloud/cloud.cfg.d/99-installer.cfg", "/etc/cloud/ds-identify.cfg"]: + try: + os.remove(cfg_file) + except FileNotFoundError: + pass +``` + +``` +$ ls -l /etc/cloud/cloud.cfg.d +total 28 +-rw-r--r-- 1 root root 2071 Mar 27 13:14 05_logging.cfg +-rw-r--r-- 1 root root 28 Jun 1 17:18 20-disable-cc-dpkg-grub.cfg +-rw-r--r-- 1 root root 333 Apr 23 09:40 90_dpkg.cfg +-rw------- 1 root root 117 Jun 1 17:16 90-installer-network.cfg +-rw------- 1 root root 793 Jun 1 17:18 99-installer.cfg +-rw-r--r-- 1 root root 35 Jun 1 17:15 curtin-preserve-sources.cfg +-rw-r--r-- 1 root root 167 Mar 27 13:14 README +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/05_logging.cfg +## This yaml formatted config file handles setting +## logger information. The values that are necessary to be set +## are seen at the bottom. The top '_log' are only used to remove +## redundancy in a syslog and fallback-to-file case. +## +## The 'log_cfgs' entry defines a list of logger configs +## Each entry in the list is tried, and the first one that +## works is used. If a log_cfg list entry is an array, it will +## be joined with '\n'. +_log: + - &log_base | + [loggers] + keys=root,cloudinit + + [handlers] + keys=consoleHandler,cloudLogHandler + + [formatters] + keys=simpleFormatter,arg0Formatter + + [logger_root] + level=DEBUG + handlers=consoleHandler,cloudLogHandler + + [logger_cloudinit] + level=DEBUG + qualname=cloudinit + handlers= + propagate=1 + + [handler_consoleHandler] + class=StreamHandler + level=WARNING + formatter=arg0Formatter + args=(sys.stderr,) + + [formatter_arg0Formatter] + format=%(asctime)s - %(filename)s[%(levelname)s]: %(message)s + + [formatter_simpleFormatter] + format=[CLOUDINIT] %(filename)s[%(levelname)s]: %(message)s + - &log_file | + [handler_cloudLogHandler] + class=FileHandler + level=DEBUG + formatter=arg0Formatter + args=('/var/log/cloud-init.log', 'a', 'UTF-8') + - &log_syslog | + [handler_cloudLogHandler] + class=handlers.SysLogHandler + level=DEBUG + formatter=simpleFormatter + args=("/dev/log", handlers.SysLogHandler.LOG_USER) + +log_cfgs: +# Array entries in this list will be joined into a string +# that defines the configuration. +# +# If you want logs to go to syslog, uncomment the following line. +# - [ *log_base, *log_syslog ] +# +# The default behavior is to just log to a file. +# This mechanism that does not depend on a system service to operate. + - [ *log_base, *log_file ] +# A file path can also be used. +# - /etc/log.conf + +# This tells cloud-init to redirect its stdout and stderr to +# 'tee -a /var/log/cloud-init-output.log' so the user can see output +# there without needing to look on the console. +output: {all: '| tee -a /var/log/cloud-init-output.log'} +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/20-disable-cc-dpkg-grub.cfg +grub_dpkg: + enabled: false +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/90_dpkg.cfg +# to update this file, run dpkg-reconfigure cloud-init +datasource_list: [ NoCloud, ConfigDrive, OpenNebula, DigitalOcean, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, SmartOS, Bigstep, Scaleway, AliYun, Ec2, CloudStack, Hetzner, IBMCloud, Oracle, Exoscale, RbxCloud, UpCloud, VMware, Vultr, LXD, NWCS, Akamai, WSL, None ] +``` + +``` +$ sudo cat /etc/cloud/cloud.cfg.d/90-installer-network.cfg +# This is the network config written by 'subiquity' +network: + ethernets: + enp1s0: + dhcp4: true + version: 2 +``` + +``` +$ sudo cat /etc/cloud/cloud.cfg.d/99-installer.cfg +datasource: + None: + metadata: + instance-id: 7fcad967-8b86-40aa-8761-58d0ed4245d5 + userdata_raw: "#cloud-config\ngrowpart:\n mode: 'off'\nlocale: en_US.UTF-8\n\ + preserve_hostname: true\nresize_rootfs: false\nssh_pwauth: true\nusers:\n- gecos:\ + \ automat\n groups: adm,cdrom,dip,lxd,plugdev,sudo\n lock_passwd: false\n\ + \ name: automat\n passwd: $6$VHMEtYQBCS/gpEYp$XghG2ozLRgkm.jGqmEMl2Q/161CjT5DbYbSRSGsYoDDLXAtUV.yRrMJdmClMi2.EAelEN1JPZ78sIIGmBXNK60\n\ + \ shell: /bin/bash\nwrite_files:\n- content: \"Disabled by Ubuntu live installer\ + \ after first boot.\\nTo re-enable cloud-init\\\n \\ on this image run:\\\ + n sudo cloud-init clean --machine-id\\n\"\n defer: true\n path: /etc/cloud/cloud-init.disabled\n" +datasource_list: +- None +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/curtin-preserve-sources.cfg +apt: + preserve_sources_list: true +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/README +# All files with the '.cfg' extension in this directory will be read by +# cloud-init. They are read in lexical order. Later files overwrite values in +# earlier files. +``` + +## Ubuntu Server 22.04 ISO cloud-init + +``` +$ ls -l /etc/cloud +total 20 +drwxr-xr-x 2 root root 4096 Jun 1 17:47 clean.d +-rw-r--r-- 1 root root 3756 Oct 24 2023 cloud.cfg +drwxr-xr-x 2 root root 4096 Jun 1 17:47 cloud.cfg.d +-rw-r--r-- 1 root root 16 Jun 1 17:47 ds-identify.cfg +drwxr-xr-x 2 root root 4096 Feb 16 18:48 templates +``` + +``` +$ cat /etc/cloud/ds-identify.cfg +policy: enabled +``` + +``` +$ ls -l /etc/cloud/clean.d +total 8 +-rwxr-xr-x 1 root root 455 Jun 1 17:47 99-installer +-rw-r--r-- 1 root root 883 Oct 24 2023 README +``` + +``` +$ cat /etc/cloud/clean.d/99-installer +#!/usr/bin/env python3 +# Remove live-installer config artifacts when running: sudo cloud-init clean +# Autogenerated by Subiquity: 2024-06-01 17:47:12.223074 UTC + + +import os + +for cfg_file in ["/etc/cloud/cloud.cfg.d/99-installer.cfg", "/etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg", "/etc/cloud/ds-identify.cfg", "/etc/netplan/00-installer-config.yaml"]: + try: + os.remove(cfg_file) + except FileNotFoundError: + pass +``` + +``` +$ cat /etc/cloud/clean.d/README +-- cloud-init's clean.d run-parts directory -- + +This directory is provided for third party applications which need +additional configuration artifact cleanup from the filesystem when +the command `cloud-init clean` is invoked. + +The `cloud-init clean` operation is typically performed by image creators +when preparing a golden image for clone and redeployment. The clean command +removes any cloud-init semaphores, allowing cloud-init to treat the next +boot of this image as the "first boot". When the image is next booted +cloud-init will performing all initial configuration based on any valid +datasource meta-data and user-data. + +Any executable scripts in this subdirectory will be invoked in lexicographical +order with run-parts by the command: sudo cloud-init clean. + +Typical format of such scripts would be a ##- like the following: + /etc/cloud/clean.d/99-live-installer +``` + +``` +$ ls -l /etc/cloud/cloud.cfg.d/ +total 24 +-rw-r--r-- 1 root root 2070 Oct 24 2023 05_logging.cfg +-rw-r--r-- 1 root root 328 Feb 16 18:46 90_dpkg.cfg +-rw------- 1 root root 542 Jun 1 17:47 99-installer.cfg +-rw-r--r-- 1 root root 35 Jun 1 17:43 curtin-preserve-sources.cfg +-rw-r--r-- 1 root root 167 Oct 24 2023 README +-rw------- 1 root root 28 Jun 1 17:45 subiquity-disable-cloudinit-networking.cfg +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/05_logging.cfg +## This yaml formated config file handles setting +## logger information. The values that are necessary to be set +## are seen at the bottom. The top '_log' are only used to remove +## redundency in a syslog and fallback-to-file case. +## +## The 'log_cfgs' entry defines a list of logger configs +## Each entry in the list is tried, and the first one that +## works is used. If a log_cfg list entry is an array, it will +## be joined with '\n'. +_log: + - &log_base | + [loggers] + keys=root,cloudinit + + [handlers] + keys=consoleHandler,cloudLogHandler + + [formatters] + keys=simpleFormatter,arg0Formatter + + [logger_root] + level=DEBUG + handlers=consoleHandler,cloudLogHandler + + [logger_cloudinit] + level=DEBUG + qualname=cloudinit + handlers= + propagate=1 + + [handler_consoleHandler] + class=StreamHandler + level=WARNING + formatter=arg0Formatter + args=(sys.stderr,) + + [formatter_arg0Formatter] + format=%(asctime)s - %(filename)s[%(levelname)s]: %(message)s + + [formatter_simpleFormatter] + format=[CLOUDINIT] %(filename)s[%(levelname)s]: %(message)s + - &log_file | + [handler_cloudLogHandler] + class=FileHandler + level=DEBUG + formatter=arg0Formatter + args=('/var/log/cloud-init.log', 'a', 'UTF-8') + - &log_syslog | + [handler_cloudLogHandler] + class=handlers.SysLogHandler + level=DEBUG + formatter=simpleFormatter + args=("/dev/log", handlers.SysLogHandler.LOG_USER) + +log_cfgs: +# Array entries in this list will be joined into a string +# that defines the configuration. +# +# If you want logs to go to syslog, uncomment the following line. +# - [ *log_base, *log_syslog ] +# +# The default behavior is to just log to a file. +# This mechanism that does not depend on a system service to operate. + - [ *log_base, *log_file ] +# A file path can also be used. +# - /etc/log.conf + +# This tells cloud-init to redirect its stdout and stderr to +# 'tee -a /var/log/cloud-init-output.log' so the user can see output +# there without needing to look on the console. +output: {all: '| tee -a /var/log/cloud-init-output.log'} +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/90_dpkg.cfg +# to update this file, run dpkg-reconfigure cloud-init +datasource_list: [ NoCloud, ConfigDrive, OpenNebula, DigitalOcean, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, SmartOS, Bigstep, Scaleway, AliYun, Ec2, CloudStack, Hetzner, IBMCloud, Oracle, Exoscale, RbxCloud, UpCloud, VMware, Vultr, LXD, NWCS, Akamai, None ] +``` + +``` +$ sudo cat /etc/cloud/cloud.cfg.d/99-installer.cfg +[sudo] password for automat: +datasource: + None: + metadata: + instance-id: 1aa5ee9f-653a-4290-a6fa-83836a30ce72 + userdata_raw: "#cloud-config\ngrowpart:\n mode: 'off'\nlocale: en_US.UTF-8\n\ + preserve_hostname: true\nresize_rootfs: false\nssh_pwauth: true\nusers:\n- gecos:\ + \ automat\n groups: adm,cdrom,dip,lxd,plugdev,sudo\n lock_passwd: false\n\ + \ name: automat\n passwd: $6$tDf4cjp9f6HsAtsq$yeAA0vHqtLPAttWpz7hbQN6mCGiyyVVhgD/AW.ehH0Jyr.xrt7gItfZS7NEE9QGsdPtmctQ4lZ3kCpapJN.Gm1\n\ + \ shell: /bin/bash\n" +datasource_list: +- None +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/curtin-preserve-sources.cfg +apt: + preserve_sources_list: true +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/README +# All files with the '.cfg' extension in this directory will be read by +# cloud-init. They are read in lexical order. Later files overwrite values in +# earlier files. +``` + +``` +$ sudo cat /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg +network: {config: disabled} +``` + +## Ubuntu Server 20.04 ISO cloud-init + +``` +$ ls -l /etc/cloud +total 20 +drwxr-xr-x 2 root root 4096 Jun 1 18:19 clean.d +-rw-r--r-- 1 root root 3787 May 19 2023 cloud.cfg +drwxr-xr-x 2 root root 4096 Jun 1 18:19 cloud.cfg.d +-rw-r--r-- 1 root adm 16 Jun 1 18:08 ds-identify.cfg +drwxr-xr-x 2 root root 4096 Jun 1 18:19 templates +``` + +``` +$ cat /etc/cloud/ds-identify.cfg +policy: enabled +``` + +``` +$ ls -l /etc/cloud/clean.d/ +total 4 +-rw-r--r-- 1 root root 883 Nov 23 2022 README +``` + +``` +$ ls -l /etc/cloud/clean.d/ +total 4 +-rw-r--r-- 1 root root 883 Nov 23 2022 README +automat@ubuntu-server-2004:~$ cat /etc/cloud/clean.d/README +-- cloud-init's clean.d run-parts directory -- + +This directory is provided for third party applications which need +additional configuration artifact cleanup from the filesystem when +the command `cloud-init clean` is invoked. + +The `cloud-init clean` operation is typically performed by image creators +when preparing a golden image for clone and redeployment. The clean command +removes any cloud-init semaphores, allowing cloud-init to treat the next +boot of this image as the "first boot". When the image is next booted +cloud-init will performing all initial configuration based on any valid +datasource meta-data and user-data. + +Any executable scripts in this subdirectory will be invoked in lexicographical +order with run-parts by the command: sudo cloud-init clean. + +Typical format of such scripts would be a ##- like the following: + /etc/cloud/clean.d/99-live-installer +``` + +``` +$ ls -l /etc/cloud/cloud.cfg.d/ +total 24 +-rw-r--r-- 1 root root 2070 Nov 23 2022 05_logging.cfg +-rw-r--r-- 1 root root 320 Jun 1 18:19 90_dpkg.cfg +-rw------- 1 root adm 542 Jun 1 18:08 99-installer.cfg +-rw-r--r-- 1 root root 35 Jun 1 18:05 curtin-preserve-sources.cfg +-rw-r--r-- 1 root root 167 Nov 23 2022 README +-rw-r--r-- 1 root root 28 Jun 1 18:06 subiquity-disable-cloudinit-networking.cfg +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/05_logging.cfg +## This yaml formated config file handles setting +## logger information. The values that are necessary to be set +## are seen at the bottom. The top '_log' are only used to remove +## redundency in a syslog and fallback-to-file case. +## +## The 'log_cfgs' entry defines a list of logger configs +## Each entry in the list is tried, and the first one that +## works is used. If a log_cfg list entry is an array, it will +## be joined with '\n'. +_log: + - &log_base | + [loggers] + keys=root,cloudinit + + [handlers] + keys=consoleHandler,cloudLogHandler + + [formatters] + keys=simpleFormatter,arg0Formatter + + [logger_root] + level=DEBUG + handlers=consoleHandler,cloudLogHandler + + [logger_cloudinit] + level=DEBUG + qualname=cloudinit + handlers= + propagate=1 + + [handler_consoleHandler] + class=StreamHandler + level=WARNING + formatter=arg0Formatter + args=(sys.stderr,) + + [formatter_arg0Formatter] + format=%(asctime)s - %(filename)s[%(levelname)s]: %(message)s + + [formatter_simpleFormatter] + format=[CLOUDINIT] %(filename)s[%(levelname)s]: %(message)s + - &log_file | + [handler_cloudLogHandler] + class=FileHandler + level=DEBUG + formatter=arg0Formatter + args=('/var/log/cloud-init.log', 'a', 'UTF-8') + - &log_syslog | + [handler_cloudLogHandler] + class=handlers.SysLogHandler + level=DEBUG + formatter=simpleFormatter + args=("/dev/log", handlers.SysLogHandler.LOG_USER) + +log_cfgs: +# Array entries in this list will be joined into a string +# that defines the configuration. +# +# If you want logs to go to syslog, uncomment the following line. +# - [ *log_base, *log_syslog ] +# +# The default behavior is to just log to a file. +# This mechanism that does not depend on a system service to operate. + - [ *log_base, *log_file ] +# A file path can also be used. +# - /etc/log.conf + +# This tells cloud-init to redirect its stdout and stderr to +# 'tee -a /var/log/cloud-init-output.log' so the user can see output +# there without needing to look on the console. +output: {all: '| tee -a /var/log/cloud-init-output.log'} +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/90_dpkg.cfg +# to update this file, run dpkg-reconfigure cloud-init +datasource_list: [ NoCloud, ConfigDrive, OpenNebula, DigitalOcean, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, SmartOS, Bigstep, Scaleway, AliYun, Ec2, CloudStack, Hetzner, IBMCloud, Oracle, Exoscale, RbxCloud, UpCloud, VMware, Vultr, LXD, NWCS, None ] +``` + +``` +$ sudo cat /etc/cloud/cloud.cfg.d/99-installer.cfg +[sudo] password for automat: +datasource: + None: + metadata: + instance-id: 77521a3c-2b8a-4149-9706-e727a3d81645 + userdata_raw: "#cloud-config\ngrowpart:\n mode: 'off'\nlocale: en_US.UTF-8\n\ + preserve_hostname: true\nresize_rootfs: false\nssh_pwauth: true\nusers:\n- gecos:\ + \ automat\n groups: adm,cdrom,dip,lxd,plugdev,sudo\n lock_passwd: false\n\ + \ name: automat\n passwd: $6$xQgNaFgU.unsZFSI$cuC0eUuTshAawkNjM8dM.h.GQGLPHQ4uj/4i/z.brPKs41Dbzo77B0m.tkWHOtcvgr.IpU9T29z.wl9H456QP.\n\ + \ shell: /bin/bash\n" +datasource_list: +- None +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/curtin-preserve-sources.cfg +apt: + preserve_sources_list: true +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/README +# All files with the '.cfg' extension in this directory will be read by +# cloud-init. They are read in lexical order. Later files overwrite values in +# earlier files. +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg +network: {config: disabled} +``` + +## Ubuntu Desktop 24.04 ISO cloud-init + +``` +$ ls -l /etc/cloud +total 24 +drwxr-xr-x 2 root root 4096 Jun 1 11:40 clean.d +-rw-r--r-- 1 root root 3718 Apr 5 16:18 cloud.cfg +drwxr-xr-x 2 root root 4096 Jun 1 11:40 cloud.cfg.d +-rw-r--r-- 1 root root 132 Jun 1 11:44 cloud-init.disabled +-rw-r--r-- 1 root root 16 Jun 1 11:40 ds-identify.cfg +drwxr-xr-x 2 root root 4096 Apr 24 03:49 templates +``` + +``` +$ cat /etc/cloud/cloud-init.disabled +Disabled by Ubuntu live installer after first boot. +To re-enable cloud-init on this image run: + sudo cloud-init clean --machine-id +``` + +``` +$ cat /etc/cloud/ds-identify.cfg +policy: enabled +``` + +``` +$ ls -l /etc/cloud/clean.d/ +total 8 +-rwxr-xr-x 1 root root 484 Jun 1 11:40 99-installer +-rwxr-xr-x 1 root root 342 Apr 24 03:51 99-installer-use-networkmanager +``` + +``` +$ cat /etc/cloud/clean.d/99-installer +#!/usr/bin/env python3 +# Remove live-installer config artifacts when running: sudo cloud-init clean +# Autogenerated by Subiquity: 2024-06-01 18:40:50.910343 UTC + + +import os + +for cfg_file in ["/etc/cloud/cloud-init.disabled", "/etc/cloud/cloud.cfg.d/20-disable-cc-dpkg-grub.cfg", "/etc/cloud/cloud.cfg.d/90-installer-network.cfg", "/etc/cloud/cloud.cfg.d/99-installer.cfg", "/etc/cloud/ds-identify.cfg"]: + try: + os.remove(cfg_file) + except FileNotFoundError: + pass +``` + +``` +$ cat /etc/cloud/clean.d/99-installer-use-networkmanager +#!/bin/sh +# Inform clone image creators about strict network-manager cfg for cloud-init +if [ -f /etc/cloud/cloud.cfg.d/99-installer-use-networkmanager.cfg ]; then + echo "WARNING: cloud-init network config is limited to using network-manager." + echo "If this is undesirable: rm /etc/cloud/cloud.cfg.d/99-installer-use-networkmanager.cfg" +fi +``` + +``` +$ ls -l /etc/cloud/cloud.cfg.d/ +total 28 +-rw-r--r-- 1 root root 2071 Mar 27 06:14 05_logging.cfg +-rw-r--r-- 1 root root 28 Jun 1 11:40 20-disable-cc-dpkg-grub.cfg +-rw-r--r-- 1 root root 333 Apr 24 03:49 90_dpkg.cfg +-rw------- 1 root root 117 Jun 1 11:38 90-installer-network.cfg +-rw------- 1 root root 815 Jun 1 11:40 99-installer.cfg +-rw-r--r-- 1 root root 35 Jun 1 11:34 curtin-preserve-sources.cfg +-rw-r--r-- 1 root root 167 Mar 27 06:14 README +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/05_logging.cfg +## This yaml formatted config file handles setting +## logger information. The values that are necessary to be set +## are seen at the bottom. The top '_log' are only used to remove +## redundancy in a syslog and fallback-to-file case. +## +## The 'log_cfgs' entry defines a list of logger configs +## Each entry in the list is tried, and the first one that +## works is used. If a log_cfg list entry is an array, it will +## be joined with '\n'. +_log: + - &log_base | + [loggers] + keys=root,cloudinit + + [handlers] + keys=consoleHandler,cloudLogHandler + + [formatters] + keys=simpleFormatter,arg0Formatter + + [logger_root] + level=DEBUG + handlers=consoleHandler,cloudLogHandler + + [logger_cloudinit] + level=DEBUG + qualname=cloudinit + handlers= + propagate=1 + + [handler_consoleHandler] + class=StreamHandler + level=WARNING + formatter=arg0Formatter + args=(sys.stderr,) + + [formatter_arg0Formatter] + format=%(asctime)s - %(filename)s[%(levelname)s]: %(message)s + + [formatter_simpleFormatter] + format=[CLOUDINIT] %(filename)s[%(levelname)s]: %(message)s + - &log_file | + [handler_cloudLogHandler] + class=FileHandler + level=DEBUG + formatter=arg0Formatter + args=('/var/log/cloud-init.log', 'a', 'UTF-8') + - &log_syslog | + [handler_cloudLogHandler] + class=handlers.SysLogHandler + level=DEBUG + formatter=simpleFormatter + args=("/dev/log", handlers.SysLogHandler.LOG_USER) + +log_cfgs: +# Array entries in this list will be joined into a string +# that defines the configuration. +# +# If you want logs to go to syslog, uncomment the following line. +# - [ *log_base, *log_syslog ] +# +# The default behavior is to just log to a file. +# This mechanism that does not depend on a system service to operate. + - [ *log_base, *log_file ] +# A file path can also be used. +# - /etc/log.conf + +# This tells cloud-init to redirect its stdout and stderr to +# 'tee -a /var/log/cloud-init-output.log' so the user can see output +# there without needing to look on the console. +output: {all: '| tee -a /var/log/cloud-init-output.log'} +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/20-disable-cc-dpkg-grub.cfg +grub_dpkg: + enabled: false +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/90_dpkg.cfg +# to update this file, run dpkg-reconfigure cloud-init +datasource_list: [ NoCloud, ConfigDrive, OpenNebula, DigitalOcean, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, SmartOS, Bigstep, Scaleway, AliYun, Ec2, CloudStack, Hetzner, IBMCloud, Oracle, Exoscale, RbxCloud, UpCloud, VMware, Vultr, LXD, NWCS, Akamai, WSL, None ] +``` + +``` +$ sudo cat /etc/cloud/cloud.cfg.d/90-installer-network.cfg +[sudo] password for automat: +# This is the network config written by 'subiquity' +network: + ethernets: + enp1s0: + dhcp4: true + version: 2 +``` + +``` +$ sudo cat /etc/cloud/cloud.cfg.d/99-installer.cfg +datasource: + None: + metadata: + instance-id: 8f24aaf6-e801-4314-ab4d-140cf7903665 + userdata_raw: "#cloud-config\ngrowpart:\n mode: 'off'\nlocale: en_US.UTF-8\n\ + preserve_hostname: true\nresize_rootfs: false\ntimezone: America/Los_Angeles\n\ + users:\n- gecos: automat\n groups: adm,cdrom,dip,lpadmin,plugdev,sudo,users\n\ + \ lock_passwd: false\n name: automat\n passwd: $6$40T70sujp2hUJyd9$IlfKZwMFKEmsGuG.xCYtmO3iUTWqPcg1erpNuaD3qd3xPq9U09ON5J3lZX8zkqAOWOx/IteCJgD3/m8ddLFv.1\n\ + \ shell: /bin/bash\nwrite_files:\n- content: \"Disabled by Ubuntu live installer\ + \ after first boot.\\nTo re-enable cloud-init\\\n \\ on this image run:\\\ + n sudo cloud-init clean --machine-id\\n\"\n defer: true\n path: /etc/cloud/cloud-init.disabled\n" +datasource_list: +- None +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/curtin-preserve-sources.cfg +apt: + preserve_sources_list: true +``` + +``` +$ cat /etc/cloud/cloud.cfg.d/README +# All files with the '.cfg' extension in this directory will be read by +# cloud-init. They are read in lexical order. Later files overwrite values in +# earlier files. +``` + References: https://www.pugetsystems.com/labs/hpc/ubuntu-22-04-server-autoinstall-iso/