4

I was trying to install few packages which are non related to nginx (for example htop) using chef script. But it was failing because its asking to update nginx.conf and nginx/sites-available/default. Which I can select using chef. (Which I also don't want to override, because I want to understand and fix the issue instead of escaping from it)

Thus I tried installing htop on my own by running command sudo apt-get install htop and I got following output.

ubuntu@ip-10-150-4-249:~⟫ sudo apt-get install htop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  htop
0 upgraded, 1 newly installed, 0 to remove and 160 not upgraded.
3 not fully installed or removed.
Need to get 68.0 kB of archives.
After this operation, 188 kB of additional disk space will be used.
Get:1 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe htop amd64 1.0.2-3 [68.0 kB]
Fetched 68.0 kB in 0s (5,762 kB/s)
Selecting previously unselected package htop.
(Reading database ... 80711 files and directories currently installed.)
Preparing to unpack .../htop_1.0.2-3_amd64.deb ...
Unpacking htop (1.0.2-3) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up nginx-common (1.8.0-1+trusty1) ...

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

I then tried installing cmake sudo apt-get install vim which was already installed, and I still got same error. Output below

ubuntu@ip-10-162-36-233:~⟫ sudo apt-get install vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
vim is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 171 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up nginx-common (1.8.0-1+trusty1) ...

Configuration file '/etc/nginx/nginx.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** nginx.conf (Y/I/N/O/D/Z) [default=N] ? 
  1. I want to understand why this is happening everytime ?
  2. Is there any way to pre-empt this situation before it occurs ? because it blocks my chef script.
  3. How do I fix this using chef ?
Rahul Prasad
  • 257
  • 3
  • 4
  • 9
  • 2
    It will continue happening until you deal with it. – Michael Hampton Jan 08 '16 at 21:06
  • As @MichaelHampton is recommending, you need to select a solution for the `nginx.conf`. Is there some reason you aren't selecting a solution to resolve this issue? Maybe post a question about that? – Paul Jan 08 '16 at 21:21
  • @Paul I don't want to access servers manually and this error came "suddenly" while running a chef script. I want to understand why this came suddenly. I want to deal with it but before that I want to understand what caused it. – Rahul Prasad Jan 08 '16 at 21:36
  • Are you the only one with root privileges on the server? Is the server configured to run some sort of unattended upgrades? – Paul Jan 08 '16 at 21:48
  • I dont access server directly until something like this occur. I run chef script to update server. – Rahul Prasad Jan 09 '16 at 08:19
  • I haven't used chef, but if it isn't configured to handle the nginx upgrade issue, then you're going to be stuck there until you either deal with it directly or configure the script to manage as desired. The upgrade package trying to overwrite those files is pretty much the standard way that nginx gets packaged. – Paul Jan 09 '16 at 22:52

1 Answers1

4

Chef runs apt in non-interactive mode so these prompts don't show up for Chef's package resource, the version of the file deployed by Chef is always used.

coderanger
  • 858
  • 4
  • 13