-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possible issue with "apt"-module (user interaction required) #2763
Comments
Have someone looking into this, thanks! |
Running this in a clean ubuntu 12.04 chroot, doesn't show a problem root 6583 0.0 0.1 54880 10712 ? S 20:55 0:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/postgresql-common.postinst configure
root 6589 0.0 0.0 9488 1472 ? S 20:55 0:00 \_ /bin/bash /var/lib/dpkg/info/postgresql-common.config configure
root 6599 0.0 0.0 19492 1816 ? S 20:55 0:00 \_ whiptail --backtitle Package configuration --title Configuring postgresql-common --output-fd 11 --nocancel --msgbox Obsolete major version 8.4??The PostgreSQL version 8.4 is obsolete, but the server or client ?packages are still installed. Please install the latest packages ?(postgresql-9.1 and postgresql-client-9.1) and upgrade the existing ?clusters with pg_upgradecluster (see manpage).??Please be aware that the installation of postgresql-9.1 will ?automatically create a default cluster 9.1/main. If you want to upgrade ?the 8.4/main cluster, you need to remove the already existing 9.1 ?cluster (pg_dropcluster --stop 9.1 main, see manpage for details).??The old server and client packages are no longer supported. After the ?existing clusters are upgraded, the postgresql-8.4 and ?postgresql-client-8.4 packages should be removed.??Please see /usr/share/doc/postgresql-common/README.Debian.gz for ?details. --scrolltext 21 77 I need to look further into this.. |
installing the package uses this command: A solution that seems to work here is to also use APT_ENVVARS, as is used in the upgrade function: DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get --option Dpkg::Options::=--force-confold -q -y install 'postgresql-8.4' yields no pup-up. This automaticaly asks to streamline DPKG_OPTIONS. I'll first look into those options, to make a valid choice here. Won't rush into a patch. |
I don't have access to the machine in question at the moment, but I think I've got universe enabled there as well. (What I haven't considered up until now is that the package itself might be broken somehow, but I don't know enough about packaging to be able to tell) |
Yeah, postgresql-8.4 is in universe. I don't have a reason to think it's broken though. |
dpkg --force-help:
Looks like using confold is the safest. |
Testing a fix.. |
All the tests I can think of seem to work: serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "update_cache=yes"
chroots/precise | success >> {
"changed": false
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "update_cache=yes name=postgresql-8.4"chroots/precise | success >> {
"changed": true
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "update_cache=yes name=aptitude"
chroots/precise | success >> {
"changed": true
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "update_cache=yes upgrade=yes"
chroots/precise | success >> {
"changed": false,
"msg": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nReading extended state information...\nInitializing package states...\nWriting extended state information...\nNo packages will be installed, upgraded, or removed.\n0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 0 B of archives. After unpacking 0 B will be used.\nWriting extended state information...\nReading package lists...\nBuilding dependency tree...\nReading state information...\nReading extended state information...\nInitializing package states...\n"
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "update_cache=yes upgrade=full"
chroots/precise | success >> {
"changed": false,
"msg": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nReading extended state information...\nInitializing package states...\nNo packages will be installed, upgraded, or removed.\n0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 0 B of archives. After unpacking 0 B will be used.\nReading package lists...\nBuilding dependency tree...\nReading state information...\nReading extended state information...\nInitializing package states...\n"
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "update_cache=yes upgrade=dist"
chroots/precise | success >> {
"changed": false,
"msg": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n"
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "update_cache=yes name=screen"
chroots/precise | success >> {
"changed": true
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "name=mosh"
chroots/precise | success >> {
"changed": true
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "name=mosh"
chroots/precise | success >> {
"changed": false
}
serge@goldorak:~$ sudo ansible -i chroots/precise, all -c chroot -m apt -a "name=mosh=unknown"
chroots/precise | FAILED >> {
"failed": true,
"msg": "'apt-get install 'mosh=unknown' ' failed: E: Version 'unknown' for 'mosh' was not found\n"
}
serge@goldorak:~/src/ansible$ sudo ansible -i ~/chroots/precise, all -c chroot -m apt -a "name=apache2" -C
/home/serge/chroots/precise | success >> {
"changed": true
}
serge@goldorak:~/src/ansible$ sudo ansible -i ~/chroots/precise, all -c chroot -m apt -a "name=apache2" -C
/home/serge/chroots/precise | success >> {
"changed": true
}
|
@b6d can you test this? you can pick the fixed module at https://github.com/sergevanginderachter/ansible/blob/800ca63de68816fb7c46446b38f827935e4e4d15/library/apt |
@sergevanginderachter just tested it in exactly the same environment as yesterday - the problem is gone. Thanks! |
I'm seeing ansible hang when trying to remove a package, and the hung process is `whiptail` like in #2763. It looks like we only use `APT_ENVVARS` and `DPKG_OPTIONS` for the `apt` commands in install() and upgrade(). This change uses them in remove() as well, which fixes the hang.
On a freshly installed Ubuntu 12.04 server, I tried to install package postgresql-8.4 using the current version of Ansible's "apt"-module.
When this package gets installed manually for the first time, at (I assume) package configuration time a dialog warns about PostgreSQL 8.4 being deprecated, prompting the user to press an "ok" button.
This dialog somehow was also presented to Ansible's apt-module which caused the playbook to hang. Stopping ansible-playbook on the controlling host did not terminate the processes on the controlled host, effectively preventing further invocations of apt or dpkg until the processes themselves were killed.
This is the relevant section of the output of
ps
, the last line being the afforementioned interactive dialog:The text was updated successfully, but these errors were encountered: