Activity log for bug #2064132

Date Who What changed Old value New value Message
2024-04-29 15:04:29 Chad Smith bug added bug
2024-04-29 15:05:36 Chad Smith bug watch added https://github.com/canonical/cloud-init/issues/5143
2024-04-29 15:08:00 Chad Smith cloud-init (Ubuntu): status New Fix Committed
2024-04-29 15:08:03 Chad Smith cloud-init (Ubuntu): assignee Chad Smith (chad.smith)
2024-04-29 19:18:48 Chad Smith description In Ubuntu images that do not have snapd debian package installed launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log [ Impact ] * SRU of cloud-init 24.1.3 to Focal, Jammy and Mantic introduced a regression where cloud-init will attempt to call `snap refresh` on new Ubuntu instance launches the Ubuntu image does not contain snapd deb package installed and optional #cloud-config user-data is provided which contains `upgrade_packages: true`. * Such optional user-data on custom ubuntu images will result in cloud-init exiting in error condition as seen from cloud-init status due to the following error message: - ('package_update_upgrade_install', ProcessExecutionError("Unexpected error while running command.\nCommand: ['snap', 'refresh']\nExit code: -\nReason: [Errno 2] No such file or directory: b'snap'\nStdout: -\nStderr: -")) This only affects new custom Ubuntu image launches where both of the following conditions are met: 1. image is a custom ubuntu image which does not contain snapd deb package 2. At instance launch, optional #cloud-config user-data contains `package_upgrade: true` Ubuntu cloudimages published by Canonical for Focal, Jammy and Mantic all currently snapd deb package. And even for custom Ubuntu images without snapd installed, only when package operations are provided via #cloud-config is the instance launch affected. [ Test Plan ] * # launch ubuntu cloud images in LXC, remove snapd, provide "#cloud-config\npackage_upgrade:true" as user-data and clean reboot to force cloud-init to attempt to upgrade any package managers (snap and apt) where applicable. * confirm no snap command present in image * check cloud-init status --format=yaml to ensure no errors * grep snap.*refresh /var/log/cloud-init.log to assert no stray snap refresh is attempted on an image without snap #!/bin/bash lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log [ Where problems could occur ] The bug above is an unwanted error log that results in cloud-init reporting an error state and non-zero exit code. The error log doesn't erode the actual final configuration applied to the machine, it just sets a state we don't wont to see as cloud-init shouldn't be trying and failing to run snap command if it doesn't exist in the environment. Given that this fix is only performing a subp.which("snap") to assert that the snap command exists in the path before attempting to run "snap refresh" regression potential is negligible. In the unlikely event that the code paths added do fail here, the regression impact woud only result in a slightly different error log that also doesn't impact the overall config applied to the instance at launch. [ Other Info ] ==== original description ==== In Ubuntu images that do not have snapd deb package installed, launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.logb
2024-04-29 19:23:46 Chad Smith description [ Impact ] * SRU of cloud-init 24.1.3 to Focal, Jammy and Mantic introduced a regression where cloud-init will attempt to call `snap refresh` on new Ubuntu instance launches the Ubuntu image does not contain snapd deb package installed and optional #cloud-config user-data is provided which contains `upgrade_packages: true`. * Such optional user-data on custom ubuntu images will result in cloud-init exiting in error condition as seen from cloud-init status due to the following error message: - ('package_update_upgrade_install', ProcessExecutionError("Unexpected error while running command.\nCommand: ['snap', 'refresh']\nExit code: -\nReason: [Errno 2] No such file or directory: b'snap'\nStdout: -\nStderr: -")) This only affects new custom Ubuntu image launches where both of the following conditions are met: 1. image is a custom ubuntu image which does not contain snapd deb package 2. At instance launch, optional #cloud-config user-data contains `package_upgrade: true` Ubuntu cloudimages published by Canonical for Focal, Jammy and Mantic all currently snapd deb package. And even for custom Ubuntu images without snapd installed, only when package operations are provided via #cloud-config is the instance launch affected. [ Test Plan ] * # launch ubuntu cloud images in LXC, remove snapd, provide "#cloud-config\npackage_upgrade:true" as user-data and clean reboot to force cloud-init to attempt to upgrade any package managers (snap and apt) where applicable. * confirm no snap command present in image * check cloud-init status --format=yaml to ensure no errors * grep snap.*refresh /var/log/cloud-init.log to assert no stray snap refresh is attempted on an image without snap #!/bin/bash lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log [ Where problems could occur ] The bug above is an unwanted error log that results in cloud-init reporting an error state and non-zero exit code. The error log doesn't erode the actual final configuration applied to the machine, it just sets a state we don't wont to see as cloud-init shouldn't be trying and failing to run snap command if it doesn't exist in the environment. Given that this fix is only performing a subp.which("snap") to assert that the snap command exists in the path before attempting to run "snap refresh" regression potential is negligible. In the unlikely event that the code paths added do fail here, the regression impact woud only result in a slightly different error log that also doesn't impact the overall config applied to the instance at launch. [ Other Info ] ==== original description ==== In Ubuntu images that do not have snapd deb package installed, launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.logb [ Impact ]  * SRU of cloud-init 24.1.3 to Focal, Jammy and Mantic introduced a regression where cloud-init will attempt to call `snap refresh` on new Ubuntu instance launches if the Ubuntu image does not contain snapd deb package and optional #cloud-config user-data is provided which contains `upgrade_packages: true`.  * Such optional user-data on custom ubuntu images will result in cloud-init exiting in error condition as seen from cloud-init status due to the following error message:  - ('package_update_upgrade_install', ProcessExecutionError("Unexpected error while running command.\nCommand: ['snap', 'refresh']\nExit code: -\nReason: [Errno 2] No such file or directory: b'snap'\nStdout: -\nStderr: -")) This only affects new custom Ubuntu image launches where both of the following conditions are met: 1. image is a custom ubuntu image which does not contain snapd deb package 2. At instance launch, optional #cloud-config user-data contains `package_upgrade: true` Ubuntu cloudimages published by Canonical for Focal, Jammy and Mantic all currently have the snapd deb package installed. Even for custom Ubuntu images without snapd deb package installed, this issue is only triggered when #cloud-config contains the optional `package_upgrade: true` during instance launch. This error log does cause cloud-init status to exit non-zero, but it doesn't affect the integrity of the configuration applied to the system. It is just an undesirable error log message for an unsupported (snap) package manager within the environment. [ Test Plan ]  * # launch ubuntu cloud images in LXC, remove snapd, provide "#cloud-config\npackage_upgrade:true" as user-data and clean reboot to force cloud-init to attempt to upgrade any package managers (snap and apt) where applicable.  * confirm no snap command present in image  * check cloud-init status --format=yaml to ensure no errors  * grep snap.*refresh /var/log/cloud-init.log to assert no stray snap refresh is attempted on an image without snap #!/bin/bash lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log [ Where problems could occur ] The bug above is an unwanted error log that results in cloud-init reporting an error state and non-zero exit code. The error log doesn't erode the actual final configuration applied to the machine, it just sets a state we don't wont to see as cloud-init shouldn't be trying and failing to run snap command if it doesn't exist in the environment. Given that this fix is only performing a subp.which("snap") to assert that the snap command exists in the path before attempting to run "snap refresh" regression potential is negligible. In the unlikely event that the code paths added do fail here, the regression impact woud only result in a slightly different error log that also doesn't impact the overall config applied to the instance at launch. [ Other Info ] ==== original description ==== In Ubuntu images that do not have snapd deb package installed, launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.logb
2024-04-29 19:44:14 Chad Smith tags regression-update
2024-04-29 20:05:51 Chad Smith nominated for series Ubuntu Noble
2024-04-29 20:05:51 Chad Smith bug task added cloud-init (Ubuntu Noble)
2024-04-29 20:05:51 Chad Smith nominated for series Ubuntu Mantic
2024-04-29 20:05:51 Chad Smith bug task added cloud-init (Ubuntu Mantic)
2024-04-29 20:05:51 Chad Smith nominated for series Ubuntu Jammy
2024-04-29 20:05:51 Chad Smith bug task added cloud-init (Ubuntu Jammy)
2024-04-29 20:05:51 Chad Smith nominated for series Ubuntu Focal
2024-04-29 20:05:51 Chad Smith bug task added cloud-init (Ubuntu Focal)
2024-05-02 19:47:33 Andreas Hasenack cloud-init (Ubuntu): status Fix Committed Confirmed
2024-05-02 19:47:39 Andreas Hasenack nominated for series Ubuntu Oracular
2024-05-02 19:47:39 Andreas Hasenack bug task added cloud-init (Ubuntu Oracular)
2024-05-02 20:32:51 Andreas Hasenack cloud-init (Ubuntu Noble): status New Fix Committed
2024-05-02 20:32:53 Andreas Hasenack bug added subscriber Ubuntu Stable Release Updates Team
2024-05-02 20:32:57 Andreas Hasenack bug added subscriber SRU Verification
2024-05-02 20:33:00 Andreas Hasenack tags verification-needed verification-needed-noble
2024-05-02 20:33:38 Andreas Hasenack cloud-init (Ubuntu Mantic): status New Fix Committed
2024-05-02 20:33:44 Andreas Hasenack tags verification-needed verification-needed-noble verification-needed verification-needed-mantic verification-needed-noble
2024-05-02 20:34:39 Andreas Hasenack cloud-init (Ubuntu Jammy): status New Fix Committed
2024-05-02 20:34:45 Andreas Hasenack tags verification-needed verification-needed-mantic verification-needed-noble verification-needed verification-needed-jammy verification-needed-mantic verification-needed-noble
2024-05-02 20:35:34 Andreas Hasenack cloud-init (Ubuntu Focal): status New Fix Committed
2024-05-02 20:35:41 Andreas Hasenack tags verification-needed verification-needed-jammy verification-needed-mantic verification-needed-noble verification-needed verification-needed-focal verification-needed-jammy verification-needed-mantic verification-needed-noble
2024-05-03 19:06:21 Chad Smith description [ Impact ]  * SRU of cloud-init 24.1.3 to Focal, Jammy and Mantic introduced a regression where cloud-init will attempt to call `snap refresh` on new Ubuntu instance launches if the Ubuntu image does not contain snapd deb package and optional #cloud-config user-data is provided which contains `upgrade_packages: true`.  * Such optional user-data on custom ubuntu images will result in cloud-init exiting in error condition as seen from cloud-init status due to the following error message:  - ('package_update_upgrade_install', ProcessExecutionError("Unexpected error while running command.\nCommand: ['snap', 'refresh']\nExit code: -\nReason: [Errno 2] No such file or directory: b'snap'\nStdout: -\nStderr: -")) This only affects new custom Ubuntu image launches where both of the following conditions are met: 1. image is a custom ubuntu image which does not contain snapd deb package 2. At instance launch, optional #cloud-config user-data contains `package_upgrade: true` Ubuntu cloudimages published by Canonical for Focal, Jammy and Mantic all currently have the snapd deb package installed. Even for custom Ubuntu images without snapd deb package installed, this issue is only triggered when #cloud-config contains the optional `package_upgrade: true` during instance launch. This error log does cause cloud-init status to exit non-zero, but it doesn't affect the integrity of the configuration applied to the system. It is just an undesirable error log message for an unsupported (snap) package manager within the environment. [ Test Plan ]  * # launch ubuntu cloud images in LXC, remove snapd, provide "#cloud-config\npackage_upgrade:true" as user-data and clean reboot to force cloud-init to attempt to upgrade any package managers (snap and apt) where applicable.  * confirm no snap command present in image  * check cloud-init status --format=yaml to ensure no errors  * grep snap.*refresh /var/log/cloud-init.log to assert no stray snap refresh is attempted on an image without snap #!/bin/bash lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log [ Where problems could occur ] The bug above is an unwanted error log that results in cloud-init reporting an error state and non-zero exit code. The error log doesn't erode the actual final configuration applied to the machine, it just sets a state we don't wont to see as cloud-init shouldn't be trying and failing to run snap command if it doesn't exist in the environment. Given that this fix is only performing a subp.which("snap") to assert that the snap command exists in the path before attempting to run "snap refresh" regression potential is negligible. In the unlikely event that the code paths added do fail here, the regression impact woud only result in a slightly different error log that also doesn't impact the overall config applied to the instance at launch. [ Other Info ] ==== original description ==== In Ubuntu images that do not have snapd deb package installed, launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.logb [ Impact ]  * SRU of cloud-init 24.1.3 to Focal, Jammy and Mantic introduced a regression where cloud-init will attempt to call `snap refresh` on new Ubuntu instance launches if the Ubuntu image does not contain snapd deb package and optional #cloud-config user-data is provided which contains `upgrade_packages: true`.  * Such optional user-data on custom ubuntu images will result in cloud-init exiting in error condition as seen from cloud-init status due to the following error message:  - ('package_update_upgrade_install', ProcessExecutionError("Unexpected error while running command.\nCommand: ['snap', 'refresh']\nExit code: -\nReason: [Errno 2] No such file or directory: b'snap'\nStdout: -\nStderr: -")) This only affects new custom Ubuntu image launches where both of the following conditions are met: 1. image is a custom ubuntu image which does not contain snapd deb package 2. At instance launch, optional #cloud-config user-data contains `package_upgrade: true` Ubuntu cloudimages published by Canonical for Focal, Jammy and Mantic all currently have the snapd deb package installed. Even for custom Ubuntu images without snapd deb package installed, this issue is only triggered when #cloud-config contains the optional `package_upgrade: true` during instance launch. This error log does cause cloud-init status to exit non-zero, but it doesn't affect the integrity of the configuration applied to the system. It is just an undesirable error log message for an unsupported (snap) package manager within the environment. [ Test Plan ]  * # launch ubuntu cloud images in LXC, remove snapd, provide "#cloud-config\npackage_upgrade:true" as user-data and clean reboot to force cloud-init to attempt to upgrade any package managers (snap and apt) where applicable.  * confirm no snap command present in image  * check cloud-init status --format=yaml to ensure no errors  * grep snap.*refresh /var/log/cloud-init.log to assert no stray snap refresh is attempted on an image without snap #!/bin/bash SERIES=$1 cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc launch ubuntu-daily:$SERIES test-no-snap -c cloud-init.user-data="$(cat pkg-update.yaml)" sleep 3 lxc exec test-no-snap -- cloud-init status --wait # assert snap refresh is called on system with snapd lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log lxc exec test-no-snap -- apt remove snapd -y lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log [ Where problems could occur ] The bug above is an unwanted error log that results in cloud-init reporting an error state and non-zero exit code. The error log doesn't erode the actual final configuration applied to the machine, it just sets a state we don't wont to see as cloud-init shouldn't be trying and failing to run snap command if it doesn't exist in the environment. Given that this fix is only performing a subp.which("snap") to assert that the snap command exists in the path before attempting to run "snap refresh" regression potential is negligible. In the unlikely event that the code paths added do fail here, the regression impact woud only result in a slightly different error log that also doesn't impact the overall config applied to the instance at launch. [ Other Info ] ==== original description ==== In Ubuntu images that do not have snapd deb package installed, launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.logb
2024-05-03 19:20:23 Chad Smith description [ Impact ]  * SRU of cloud-init 24.1.3 to Focal, Jammy and Mantic introduced a regression where cloud-init will attempt to call `snap refresh` on new Ubuntu instance launches if the Ubuntu image does not contain snapd deb package and optional #cloud-config user-data is provided which contains `upgrade_packages: true`.  * Such optional user-data on custom ubuntu images will result in cloud-init exiting in error condition as seen from cloud-init status due to the following error message:  - ('package_update_upgrade_install', ProcessExecutionError("Unexpected error while running command.\nCommand: ['snap', 'refresh']\nExit code: -\nReason: [Errno 2] No such file or directory: b'snap'\nStdout: -\nStderr: -")) This only affects new custom Ubuntu image launches where both of the following conditions are met: 1. image is a custom ubuntu image which does not contain snapd deb package 2. At instance launch, optional #cloud-config user-data contains `package_upgrade: true` Ubuntu cloudimages published by Canonical for Focal, Jammy and Mantic all currently have the snapd deb package installed. Even for custom Ubuntu images without snapd deb package installed, this issue is only triggered when #cloud-config contains the optional `package_upgrade: true` during instance launch. This error log does cause cloud-init status to exit non-zero, but it doesn't affect the integrity of the configuration applied to the system. It is just an undesirable error log message for an unsupported (snap) package manager within the environment. [ Test Plan ]  * # launch ubuntu cloud images in LXC, remove snapd, provide "#cloud-config\npackage_upgrade:true" as user-data and clean reboot to force cloud-init to attempt to upgrade any package managers (snap and apt) where applicable.  * confirm no snap command present in image  * check cloud-init status --format=yaml to ensure no errors  * grep snap.*refresh /var/log/cloud-init.log to assert no stray snap refresh is attempted on an image without snap #!/bin/bash SERIES=$1 cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc launch ubuntu-daily:$SERIES test-no-snap -c cloud-init.user-data="$(cat pkg-update.yaml)" sleep 3 lxc exec test-no-snap -- cloud-init status --wait # assert snap refresh is called on system with snapd lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log lxc exec test-no-snap -- apt remove snapd -y lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.log [ Where problems could occur ] The bug above is an unwanted error log that results in cloud-init reporting an error state and non-zero exit code. The error log doesn't erode the actual final configuration applied to the machine, it just sets a state we don't wont to see as cloud-init shouldn't be trying and failing to run snap command if it doesn't exist in the environment. Given that this fix is only performing a subp.which("snap") to assert that the snap command exists in the path before attempting to run "snap refresh" regression potential is negligible. In the unlikely event that the code paths added do fail here, the regression impact woud only result in a slightly different error log that also doesn't impact the overall config applied to the instance at launch. [ Other Info ] ==== original description ==== In Ubuntu images that do not have snapd deb package installed, launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.logb [ Impact ]  * SRU of cloud-init 24.1.3 to Focal, Jammy and Mantic introduced a regression where cloud-init will attempt to call `snap refresh` on new Ubuntu instance launches if the Ubuntu image does not contain snapd deb package and optional #cloud-config user-data is provided which contains `upgrade_packages: true`.  * Such optional user-data on custom ubuntu images will result in cloud-init exiting in error condition as seen from cloud-init status due to the following error message:  - ('package_update_upgrade_install', ProcessExecutionError("Unexpected error while running command.\nCommand: ['snap', 'refresh']\nExit code: -\nReason: [Errno 2] No such file or directory: b'snap'\nStdout: -\nStderr: -")) This only affects new custom Ubuntu image launches where both of the following conditions are met: 1. image is a custom ubuntu image which does not contain snapd deb package 2. At instance launch, optional #cloud-config user-data contains `package_upgrade: true` Ubuntu cloudimages published by Canonical for Focal, Jammy and Mantic all currently have the snapd deb package installed. Even for custom Ubuntu images without snapd deb package installed, this issue is only triggered when #cloud-config contains the optional `package_upgrade: true` during instance launch. This error log does cause cloud-init status to exit non-zero, but it doesn't affect the integrity of the configuration applied to the system. It is just an undesirable error log message for an unsupported (snap) package manager within the environment. [ Test Plan ]  * # launch ubuntu cloud images in LXC, remove snapd, provide "#cloud-config\npackage_upgrade:true" as user-data and clean reboot to force cloud-init to attempt to upgrade any package managers (snap and apt) where applicable.  * confirm no snap command present in image  * check cloud-init status --format=yaml to ensure no errors  * grep snap.*refresh /var/log/cloud-init.log to assert no stray snap refresh is attempted on an image without snap #!/bin/bash set -ex SERIES=$1 cat > pkg-update.yaml <<EOF #cloud-config package_upgrade: true EOF cat > setup_proposed.sh <<EOF #/bin/bash mirror=http://archive.ubuntu.com/ubuntu echo deb \$mirror \$(lsb_release -sc)-proposed main | tee /etc/apt/sources.list.d/proposed.list apt-get update -q apt-get install -qy cloud-init EOF for SERIES in "focal" "jammy" "mantic"; do echo "---------- SRU verification: $SERIES" name=test-no-snap-$SERIES if [ "$SERIES" = "focal" ]; then LXC_CFG_KEY="user.user-data" else LXC_CFG_KEY="cloud-config.user-data" fi lxc launch ubuntu-daily:$SERIES $name -c $LXC_CFG_KEY="$(cat pkg-update.yaml)" sleep 3 lxc exec $name -- cloud-init status --wait # assert snap refresh is called on system with snapd lxc exec $name -- egrep 'snap.*refresh' /var/log/cloud-init.log && echo "SUCCESS: found snap refresh on system with snapd" || echo "FAILED: did not file snap refresh on system with snapd" lxc exec $name -- apt remove snapd -y lxc exec $name -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec $name -- cloud-init status --wait --format=yaml || echo "FAILED: errors or warning found" # ensure no calls to snap refresh lxc exec $name -- egrep 'snap.*refresh' /var/log/cloud-init.log || echo "SUCCESS: no snap refresh on system without snapd" && echo "FAILED: found snap refresh on system without snapd" done [ Where problems could occur ] The bug above is an unwanted error log that results in cloud-init reporting an error state and non-zero exit code. The error log doesn't erode the actual final configuration applied to the machine, it just sets a state we don't wont to see as cloud-init shouldn't be trying and failing to run snap command if it doesn't exist in the environment. Given that this fix is only performing a subp.which("snap") to assert that the snap command exists in the path before attempting to run "snap refresh" regression potential is negligible. In the unlikely event that the code paths added do fail here, the regression impact woud only result in a slightly different error log that also doesn't impact the overall config applied to the instance at launch. [ Other Info ] ==== original description ==== In Ubuntu images that do not have snapd deb package installed, launching with the following user-data triggers cloud-init to run `snap refresh` when that command doesn't exist. reproducer: lxc launch ubuntu-daily:jammy test-no-snap sleep 3 lxc exec test-no-snap -- cloud-init status --wait lxc exec test-no-snap -- apt remove snapd -y cat > pkg-update.yaml <<EOF #cloud-config package_update: true EOF lxc config set test-no-snap cloud-init.user-data="$(cat pkg-update.yaml)" lxc exec test-no-snap -- cloud-init clean --logs --reboot sleep 3 # expect no warnings/errors lxc exec test-no-snap -- cloud-init status --wait --format=yaml # ensure no calls to snap refresh lxc exec test-no-snap -- egrep 'snap.*refresh' /var/log/cloud-init.logb
2024-05-03 19:21:26 Chad Smith attachment added sru-2064132.sh https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2064132/+attachment/5774506/+files/sru-2064132.sh
2024-05-03 21:49:06 Chad Smith summary images without snapd installed error on `update_packages: true` user-data images without snapd installed error on `upgrade_packages: true` user-data
2024-05-03 22:10:01 Chad Smith attachment removed sru-2064132.sh https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2064132/+attachment/5774506/+files/sru-2064132.sh
2024-05-03 22:10:54 Chad Smith attachment added sru-2064132.sh https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2064132/+attachment/5774571/+files/sru-2064132.sh
2024-05-04 10:25:26 Launchpad Janitor cloud-init (Ubuntu Oracular): status Confirmed Fix Released
2024-05-06 12:18:57 Chad Smith tags verification-needed verification-needed-focal verification-needed-jammy verification-needed-mantic verification-needed-noble regression-proposed verification-needed verification-needed-focal verification-needed-jammy verification-needed-mantic verification-needed-noble
2024-05-06 18:25:07 Chad Smith tags regression-proposed verification-needed verification-needed-focal verification-needed-jammy verification-needed-mantic verification-needed-noble regression-proposed verification-failed-focal verification-failed-jammy verification-failed-mantic verification-failed-noble verification-needed
2024-05-06 18:25:19 Chad Smith tags regression-proposed verification-failed-focal verification-failed-jammy verification-failed-mantic verification-failed-noble verification-needed regression-proposed verification-failed verification-failed-focal verification-failed-jammy verification-failed-mantic verification-failed-noble
2024-05-10 09:49:21 Timo Aaltonen tags regression-proposed verification-failed verification-failed-focal verification-failed-jammy verification-failed-mantic verification-failed-noble regression-proposed verification-failed-focal verification-failed-jammy verification-failed-mantic verification-needed verification-needed-noble
2024-05-10 10:13:07 Timo Aaltonen tags regression-proposed verification-failed-focal verification-failed-jammy verification-failed-mantic verification-needed verification-needed-noble regression-proposed verification-failed-focal verification-failed-jammy verification-needed verification-needed-mantic verification-needed-noble
2024-05-10 10:29:14 Timo Aaltonen tags regression-proposed verification-failed-focal verification-failed-jammy verification-needed verification-needed-mantic verification-needed-noble regression-proposed verification-failed-focal verification-needed verification-needed-jammy verification-needed-mantic verification-needed-noble
2024-05-10 10:29:53 Timo Aaltonen tags regression-proposed verification-failed-focal verification-needed verification-needed-jammy verification-needed-mantic verification-needed-noble regression-proposed verification-needed verification-needed-focal verification-needed-jammy verification-needed-mantic verification-needed-noble
2024-05-10 15:31:28 Wesley Hershberger bug added subscriber Wesley Hershberger
2024-05-10 20:29:33 Chad Smith tags regression-proposed verification-needed verification-needed-focal verification-needed-jammy verification-needed-mantic verification-needed-noble regression-proposed verification-done verification-done-focal verification-done-jammy verification-done-mantic verification-needed-noble
2024-05-10 20:32:26 Chad Smith tags regression-proposed verification-done verification-done-focal verification-done-jammy verification-done-mantic verification-needed-noble regression-proposed verification-done verification-done-focal verification-done-jammy verification-done-mantic verification-done-noble