On 1 Nov 2010, at 07:43, no-re...@cfengine.com wrote: > Forum: Cfengine Help > Subject: Re: package mgmt with apt > Author: joke > Link to topic: https://cfengine.com/forum/read.php?3,18977,18979#msg-18979 > > There are pitfalls using apt or aptitude with cfengine. You need to make sure > to disable interactive functions of apt-get/aptitude or the install process > will get stuck every time cfengine tries to install or update a package using > apt-get/aptitude. > > First of all make sure to disable the invocation of debconf using > DEBIAN_FRONTENT environment variable.
Just to clarify - that doesn't disable debconf. It just stops debconf from asking questions. debconf still runs, and will use whatever debconf settings are in place on the machine. The distinction is subtle but important. You can, of course, use cfengine to distribute debconf settings, although I personally don't bother. cfengine, to some extent, makes debconf irrelevant. > Second make sure to use a locale which is ASCII compatible. Use LC_ALL=C or > an UTF-8 locale. > > body agent control { > environment => { > "DEBIAN_FRONTEND=noninteractive", > "LC_ALL=en_US.utf8" > }; > } > > Since debconf is disabled use may need to preconfigure the debconf database. > This is only necessary if you want to change the default setting and the > package has been installed yet. Consult the debconf manpage how to do it. > > > Setup the package management commands for apt-get or aptitude (example). > Make sure to add this commandline option to every apt-get/aptitude command to > prevent them from asking what to do if there are any changes to configuration > files. The option is passed down to dpkg (consult the manpage). You can > customize the package commands as needed. Use cfengine to handle changes to > configuration files. > > Add: -o Dpkg::Options::=--force-confold > I also add: -o Dpkg::Options::=--force-confdef > package_add_command => "/usr/bin/aptitude -o Dpkg::Options::=--force-confold > --assume-yes install"; > package_remove_command => "/usr/bin/aptitude -o > Dpkg::Options::=--force-confold --assume-yes remove"; > ................... > package_add_command => "/usr/bin/apt-get -o Dpkg::Options::=--force-confold > --assume-yes install"; > ................... I would recommend using aptitude rather than apt-get. The reason for this is that there are some aspects of the desired installation state of packages which are only recorded by aptitude, and not apt-get. If you just use apt-get and nothing else, this doesn't matter, but if you do occasionally also use aptitude, you may find that aptitude decides to uninstall certain packages that were previously installed by apt-get, because it doesn't have a record of that package having been requested for installation. If you use aptitude consistently, this problem goes away. You could of course use apt-get consistently as well, but I like to use aptitude interactively occasionally. Regards, Tim -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine