Vagrant와 VirtualBox Guest Additions 간의 관계 이해

알고 싶은 것이 쭉 쓰여진 기사를 찾을 수 없었기 때문에, 정리해 둡니다.

VirtualBox Guest Additions란?



VirtualBox Guest Additions (vbguest)는 VM에 설치하고 사용하는 확장 프로그램입니다.

공유 폴더 기능 ( synced_folder type: virtualbox ) 등에서 필요합니다.

VirtualBox 본체와 Guest Additions의 버전은 일치하는 것이 바람직합니다.





버전이 갖추어져 있지 않아도 움직입니다만, vagrant up 로 기동시에 이하와 같이 경고가 나옵니다.
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.

「대개 괜찮지만, 레어 케이스로 공유 디렉토리가 움직이지 않게 되거나 한다」라는 것.

Vagrant 박스에는 처음부터 Guest Additions가 포함되어 있습니다.



Vagrant box에는 처음부터 Guest Additions가 포함되어 있는 것과 그렇지 않은 것이 있습니다.

상자에 Guest Additions가 포함되어 있는지 여부는 외부에서 판별되지 않습니다. 적어도 Vagrant Cloud 화면에서 판단할 수 없다고 생각합니다.

예를 들어, CentOS 공식 centos/8의 현재 최신 버전에는 포함되어 있지 않습니다.
  • htps : // 어 p.ゔぁ 란츠 p. 코 m/센토 s/보오 s/8

  • Chef bento/centos-8 에 들어 있습니다.
  • htps : // 앗 p.ゔぁ 란츠 p. 코 m / 벤토 / 보오 s / 센토 s-8

  • 비 엔지니어에게 사용하는 경우, 처음부터 들어있는 box 쪽이 편리할 것 같습니다. VirtualBox 와 버전이 다소 어긋나 있어도, 대부분은 움직이는 것 같기 때문에.

    만약 움직이지 않게 되면, VirtualBox 와 box 의 양쪽 모두를 최신으로 해 주는 듯한 운용으로 갈 수 있는 것은, 라고 생각하고 있습니다.

    Guest Additions가 포함되어 있는지 확인하는 방법



    시작시 메시지로 구분됩니다. 다음은 들어 있지 않은 경우.
    ==> default: Checking for guest additions in VM...
        default: No guest additions were detected on the base box for this VM! Guest
        default: additions are required for forwarded ports, shared folders, host only
        default: networking, and more. If SSH fails on this machine, please install
        default: the guest additions and repackage the box to continue.
    

    또한 로그인 후 lsmod에서 확인할 수 있습니다.
    [vagrant@localhost ~]$ lsmod
    :
    vboxguest             292797  2 vboxsf
    :
    

    vagrant-vbguest 플러그인 거동



    Vagrant 에 vagrant-vbguest 플러그인을 넣으면 설치나 Virtualbox 버전에 맞는 업데이트를 자동으로 해주는 것 같습니다.

    플러그인을 넣은 상태에서 centos/8
    [default] No Virtualbox Guest Additions installation found.
    Last metadata expiration check: 0:00:01 ago on Sun 07 Jun 2020 01:03:38 AM UTC.
    Package centos-release-8.0-0.1905.0.9.el8.x86_64 is already installed.
    Dependencies resolved.
    ================================================================================
     Package               Arch         Version                  Repository    Size
    ================================================================================
    Upgrading:
     centos-release        x86_64       8.1-1.1911.0.9.el8       BaseOS        21 k
    Installing dependencies:
     centos-gpg-keys       noarch       8.1-1.1911.0.9.el8       BaseOS        12 k
     centos-repos          x86_64       8.1-1.1911.0.9.el8       BaseOS        13 k
    
    Transaction Summary
    ================================================================================
    Install  2 Packages
    Upgrade  1 Package
    
    Total download size: 45 k
    Downloading Packages:
    (1/3): centos-gpg-keys-8.1-1.1911.0.9.el8.noarc  11 kB/s |  12 kB     00:01
    (2/3): centos-release-8.1-1.1911.0.9.el8.x86_64  19 kB/s |  21 kB     00:01
    (3/3): centos-repos-8.1-1.1911.0.9.el8.x86_64.r 9.1 kB/s |  13 kB     00:01
    --------------------------------------------------------------------------------
    Total                                            16 kB/s |  45 kB     00:02
    warning: /var/cache/dnf/BaseOS-31c79d9833c65cf7/packages/centos-gpg-keys-8.1-1.1911.0.9.el8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
    CentOS-8 - Base                                 255 kB/s | 1.6 kB     00:00
    Importing GPG key 0x8483C65D:
     Userid     : "CentOS (CentOS Official Signing Key) <[email protected]>"
     Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    Key imported successfully
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Running scriptlet: centos-gpg-keys-8.1-1.1911.0.9.el8.noarch              1/1
      Installing       : centos-gpg-keys-8.1-1.1911.0.9.el8.noarch              1/4
      Installing       : centos-repos-8.1-1.1911.0.9.el8.x86_64                 2/4
      Upgrading        : centos-release-8.1-1.1911.0.9.el8.x86_64               3/4
      Cleanup          : centos-release-8.0-0.1905.0.9.el8.x86_64               4/4
      Running scriptlet: centos-release-8.0-0.1905.0.9.el8.x86_64               4/4
      Verifying        : centos-gpg-keys-8.1-1.1911.0.9.el8.noarch              1/4
      Verifying        : centos-repos-8.1-1.1911.0.9.el8.x86_64                 2/4
      Verifying        : centos-release-8.1-1.1911.0.9.el8.x86_64               3/4
      Verifying        : centos-release-8.0-0.1905.0.9.el8.x86_64               4/4
    
    Upgraded:
      centos-release-8.1-1.1911.0.9.el8.x86_64
    
    Installed:
      centos-gpg-keys-8.1-1.1911.0.9.el8.noarch
      centos-repos-8.1-1.1911.0.9.el8.x86_64
    
    Complete!
    Error: Unknown repo: 'C*-base'
    ==> default: Checking for guest additions in VM...
        default: No guest additions were detected on the base box for this VM! Guest
        default: additions are required for forwarded ports, shared folders, host only
        default: networking, and more. If SSH fails on this machine, please install
        default: the guest additions and repackage the box to continue.
        default:
        default: This is not an error message; everything may continue to work properly,
        default: in which case you may ignore this message.
    The following SSH command responded with a non-zero exit status.
    Vagrant assumes that this means the command failed!
    
    yum install -y kernel-devel-`uname -r` --enablerepo=C*-base --enablerepo=C*-updates
    
    Stdout from the command:
    
    
    
    Stderr from the command:
    
    Error: Unknown repo: 'C*-base'
    

    수중이라면, 버전을 올리게 되고, 어떠한 조정하면 움직이게 된다고 생각합니다만, 사람의 환경이라면 서포트가 힘들기 때문에, vagrant up 를 전제로 한 운용에는 하고 싶지 않다고 생각합니다 .

    플러그인을 넣는 것보다, 처음부터 vbguest 가 들어 있는 box 를 사용하는 편이 빠르다.

    자동 업데이트


    vagrant-vbguest 의 자동 업데이트를 끄려면 다음을 설정합니다.
  • htps : // 기주 b. 코 m / t ぇ s-에서 /

  • 자동 업데이트 시에는 함께 커널 등의 버전도 올라간다는 것. 또한 플러그인이 들어 있지 않은 경우 오류가 발생하지 않도록 대응이 필요한 것 같습니다.
  • htps : // 페탄.んふぉ/せ rゔぇr/ゔぁg란 t/ゔぁg란 t_vb구에 st_에서. HTML

  • synced_folders의 거동



    Vagrant 의 vagrant-vbguest 는 Guest Additions 가 들어 있지 않은 상태라면 synced_folders 가 디폴트가 됩니다.
  • htps //w w.ゔぁ 란츠 p. 이 m / cs / synse d-fl에서 rs / rsyc

  • 거대한 리포지토리에서 type: rsync 시도하면 vagrant up 큰 공유 폴더를 rsync에서 작동하는 것은 어려울 것 같습니다.

    Guest Additions가 포함되어 있으면 Rsyncing가 기본값으로 표시됩니다.
  • htps //w w.ゔぁ 란츠 p. 이 m / cs / synse d-fu l에서 rs / r r tho l x

  • If you are using the Vagrant VirtualBox provider, then VirtualBox shared folders are the default synced folder type.

    좋은 웹페이지 즐겨찾기