Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update.conf with quoted MACHINE_ALIAS breaks update_engine #1209

Closed
zeeZ opened this issue Oct 11, 2023 · 3 comments · Fixed by flatcar/scripts#1265
Closed

update.conf with quoted MACHINE_ALIAS breaks update_engine #1209

zeeZ opened this issue Oct 11, 2023 · 3 comments · Fixed by flatcar/scripts#1265
Labels
kind/bug Something isn't working

Comments

@zeeZ
Copy link

zeeZ commented Oct 11, 2023

The Nebraska documentation gives the following example for /etc/flatcar/update.conf:

MACHINE_ALIAS="myhost a.b.c"

This results in the following request being logged in omaha_request_action.cc:

<?xml version="1.0" encoding="UTF-8"?>
<request protocol="3.0" version="update_engine-0.4.10" updaterversion="update_engine-0.4.10" installsource="ondemandupdate" ismachine="1">
    <os version="Chateau" platform="CoreOS" sp="3732.1.0_x86_64"></os>
    <app appid="{e96281a6-d1af-4bde-9a0a-97b76e56dc57}" version="3732.1.0" track="beta" bootid="{ef3c8c1c-5cee-4f03-87db-13903ab7f866}" oem="vmware" oemversion="11.1.5" alephversion="2135.6.0" machineid="06fe98d2a89248b6a2542ef2bcb8c16a" machinealias=""myhost a.b.c"" lang="en-US" board="amd64-usr" hardware_class="" delta_okay="false" >
        <ping active="1"></ping>
        <updatecheck></updatecheck>
        <event eventtype="3" eventresult="2" previousversion=""></event>
    </app>
</request>

Note the invalid XML due to duplicate quotes:

machinealias=""myhost a.b.c""

When setting MACHINE_ALIAS without quotes the update process works, even though the documentation implies that quotes are required when using whitespace. Doing so breaks motdgen.service instead, however.

Observed in 3602.2.0 stable and 3732.1.0 beta

@tormath1
Copy link
Contributor

Hello, thanks for the issue. I can reproduce:

$ cat /etc/flatcar/update.conf
MACHINE_ALIAS="test tormath1"
$ journalctl -u update-engine
...
Oct 12 08:57:51 localhost update_engine[1163]:     <app appid="{e96281a6-d1af-4bde-9a0a-97b76e56dc57}" version="3745.0.0" track="alpha" bootid="{8fc81dec-a8c5-4bdd-b157-a394b0e444d3}" oem="qemu" oemversion="0.0.2" alephversion="3745.0.0" machineid="2c3c1e7691dd4690a4c78267baf5fdb9" machinealias=""test tormath1"" lang="en-US" board="amd64-usr" hardware_class="" delta_okay="false" >
...
Oct 12 08:57:51 localhost update_engine[1163]: E1012 08:57:51.456182  1163 omaha_request_action.cc:625] HTTP reported success but Omaha reports an error.

While it works with MACHINE_ALIAS=test tormath1

Oct 12 08:59:49 localhost update_engine[1163]:     <app appid="{e96281a6-d1af-4bde-9a0a-97b76e56dc57}" version="3745.0.0" track="alpha" bootid="{8fc81dec-a8c5-4bdd-b157-a394b0e444d3}" oem="qemu" oemversion="0.0.2" alephversion="3745.0.0" machineid="2c3c1e7691dd4690a4c78267baf5fdb9" machinealias="test tormath1" lang="en-US" board="amd64-usr" hardware_class="" delta_okay="false" >
...
Oct 12 08:59:49 localhost update_engine[1163]: <response protocol="3.0" server="nebraska"><daystart elapsed_seconds="0"></daystart><app appid="{e96281a6-d1af-4bde-9a0a-97b76e56dc57}" status="ok"><ping status="ok"></ping><updatecheck status="noupdate"><urls></urls></updatecheck><event status="ok"></event></app></response>

but then motdgen.service is failing:

Oct 12 09:00:39 localhost motdgen[1334]: /etc/flatcar/update.conf: line 1: tormath1: command not found

because it can't source correctly the file:

$ source /etc/flatcar/update.conf
-bash: tormath1: command not found

It seems that using single quote makes both happy:

$ cat /etc/flatcar/update.conf
MACHINE_ALIAS='test tormath1'
$ journalctl -u update-engine 
Oct 12 09:08:08 localhost update_engine[1163]:     <app appid="{e96281a6-d1af-4bde-9a0a-97b76e56dc57}" version="3745.0.0" track="alpha" bootid="{8fc81dec-a8c5-4bdd-b157-a394b0e444d3}" oem="qemu" oemversion="0.0.2" alephversion="3745.0.0" machineid="2c3c1e7691dd4690a4c78267baf5fdb9" machinealias="'test tormath1'" lang="en-US" board="amd64-usr" hardware_class="" delta_okay="false" >
...
Oct 12 09:08:08 localhost update_engine[1163]: <response protocol="3.0" server="nebraska"><daystart elapsed_seconds="0"></daystart><app appid="{e96281a6-d1af-4bde-9a0a-97b76e56dc57}" status="ok"><ping status="ok"></ping><updatecheck status="noupdate"><urls></urls></updatecheck><event status="ok"></event></app></response>
$ source /etc/flatcar/update.conf
$ echo $MACHINE_ALIAS
test tormath1

@crinjes
Copy link

crinjes commented Oct 12, 2023

While single quotes do technically work as a workaround, they are then treated as part of the alias:
image

The proper solution would be to fix the handling of quotes in the omaha request.

@tormath1
Copy link
Contributor

Quickly looking at the Omaha side, it seems correct: it just decodes an XML payload https://github.com/flatcar/nebraska/blob/c5919755d256166312612c94f3d0c7eae6ac0d2c/backend/pkg/omaha/omaha.go#L59.

I think it should be fixed on the update-engine side: the extracting of the value from update.conf files should ignore the quote/double-quote symbol if they start/end the value to later build a proper XML request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants