damir
By:
damir

Error while trying to upgrade nginx

October 5, 2015 12k views
Nginx LEMP Ubuntu

I am trying to upgrade NGINX to the latest stable but keep getting this error:

Preparing to unpack .../nginx_1.8.0-1~trusty_amd64.deb ...
Unpacking nginx (1.8.0-1~trusty) over (1.4.6-1ubuntu3.3) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.8.0-1~trusty_amd64.deb (--unpack):
 trying to overwrite '/etc/logrotate.d/nginx', which is also in package nginx-common 1.4.6-1ubuntu3.3
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nginx_1.8.0-1~trusty_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I hav tried to upgrade to the mainline also but same errror. What am I missing?

13 comments
  • Hi,

    Can you let us know what these commands return?

    sudo dpkg --configure -a
    sudo apt-get install -f
    cat /etc/apt/sources.list
    
    edited by asb
  • sudo dpkg --configure -a
    

    returned nothing

    sudo apt-get install -f
    

    returned:

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
    
    cat /etc/apt/sources.list
    

    returned:

    ## Note, this file is written by cloud-init on first boot of an instance
    ## modifications made here will not survive a re-bundle.
    ## if you wish to make changes you can:
    ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
    ##     or do the same in user-data
    ## b.) add sources in /etc/apt/sources.list.d
    ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
    #
    
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://mirrors.digitalocean.com/ubuntu trusty main
    deb-src http://mirrors.digitalocean.com/ubuntu trusty main
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://mirrors.digitalocean.com/ubuntu trusty-updates main
    deb-src http://mirrors.digitalocean.com/ubuntu trusty-updates main
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://mirrors.digitalocean.com/ubuntu trusty universe
    deb-src http://mirrors.digitalocean.com/ubuntu trusty universe
    deb http://mirrors.digitalocean.com/ubuntu trusty-updates universe
    deb-src http://mirrors.digitalocean.com/ubuntu trusty-updates universe
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    # deb http://mirrors.digitalocean.com/ubuntu trusty multiverse
    # deb-src http://mirrors.digitalocean.com/ubuntu trusty multiverse
    # deb http://mirrors.digitalocean.com/ubuntu trusty-updates multiverse
    # deb-src http://mirrors.digitalocean.com/ubuntu trusty-updates multiverse
    
    ## Uncomment the following two lines to add software from the 'backports'
    ## repository.
    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    # deb http://mirrors.digitalocean.com/ubuntu trusty-backports main restricted universe multiverse
    # deb-src http://mirrors.digitalocean.com/ubuntu trusty-backports main restricted universe multiverse
    
    ## Uncomment the following two lines to add software from Canonical's
    ## 'partner' repository.
    ## This software is not part of Ubuntu, but is offered by Canonical and the
    ## respective vendors as a service to Ubuntu users.
    # deb http://archive.canonical.com/ubuntu trusty partner
    # deb-src http://archive.canonical.com/ubuntu trusty partner
    
    deb http://security.ubuntu.com/ubuntu trusty-security main
    deb-src http://security.ubuntu.com/ubuntu trusty-security main
    deb http://security.ubuntu.com/ubuntu trusty-security universe
    deb-src http://security.ubuntu.com/ubuntu trusty-security universe
    # deb http://security.ubuntu.com/ubuntu trusty-security multiverse
    # deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
    
    
  • Hi,

    Can you try

    sudo dpkg -i --force-overwrite /etc/logrotate.d/nginx
    

    which will attempt to overwrite the specific file that failed.
    You could also do --force-all instead

  • I got this error now:

    dpkg-deb: error: `/etc/logrotate.d/nginx' is not a debian format archive
    dpkg: error processing archive /etc/logrotate.d/nginx (--install):
     subprocess dpkg-deb --control returned error exit status 2
    Errors were encountered while processing:
     /etc/logrotate.d/nginx
    
  • Ah, ok, sorry. Let's try
    sudo dpkg -i --force-overwrite /var/cache/apt/archives/nginx_1.8.0-1~trusty_amd64.deb

  • You may also want to try uninstalling with --purge first, as the third party repo with the newer Nginx build may not have the common package split out.

  • It worked but now PHP won't be read... Hmmm

  • I am only getting a white screen now... I can not figure out what the problem is at the moment... I think that the latest nginx does not work with the latest php5-fpm? Do you have any idea on what is going on here?

  • I'm not sure. On my end I am still using the version that ships with Ubuntu 14.04. Are you seeing anything in the logs for either Nginx or PHP?

  • Hi,
    I faced similar error as damlr and I followed everything BrookDo mentioned. I am getting a white screen now. Can you tell me where to look now or how to debug the problem?

  • Hi I solved the problem almost instantly after my report regarding the blank page!

    The problem is in the config files. Make sure that the correct site is active and not the deafult NGINX welcome site! Check the paths!

  • sudo apt-get remove nginx-common
    sudo apt-get install nginx
    

    This works for me.

  • The issue of the whitescreen problem is that fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; needs to be added to the fastcgi_params file.

1 Answer

This question was answered by @damir:

Hi I solved the problem almost instantly after my report regarding the blank page!

The problem is in the config files. Make sure that the correct site is active and not the deafult NGINX welcome site! Check the paths!

You can see the comment here.

Have another answer? Share your knowledge.