diff options
authorDermot Bradley <dermot_bradley@yahoo.com>2020-11-26 01:23:39 +0000
committerLeo <thinkabit.ukim@gmail.com>2020-11-26 09:18:08 +0000
commit4749dce063928a4ffb8b41839b46f961d97dc12f (patch)
parent23de4dc47baa35c3af6cbc3dd1c39940e0025e57 (diff)
community/cloud-init: correct template file, add notes, reduce dependencies
Correct template file for /etc/hosts to order short hostnames first. Add extra usage notes to README file. Remove py3-oauthlib and util-linux dependencies.
4 files changed, 131 insertions, 4 deletions
diff --git a/community/cloud-init/01-oauthlib-remove.patch b/community/cloud-init/01-oauthlib-remove.patch
new file mode 100644
index 0000000000..af65255bff
--- /dev/null
+++ b/community/cloud-init/01-oauthlib-remove.patch
@@ -0,0 +1,24 @@
+From: Dermot Bradley <dermot_bradley@yahoo.com>
+Date: Thu, 19 Nov 2020 22:34 +0000
+Subject: [PATCH] cloud-init: Remove oauthlib from requirements.txt
+oauthlib is only used by the MAAS datasource. Remove it from the Python
+requirements.txt file in order to reduce package dependencies. If someone
+wishes to use the MAAS datasource they can simply add the py3-oauthlib
+diff -aur a/requirements.txt b/requirements.txt
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -5,7 +5,8 @@
+ # This one is currently only used by the MAAS datasource. If that
+ # datasource is removed, this is no longer needed
++# oauthlib
+ # This one is currently used only by the CloudSigma and SmartOS datasources.
+ # If these datasources are removed, this is no longer needed.
diff --git a/community/cloud-init/02-hosts-template-fix.patch b/community/cloud-init/02-hosts-template-fix.patch
new file mode 100644
index 0000000000..d6e04e15a0
--- /dev/null
+++ b/community/cloud-init/02-hosts-template-fix.patch
@@ -0,0 +1,35 @@
+From: Dermot Bradley <dermot_bradley@yahoo.com>
+Date: Sat, 21 Nov 2020 16:52 +0000
+Subject: [PATCH] cloud-init: Change order of entries in /etc/hosts
+The Alpine /etc/hosts template results in a file where the long form of
+names (including localhost) come before the short form. This means that
+when running tools like 'netstat' and 'ss' which convert IP address to
+names that their output will show 'localhost.localdomain' rather than
+'localhost.' This patch swaps the order of the short and long form names
+so such utils will show the short form name.
+diff -aur a/templates/hosts.alpine.tmpl b/templates/hosts.alpine.tmpl
+--- a/templates/hosts.alpine.tmpl
++++ b/templates/hosts.alpine.tmpl
+@@ -13,13 +13,13 @@
+ # /etc/cloud/cloud.cfg or cloud-config from user-data
+ #
+ # The following lines are desirable for IPv4 capable hosts
+- {{fqdn}} {{hostname}}
+- localhost.localdomain localhost
+- localhost4.localdomain4 localhost4
++ {{hostname}} {{fqdn}}
++ localhost localhost.localdomain
++ localhost4 localhost4.localdomain4
+ # The following lines are desirable for IPv6 capable hosts
+-::1 {{fqdn}} {{hostname}}
+-::1 localhost6.localdomain6 localhost6
++::1 {{hostname}} {{fqdn}}
++::1 localhost6 localhost6.localdomain6
+ fe00::0 ip6-localnet
+ ff00::0 ip6-mcastprefix
diff --git a/community/cloud-init/APKBUILD b/community/cloud-init/APKBUILD
index 365745e2c1..2d0671779e 100644
--- a/community/cloud-init/APKBUILD
+++ b/community/cloud-init/APKBUILD
@@ -23,16 +23,16 @@ depends="
- py3-oauthlib
- util-linux
subpackages="$pkgname-doc $pkgname-bash-completion $pkgname-openrc"
+ 01-oauthlib-remove.patch
+ 02-hosts-template-fix.patch
@@ -90,6 +90,8 @@ package() {
sha512sums="c5acf4843504a20d1d0d92c42dceb82b2b979af9e105ad9a84a60732dcde9335af4535cb1fd21a45914a37b8d93e0a0a6b899c05ab5eb1fc34d6cc24f490dc83 cloud-init-20.4.tar.gz
+c14ce3b27c55d1c381e27b2898bb73da8a74c53480d496bdfc87318b69fb612678205ab5a686c1ce703ef5c2c7a8529f629c8f908aeff39524d36870a83c1929 01-oauthlib-remove.patch
+444b15f0d81138f7f3767bc10b0bee29ff10fa8b74dfc3542e1abe20d745f09bb2e36cb30ef8035a677ba81af80743207fbd9973d7cb4f33ca37891ae7493916 02-hosts-template-fix.patch
48b25ec4457c2b3772a7d210033551d041749a0d1869818d888030e6df7fd9bbc13a38b95cf465de3d46d96881a722f94a337584ce48f280c4a52b819586563a interfaces
f32b90f26d1df0d88fbea7a1a9ab6704a20babdb750b933484bb7c4e91cc19a587d4bfbc95489a354003ecd00795d1592e71b4b93eccd41e392bb7170bfebb0e setup-cloud-init
-3cfba05374bc13eb83c8cec03ae91e0bd0093643e5d9b66f12fb1d9dfd7a097534f989d7f6b1d42cf0acca5352f34b31271eeb63c265ea8e5f763c4bb7e85d32 README.Alpine"
+2a491afea3ea979d0910f0b21739ee3bfb902ddfe66a8162eb1dd477475c4185ac85afc6522e979015d966f4b984b151cb4b6515aec6ce6eaf7e13ac7def1b5f README.Alpine"
diff --git a/community/cloud-init/README.Alpine b/community/cloud-init/README.Alpine
index e1c8a524e3..302914c5cf 100644
--- a/community/cloud-init/README.Alpine
+++ b/community/cloud-init/README.Alpine
@@ -85,5 +85,71 @@ The remove-defaults option of the cloud-init cc_ca_certs module does not
currently work correctly. This option will delete certificates installed by
the Alpine ca-certificates package as expected. However the certificates
provided by the ca-certificates-bundle package, which is always automatically
-installed in an Alpine system due to it being a dependancy of a base package,
+installed in an Alpine system due to it being a dependency of a base package,
are not deleted.
+Using ISO images for cloud-init configuration (i.e. with NoCloud/ConfigDrive)
+With the removal of the util-linux dependency from the Alpine cloud-init
+package the "mount" command provided by Busybox will be used instead.
+Cloud-init makes use of the mount command's "-t auto" option to mount a
+filesystem containing cloud-init configuration data (detected by searching
+for a filesystem with the label "cidata"). Busybox's mount command behaves
+differently that of util-linux's when the "-t auto" option is used,
+specifically if the kernel module for the required filesystem is not already
+loaded the util-linux mount command will trigger it to be loaded and so the
+mount will succeed. However Busybox's mount will not normally trigger a kernel
+module load and the mount will fail!
+When this problem occurs the following will be displayed on the console
+during boot:
+ util.py[WARNING]: Failed to mount /dev/vdb when looking for data
+If cloud-init debugging is enabled then the file /var/log/cloud-init.log will
+also contain the following entries:
+ subp.py[DEBUG]: Running command ['mount', '-o', 'ro', '-t', 'auto',
+ '/dev/vdb', '/run/cloud-init/tmp/tmpAbCdEf'] with allowed return codes [0]
+ (shell=False, capture=True)
+ util.py[DEBUG]: Failed mount of '/dev/vdb' as 'auto': Unexpected error
+ while running command.
+ Command: ['mount', '-o', 'ro', '-t', 'auto', '/dev/vdb',
+ '/run/cloud-init/tmp/tmpAbCdEf']
+ Exit code: 255
+ Reason: -
+ Stdout:
+ Stderr: mount: mounting /dev/vdb on /run/cloud-init/tmp/tmpAbCdEf failed:
+ invalid argument
+There are 2 possible solutions to this issue, either:
+(1) Install the util-linux package into the Alpine image used with
+(2) Create (or modify) the file /etc/filesystem and ensure it has a line
+present with the name of the required kernel module for the relevant filesystem
+i.e. "iso9660". This will ensure that Busybox's mount will trigger the loading
+of this kernel module.
+CloudSigma and SmartOS data sources
+If you are using either the CloudSigma or SmartOS/Joyent Cloud data sources
+then you will need to install the Alpine py3-serial package. This was removed
+as a cloud-init (hard) dependency as it is only used by these two uncommon
+Data Sources.
+MAAS data source
+If you are using the MAAS data source then you will need to install the
+Alpine py3-oauthlib package. This was removed as a cloud-init (hard)
+dependency as it is only used by the MAAS Data Source.