Bug 2179056 - [leapp] Failed to read machine ID from container image: Invalid argument
Summary: [leapp] Failed to read machine ID from container image: Invalid argument
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: leapp-repository
Version: 7.9
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Leapp Notifications Bot
QA Contact: upgrades-and-conversions
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-16 14:22 UTC by Christophe Besson
Modified: 2023-07-31 07:12 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker OAMG-8715 0 None None None 2023-03-16 14:23:43 UTC
Red Hat Issue Tracker RHELPLAN-152093 0 None None None 2023-03-16 14:23:31 UTC
Red Hat Knowledge Base (Solution) 7003087 0 None None None 2023-03-16 14:22:29 UTC

Description Christophe Besson 2023-03-16 14:22:30 UTC
Description of problem:
If the /etc/machine-id file is not well-formed, systemd-nspawn used by leapp exits with a -1 return code, leading to the emergency shell. This is harmless as it happens very early and the system is untouched.

Version-Release number of selected component (if applicable):
leapp-upgrade-el7toel8-0.17.0-1.el7_9

How reproducible:
Always

Steps to Reproduce:
1. echo >> /etc/machine-id
2. leapp upgrade

Actual results:
[    2.462635] upgrade[691]: Failed to read machine ID from container image: Invalid argument
[    2.476214] upgrade[690]: (sd-namespace) failed with exit status 1.

Expected results:
Possibly an inhibitor.

Additional info:
* Never observed such an issue, hence very low sev. This file should not have been touched (by a human or a script).
* Probably the same for IPU 8>9.
* The KCS I linked could be enough.
* Some systemd-nspawn excerpt:

	systemd-239/src/nspawn/nspawn.c:
	2187 static int setup_machine_id(const char *directory) {
	 :
	2198 
	2199         etc_machine_id = prefix_roota(directory, "/etc/machine-id");
	2200 
	2201         r = id128_read(etc_machine_id, ID128_PLAIN, &id);
	2202         if (r < 0) {
	2203                 if (!IN_SET(r, -ENOENT, -ENOMEDIUM)) /* If the file is missing or empty, we don't mind */
	2204                         return log_error_errno(r, "Failed to read machine ID from container image: %m");

	systemd-239/src/libsystemd/sd-id128/id128-util.c:
	 82 int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret) {
	 :
	102         case 33: /* plain UUID with trailing newline */
	103                 if (buffer[32] != '\n')
	104                         return -EINVAL;
	105 
	106                 _fallthrough_;
	107         case 32: /* plain UUID without trailing newline */
	108                 if (f == ID128_UUID)
	109                         return -EINVAL;
	110 
	111                 buffer[32] = 0;
	112                 break;
	113 
	114         case 37: /* RFC UUID with trailing newline */
	115                 if (buffer[36] != '\n')
	116                         return -EINVAL;
	117 
	118                 _fallthrough_;
	119         case 36: /* RFC UUID without trailing newline */
	120                 if (f == ID128_PLAIN)
	121                         return -EINVAL;


Note You need to log in before you can comment on or make changes to this bug.