Ubuntu 12에서 apt-get 업그레이드 중에 변경된 구성 파일을 자동화하는 방법 maintainer’s version 10.190.113.11

“knife cloudstack server create …”를 사용하여 새 VM을 빌드하고 싶습니다. 부트 스트랩 템플릿은 “apt-get update”및 “apt-get -y upgrade”로 시작합니다.

다음으로 업그레이드가 중단됩니다.

10.190.113.11 Configuration file `/etc/nscd.conf'
10.190.113.11  ==> Modified (by you or by a script) since installation.
10.190.113.11  ==> Package distributor has shipped an updated version.
10.190.113.11    What would you like to do about it ?  Your options are:
10.190.113.11     Y or I  : install the package maintainer's version
10.190.113.11     N or O  : keep your currently-installed version
10.190.113.11       D     : show the differences between the versions
10.190.113.11       Z     : start a shell to examine the situation
10.190.113.11  The default action is to keep your current version.
10.190.113.11 *** nscd.conf (Y/I/N/O/D/Z) [default=N] ?

따라서 실제로 두 가지 문제가 있습니다.

첫째, 기본적으로 무언가를 할 수 있습니까? 분명히 대답 할 방법이 없습니다.

둘째, 질문에 대한 정답이 무엇인지조차 모릅니다. 대체하는 구성 파일은 템플릿에서 가져 왔습니다. 아직 “nscd”의 기능을 찾지 못했습니다. (아마도 “Y”가 정답이지만 질문 당시 관련된 연구는 어려울 것입니다.)



답변

프롬프트가 표시되지 않도록 인수를 전달할 수 있습니다. 이것은 나를 위해 작동합니다.

apt-get update
apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

--force-confold(내 선택)이 “수정 된 구성 파일에 대해 무엇을 하시겠습니까?” 질문을 기본값으로 설정합니다 N(현재 설치된 버전 유지)

--force-confold: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix. With this option alone, even configuration files that you have not modified are left untouched. You need to combine it with --force-confdef to let dpkg overwrite configuration files that you have not modified.
--force-confnew: always install the new version of the configuration file, the current version is kept in a file with the .dpkg-old suffix.
--force-confdef: ask dpkg to decide alone when it can and prompt otherwise. This is the default behavior of dpkg and this option is mainly useful in combination with --force-confold.
--force-confmiss: ask dpkg to install the configuration file if it’s currently missing (for example because you have removed the file by mistake).

경고 -일부 수정 된 구성 파일은 업데이트 된 패키지 버전과 다시 호환되지 않으면 시스템을 손상시킬 수 있습니다. 자동화 솔루션에 배포하기 전에 테스트하십시오 .


답변

대화 형 질문에 대답하지 않으려면 DEBIAN_FRONTEND프런트 엔드 변수를 로 설정하십시오 noninteractive.

이만큼 쉬울 수 있습니다 DEBIAN_FRONTEND=noninteractive apt-get upgrade.

메시지가 나타나지 않고 기본값이 선택됩니다. 대부분의 경우 이는 구성 파일이 변경되지 않으며 *.dpkg-new구성 파일을 건드리지 않은 모든 장소에 대해 같은 이름의 파일이 남아 있음을 의미합니다. 그런 다음 수동으로 변경 사항을 해결하거나 구성 관리 시스템 등을 사용하여 로컬 구성을 시스템에 푸시 할 수 있습니다.

둘째, 나는 그 질문에 대한 정답이 무엇인지 알지 못한다.

타격 D의 핵심하면 다음 검사 할 수의 차이를 표시합니다. 해당 파일을 수동으로 변경 한 적이없는 경우 Y 를 선택 하여 교체하면 안전 할 것입니다 (백업 업그레이드가 RIGHT !! 임을 확인했습니다 ). N을 선택하면 패키지에 주요 변경 사항이없는 한 이전 파일도 95 % 안전합니다. 일반적으로 upgrade / dist-upgrade 명령을 실행하기 전에 읽은 changelog / release notes에 포함되어 있습니다.

테스트 환경에서 먼저 명령을 시도하십시오. 작동하지 않는지 확인하십시오. 정말로 확실하지 않은 경우 diff를 얻고 패키지 및 연구에 대한 설명서를 읽으십시오.