EC2 Image Builder failing in Component step which is working if manually setup

0

I want to install ubuntu-drivers-common on an p3.2xlarge Instance to use the NVIDIA graphics card in a custom AMI build with the EC2 Image Builder.
To do that, I tried the command to install ubuntu-drivers-common on a testsetup instance:

ubuntu@ip-10-180-0-236:~$ sudo apt install ubuntu-drivers-common -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  python3-xkit
Suggested packages:
  python3-aptdaemon.pkcompat
The following NEW packages will be installed:
  python3-xkit ubuntu-drivers-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 76.8 kB of archives.
After this operation, 412 kB of additional disk space will be used.
Get:1 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu jammy/main amd64 python3-xkit all 0.5.0ubuntu5 [18.5 kB]
Get:2 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ubuntu-drivers-common amd64 1:0.9.6.2~0.22.04.4 [58.3 kB]
Fetched 76.8 kB in 0s (3305 kB/s)                
Preconfiguring packages ...
Selecting previously unselected package python3-xkit.
(Reading database ... 94114 files and directories currently installed.)
Preparing to unpack .../python3-xkit_0.5.0ubuntu5_all.deb ...
Unpacking python3-xkit (0.5.0ubuntu5) ...
Selecting previously unselected package ubuntu-drivers-common.
Preparing to unpack .../ubuntu-drivers-common_1%3a0.9.6.2~0.22.04.4_amd64.deb ...
Unpacking ubuntu-drivers-common (1:0.9.6.2~0.22.04.4) ...
Setting up python3-xkit (0.5.0ubuntu5) ...
Setting up ubuntu-drivers-common (1:0.9.6.2~0.22.04.4) ...
Created symlink /etc/systemd/system/display-manager.service.wants/gpu-manager.service → /lib/systemd/system/gpu-manager.service.
Unit /lib/systemd/system/gpu-manager.service is added as a dependency to a non-existent unit display-manager.service.
Created symlink /etc/systemd/system/oem-config.service.wants/gpu-manager.service → /lib/systemd/system/gpu-manager.service.
Unit /lib/systemd/system/gpu-manager.service is added as a dependency to a non-existent unit oem-config.service.
Scanning processes...                                                                                                                                                                                                                                                              
Scanning linux images...                                                                                                                                                                                                                                                           

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

This is working fine.

In my Pipeline I first used :

- apt update
- yes | sudo DEBIAN_FRONTEND=noninteractive apt upgrade -yqq
- sudo reboot

which did not prompt me to use the terminal to update the kernel -> instead of

sudo DEBIAN_FRONTEND=noninteractive apt upgrade -yqq

which did.

In the pipeline I tried these exact steps.
Followed by the next component, executing:

sudo apt install ubuntu-drivers-common -y

in build. Leading to this error:

Phase build
Step UbuntuDriversCommonInstall
ExecuteBash: STARTED EXECUTION
Stdout: The following additional packages will be installed:
Stdout: python3-xkit
Stdout: Suggested packages:
Stdout: python3-aptdaemon.pkcompat
Stdout: The following NEW packages will be installed:
Stdout: python3-xkit ubuntu-drivers-common
Stdout: 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Stdout: Preconfiguring packages ...
Stdout: Need to get 76.8 kB of archives.
Stdout: After this operation, 412 kB of additional disk space will be used.
Stdout: Selecting previously unselected package python3-xkit.
Stdout: (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 64726 files and directories currently installed.)
Stdout: Preparing to unpack .../python3-xkit_0.5.0ubuntu5_all.deb ...
Stdout: Unpacking python3-xkit (0.5.0ubuntu5) ...
Stdout: Selecting previously unselected package ubuntu-drivers-common.
Stdout: Preparing to unpack .../ubuntu-drivers-common_1%3a0.9.6.2~0.22.04.4_amd64.deb ...
Stdout: Unpacking ubuntu-drivers-common (1:0.9.6.2~0.22.04.4) ...
Stdout: Setting up python3-xkit (0.5.0ubuntu5) ...
Stdout: Setting up ubuntu-drivers-common (1:0.9.6.2~0.22.04.4) ...
Stdout: Created symlink /etc/systemd/system/display-manager.service.wants/gpu-manager.service → /lib/systemd/system/gpu-manager.service.
Stdout: Unit /lib/systemd/system/gpu-manager.service is added as a dependency to a non-existent unit display-manager.service.
Stdout: Created symlink /etc/systemd/system/oem-config.service.wants/gpu-manager.service → /lib/systemd/system/gpu-manager.service.
Stdout: Unit /lib/systemd/system/gpu-manager.service is added as a dependency to a non-existent unit oem-config.service.
Waiting for command to complete (command id: e0e425f8-85b1-4ae8-952b-7a8b23bea0d1). Attempt number: 2.
Waiting for command to complete (command id: e0e425f8-85b1-4ae8-952b-7a8b23bea0d1). Attempt number: 3.
Waiting for command to complete (command id: e0e425f8-85b1-4ae8-952b-7a8b23bea0d1). Attempt number: 4.
Command failed (command id: e0e425f8-85b1-4ae8-952b-7a8b23bea0d1, state: Failed)
Action failed for step ApplyBuildComponents. Failing step
Step ApplyBuildComponents failed

How come this fails, if it works if I do it manually? And how can I debug this behavior?

Zujiry
질문됨 8달 전667회 조회
2개 답변
0
수락된 답변

The problem was, that I could not use apt update and apt upgrade in another component, executed before the sudo apt install ubuntu-drivers-common -y component. Somehow this lead to an error in the apt execution.

The solution was, too put apt update and upgrade into the component which also installs the ubuntu-drivers-common. In later components, I do not need to apt update and upgrade anymore for other apt installations -> therefore I am still confused about this error, but I will resolve it at that.

Zujiry
답변함 8달 전
0

I tried replicating and found no such errors. Below are the steps of my replication

Created a Build Component with Ubuntu 22. Used the below definition document content :

name: Install driver
description: Install driver
schemaVersion: 1.0
phases:
  - name: build
    steps:
      - name: InstallDriver
        action: ExecuteBash
        inputs:
          commands:
            - apt update
            - yes | sudo DEBIAN_FRONTEND=noninteractive apt upgrade -yqq
            - sudo reboot
            - sudo apt install ubuntu-drivers-common -y

Created the recipe with latest Ubuntu 22.04 Amazon Managed public AMI. Used the above build component. Created Image Pipeline from this. I was able to successfully create AMI from the pipeline.

To have better understanding of error review build-image workflow logs. Specify an S3 bucket name and key prefix in your infrastructure configuration to store build-image logs.

AWS
Gopal_M
답변함 8달 전
  • That works. But if you put

    - apt update
    - yes | sudo DEBIAN_FRONTEND=noninteractive apt upgrade -yqq
    

    into the component before the "Install driver" component, it did not work for me.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠