Ubuntu Pro 등록 문제 해결


Compute Engine이 PAYG Ubuntu Pro 라이선스를 자동으로 등록하지 못하는 경우가 있습니다. 이 문서에서는 사용한 만큼만 지불(PAYG) Ubuntu Pro 라이선스를 실행하는 Compute Engine 가상 머신(VM) 인스턴스를 등록할 때 발생할 수 있는 문제를 해결하는 방법에 대해 설명합니다.

가입 상태 확인

라이선스가 등록되었는지 확인하려면 VM에 연결하고 다음 명령어를 실행합니다.

sudo ua status

성공적으로 등록되었다면 다음과 비슷한 출력이 표시되며 추가 작업이 필요하지 않습니다.

SERVICE          ENTITLED  STATUS    DESCRIPTION
cc-eal           yes       disabled  Common Criteria EAL2 Provisioning Packages
cis              yes       disabled  Security compliance and audit tools
esm-apps         yes       enabled   Expanded Security Maintenance for Applications
esm-infra        yes       enabled   Expanded Security Maintenance for Infrastructure
fips             yes       disabled  NIST-certified core packages
fips-updates     yes       disabled  NIST-certified core packages with priority security updates
livepatch        yes       enabled   Canonical Livepatch service

등록에 실패하여 Ubuntu Pro가 등록되지 않았으면 다음과 비슷한 메시지가 표시됩니다.

This machine is not attached to an Ubuntu Pro subscription.

수동으로 라이선스 등록

Compute Engine에서 Ubuntu Pro 라이선스를 자동으로 등록할 수 없으면 다음 명령어를 실행하여 라이선스를 수동으로 등록할 수 있습니다.

sudo pro auto-attach

출력은 다음과 비슷합니다.

  • 등록 성공:

    This machine is already attached to PROJECT_ID
    To use a different subscription first run: sudo pro detach.
    
  • 등록 실패:

    Internal Server Error
    

라이선스 등록 문제 해결

Ubuntu Pro 라이선스를 수동으로 등록할 수 없는 경우 다음을 수행하여 문제를 해결합니다.

  1. 다음 명령어를 실행해서 VM에 연결된 디스크 수를 확인하여 VM이 메타데이터 서버에 연결할 수 있는지 확인합니다.

    curl "http://metadata.google.internal/computeMetadata/v1/instance/disks/" -H "Metadata-Flavor: Google"
    

    출력은 다음과 비슷하며, VM에 연결된 디스크 수를 보여줍니다.

    0/
    1/
    2/
    

    출력에 VM에 연결된 디스크 수가 표시되지 않으면 메타데이터 서버 액세스 문제 해결을 참조하세요.

  2. 다음 명령어를 실행하여 Google 게스트 에이전트가 실행되는지 확인합니다.

    systemctl status google-guest-agent.service
    

    출력은 다음과 비슷합니다.

    ● google-guest-agent.service - Google Compute Engine Guest Agent
    Loaded: loaded (/lib/systemd/system/google-guest-agent.service; enabled;
    vendor preset: enabled)
    Active: active (running) since Thu 2023-04-20 16:35:11 PDT; 2h 12min ago
    Main PID: 4582 (google_guest_ag)
    Tasks: 10 (limit: 9525)
    

    게스트 에이전트가 설치되지 않거나 실패하는 경우 게스트 환경을 설치하거나 다시 설치합니다.

  3. 로컬 워크스테이션에서 다음 명령어를 실행하여 서비스 계정이 VM에 연결되었는지 확인합니다.

    gcloud compute instances describe VM_NAME \
       --zone ZONE --format="table(serviceAccounts.email)"
    

    다음을 바꿉니다.

    • VM_NAME: VM의 이름
    • ZONE: VM이 있는 영역

    출력은 다음과 비슷합니다.

    EMAIL: ['XXXXXXXX-compute@developer.gserviceaccount.com']
    

    서비스 계정의 이메일을 기록해 둡니다.

  4. 다음 쿼리를 실행하여 서비스 계정이 사용 설정되었는지 확인합니다.

    gcloud logging read --freshness=90d "SERVICE_ACCOUNT_EMAIL protoPayload.methodName=google.iam.admin.v1.DisableServiceAccount"
    

    SERVICE_ACCOUNT_EMAIL을 VM의 서비스 계정과 연결된 이메일 주소로 바꿉니다.

    출력은 다음과 비슷합니다.

    insertId: 1ne5thkf13sxec
    logName: projects/testproject/logs/cloudaudit.googleapis.com%2Factivity
    protoPayload:
     '@type': type.googleapis.com/google.cloud.audit.AuditLog
    authenticationInfo:
    principalEmail: principalemail@google.com
    principalSubject: user:pricipalemail@google.com
    authorizationInfo:
     granted: true
    permission: iam.serviceAccounts.disable
    resource: projects/-/serviceAccounts/XXXXXXXXXXXXXX
    resourceAttributes:
      name: projects/-/serviceAccounts/XXXXXXXXXXXXXXXX
    methodName: google.iam.admin.v1.DisableServiceAccount
    request:
    '@type': type.googleapis.com/google.iam.admin.v1.DisableServiceAccountRequest
    name: projects/testproject/serviceAccounts/-compute@developer.gserviceaccount.com
    requestMetadata:
     destinationAttributes: {}
     requestAttributes:
       auth: {}
       time: '2024-01-25T21:37:55.748811275Z'
    resourceName: projects/-/serviceAccounts/XXXXXXXXXX
    response:
     '@type': type.googleapis.com/google.protobuf.Empty
     serviceName: iam.googleapis.com
     status: {}
    receiveTimestamp: '2024-01-25T21:37:56.409675900Z'
    resource:
    labels:
     email_id: -compute@developer.gserviceaccount.com
     project_id: testproject
     unique_id: 'XXXXXXXXXXXXXXXX'
    type: service_account
    severity: NOTICE
    timestamp: '2024-01-25T21:37:55.721215307Z'
    

    서비스 계정이 사용 설정되어 있지 않으면 다시 사용 설정합니다.

서비스 계정을 다시 사용 설정한 후 이 문서의 라이선스 수동 등록 섹션의 안내에 따라 라이선스를 등록해 보세요.