Search code examples
ubuntuapt-getdpkg

Setting the Logfile for dpkg from apt-get


I am writing a custom install script with multiple apt-get install commands. What I am looking at is to change the dpkg log file path.

The problem I am facing is that in order for me to do so, I have to change the dpkg.conf file.

Instead of that, is there a way by which I can send a parameter through apt-get (or set it somewhere in apt.conf.d) which updates the --log option of dpkg?


Solution

  • You can specify dpkg options to apt via its Dpkg::Options configuration under /etc/apt/, or even from the command-line. Such as:

    apt-get -oDpkg::Options::=--log=/path/to/other.log install pkgname
    

    For more information please check the apt and apt.conf man pages.