Lenny Upgrade error

While upgrading my home system to lenny today (dist-upgrade), I got the following error:

...
Setting up libpam-runtime (1.0.1-5+lenny1) ...

(Reading database ... 250809 files and directories currently installed.)
Preparing to replace libpam0g 0.99.7.1-4 (using .../libpam0g_1.0.1-5+lenny1_i386.deb) ...
Unpacking replacement libpam0g ...
Setting up libpam0g (1.0.1-5+lenny1) ...
Checking for services that may need to be restarted...Checking init scripts...
debconf: Unable to load Debconf::Element::Gnome::String. Failed because: Can't locate I18N/Langinfo.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/Element/Gnome.pm line 7, <GEN1> line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Element/Gnome.pm line 7, <GEN1> line 4.
Compilation failed in require at (eval 23) line 3, <GEN1> line 4.
        ...propagated at /usr/share/perl/5.8/base.pm line 84, <GEN1> line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Element/Gnome/String.pm line 10, <GEN1> line 4.
Compilation failed in require at (eval 22) line 2, <GEN1> line 4.
BEGIN failed--compilation aborted at (eval 22) line 2, <GEN1> line 4.

Can't locate object method "new" via package "Debconf::Element::Gnome::String" at /usr/share/perl5/Debconf/FrontEnd.pm line 68, <GEN1> line 4.
dpkg: error processing libpam0g (--configure):
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 libpam0g
E: Sub-process /usr/bin/dpkg returned an error code (1)
  

Googling this message didn't turn up any useful tips, so I'm documenting my solution here for others to find.

It seems that libpam0g needs to use some debconf infrastructure which isn't yet available, presumably because apt hasn't yet upgraded debconf at this point. I tried "dpkg --configure libpam0" and got the same error again.

I figured it might help to manually upgrade debconf so that apt might be able to continue the upgrade, so I went into apt's cache directory (where it has stored the new versions of the debconf packages, which it has already downloaded), and told dpkg to install the three debconf packages.

trotzdem:/etc/apt# cd /var/cache/apt/archives
trotzdem:/var/cache/apt/archives# ls debconf*
debconf_1.5.24_all.deb        debconf-utils_1.5.24_all.deb
debconf-i18n_1.5.24_all.deb   
trotzdem:/var/cache/apt/archives# dpkg -i debconf_1.5.24_all.deb debconf-utils_1.5.24_all.deb debconf-i18n_1.5.24_all.deb 
(Reading database ... 250810 files and directories currently installed.)
Preparing to replace debconf 1.5.11etch2 (using debconf_1.5.24_all.deb) ...
Unpacking replacement debconf ...
Preparing to replace debconf-utils 1.5.11etch2 (using debconf-utils_1.5.24_all.deb) ...
Unpacking replacement debconf-utils ...
Preparing to replace debconf-i18n 1.5.11etch2 (using debconf-i18n_1.5.24_all.deb) ...
Unpacking replacement debconf-i18n ...
Setting up debconf-i18n (1.5.24) ...
Setting up debconf (1.5.24) ...
Installing new version of config file /etc/bash_completion.d/debconf ...
Installing new version of config file /etc/debconf.conf ...

Setting up debconf-utils (1.5.24) ...
    

Great -- this worked. Now check if this resolved the error:

trotzdem:/usr# dpkg --configure libpam0g 
Setting up libpam0g (1.0.1-5+lenny1) ...
Checking for services that may need to be restarted...Checking init scripts...
debconf: Unable to load Debconf::Element::Gnome::String. Failed because: Can't locate I18N/Langinfo.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/Element/Gnome.pm line 7, <GEN1> line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Element/Gnome.pm line 7, <GEN1> line 4.
Compilation failed in require at (eval 23) line 3, <GEN1> line 4.
        ...propagated at /usr/share/perl/5.8/base.pm line 84, <GEN1> line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Element/Gnome/String.pm line 10, <GEN1> line 4.
Compilation failed in require at (eval 22) line 2, <GEN1> line 4.
BEGIN failed--compilation aborted at (eval 22) line 2, <GEN1> line 4.

Can't locate object method "new" via package "Debconf::Element::Gnome::String" at /usr/share/perl5/Debconf/FrontEnd.pm line 68, <GEN1> line 4.
dpkg: error processing libpam0g (--configure):
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 libpam0g
    

Nope, there is further work to do. Is there actually a Langinfo.pm file on my system? If so, why isn't it being found?

trotzdem:/usr# dpkg -S Langinfo.pm
perl: /usr/lib/perl/5.10.0/I18N/Langinfo.pm
trotzdem:/usr# perl --version

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
    

OK, the Langinfo.pm module is part of perl 5.10, but my system is still using perl 5.8.8. Let's try upgrading perl manually.

trotzdem:/usr# cd /var/cache/apt/archives/
trotzdem:/var/cache/apt/archives# ls perl*
perl_5.10.0-19_i386.deb
perl-base_5.10.0-19_i386.deb
perl-doc_5.10.0-19_all.deb
perlmagick_7%3a6.3.7.9.dfsg2-1~lenny1_i386.deb
perl-modules_5.10.0-19_all.deb
perl-suid_5.10.0-19_i386.deb
perl-tk_1%3a804.028-1+b1_i386.deb
trotzdem:/var/cache/apt/archives# dpkg -i perl_5.10.0-19_i386.deb perl-base_5.10.0-19_i386.deb perl-modules_5.10.0-19_all.deb                             
(Reading database ... 250925 files and directories currently installed.)
Preparing to replace perl 5.10.0-19 (using perl_5.10.0-19_i386.deb) ...
Unpacking replacement perl ...
Preparing to replace perl-base 5.8.8-7etch6 (using perl-base_5.10.0-19_i386.deb) ...
Unpacking replacement perl-base ...
Preparing to replace perl-modules 5.10.0-19 (using perl-modules_5.10.0-19_all.deb) ...
Unpacking replacement perl-modules ...
Setting up perl-base (5.10.0-19) ...
Setting up perl-modules (5.10.0-19) ...
Setting up perl (5.10.0-19) ...
    

OK, that worked. Check again whether the problem is solved:

trotzdem:/var/cache/apt/archives# dpkg --configure libpam0g
Setting up libpam0g (1.0.1-5+lenny1) ...
debconf: unable to initialize frontend: Gnome
debconf: (Unable to load Gnome -- is libgnome2-perl installed?)
debconf: falling back to frontend: Dialog
Checking for services that may need to be restarted...Checking init scripts...

Restarting services possibly affected by the upgrade:
  saslauthd: stopping...starting...done.
  samba: stopping...starting...done.
  postgresql-8.1: stopping...starting...done.
  gdm: reloading...done.
  cron: stopping...starting...done.
  courier-authdaemon: stopping...starting...done.
  atd: stopping...starting...done.

Services restarted successfully.
    

(Note: I got a couple of full-screen prompts in my terminal when running the "dpkg --configure libpam0g" -- those don't show up in the output I've included here).

Super -- I think I'm good to go. Now I told apt to "fix" my system (i.e. to continue the upgrade which it had been working on):

trotzdem:/var/cache/apt/archives# apt-get install -f
Reading package lists... Done
Building dependency tree... Done
Correcting dependencies... Done
The following extra packages will be installed:
  apt apt-move apt-utils aptitude base-files devscripts dia-common
  djvulibre-desktop dpkg dpkg-dev exim4-base exim4-daemon-heavy gaim
  gdk-imlib11 gimp gimp-data gimp-gnomevfs gnome-bin gnome-breakout
  gnome-libs-data gnucash gnucash-common gpppon gtimer gtk-gnutella gtkglarea5
  libao2 libapt-pkg-perl libaqbanking-data libaqbanking20 libauthen-pam-perl
  libboost-python1.34.1 libc6 libcairo-perl libcrypt-ssleay-perl libcwidget3
  libdbd-mysql-perl libdbd-pg-perl libdbi-perl libdjvulibre21 libept0 libgadu3
  libgif-dev libgif4 libgimp2.0 libglib-perl libglib1.2-dev libglib1.2ldbl
  libgnome2-canvas-perl libgnome2-perl libgnome2-vfs-perl libgnome32
  libgnomesupport0 libgnomeui32 libgnorba-dev libgnorba27 libgnorbagtk0
  libgoffice-0-4 libgoffice-0-common libgpm2 libgstreamer-plugins-base0.10-0
  libgstreamer0.10-0 libgtk1.2 libgtk1.2-common libgtk1.2-dev
  libgtk2-imageview-perl libgtk2-perl libgtkhtml3.8-15 libgtkhtml3.8-dev
  libgtkimageview0 libgwenhywfar47 libhesiod0 libimage-imlib2-perl
  libktoblzcheck1c2a liblocale-gettext-perl libmeanwhile1 libmetacity0
  libmozjs1d libnautilus-burn4 libnet-ssleay-perl libofx4 liborbit-dev
  liborbit0ldbl libpanel-applet2-0 libpg-perl libpoppler-glib3 libpoppler3
  libpurple0 libruby1.8 libsdl-perl libserf-0-0 libsilc-1.1-2
  libstring-approx-perl libsvn-perl libsvn1 libsys-syslog-perl
  libtext-charwidth-perl libtext-iconv-perl libtext-unaccent-perl
  libtotem-plparser10 libungif4-dev libungif4g libunicode-map8-perl
  libunicode-string-perl libvte9 libwnck22 libxapian15 libxdelta2
  libxml-libxml-common-perl libxml-libxml-perl libxml-parser-perl libzephyr3
  libzvt2 lsb-release mercurial-common metacity metacity-common mp3info-gtk
  orbit perl-base perl-tk pidgin pidgin-data python-central
  python-decoratortools python-eggtrayicon python-gtkhtml2 python-gtkmozembed
  python-pexpect python-pkg-resources python-setuptools python2.4
  python2.4-dev python2.4-minimal python2.5-dev subversion synaptic tcl8.4
  tcl8.4-dev tk8.4 tk8.4-dev tzdata vim vim-common vim-full vim-gnome
  vim-gui-common vim-runtime xchat xchat-common xdelta xulrunner-1.9
Suggested packages:
  apt-doc debtags cvs-buildpackage devscripts-el libnet-smtp-ssl-perl mutt
  eximon4 exim4-doc-html exim4-doc-info swaks libgimp-perl ghostscript
  gnucash-sql aqbanking-tools libc6-i686 libcwidget-dev dbishell gpm
  gnome-app-install gstreamer0.10-plugins libgtk1.2-doc libgtk2-perl-doc
  libgtkhtml3.8-dbg gwenhywfar-tools ktoblzcheck ofx xapian-tools lsb
  python-gnome2-extras-doc python-profiler subversion-tools db4.6-util dwww
  tclreadline tcl8.4-doc tk8.4-doc vim-doc vim-scripts cscope
  libnet-google-perl xulrunner-1.9-gnome-support
Recommended packages:
  aptitude-doc-en aptitude-doc libparse-debianchangelog-perl debian-keyring
  debian-maintainers equivs libauthen-sasl-perl libparse-debcontrol-perl
  libsoap-lite-perl libyaml-syck-perl lintian patchutils wdiff gnucash-docs
  libaqbanking20-plugins libaqbanking20-plugins-qt
  libaqbanking-plugins-libgwenhywfar47 gnome-mount libpurple-bin
The following packages will be REMOVED:
  bins bonobo debbuggtk dfontmgr findimagedupes gconf gnoise gocr-gtk graphviz
  gscan2pdf gtk-engines-industrial gtk-engines-pixmap gtkrecover guile-g-wrap
  html2ps j2re1.4 libbonobo2 libdigest-nilsimsa-perl libefs-dev libefs1
  libft-perl libgal-data libgal23 libgconf11 libglade-gnome0 libglade-perl
  libglade0 libglade0-dev libgladexml-perl libglib1.2 libgnome-perl
  libgnomeprint-bin libgnomeprint-data libgnomeprint15 libgtk-imlib-perl
  libgtk-perl libgtkhtml1.1-3 libguppi16 libgwrapguile1 liboaf-dev liboaf0
  liborbit0 libperl5.8 libterm-size-perl libwxgtk2.4-1 libxdelta3
  linuxvideostudio oaf perlmagick python-dispatch python-turbogears
  python-turbojson razor sooperlooper xmms xmms-mp4plugin xmms-status-plugin
  xsitecopy
The following NEW packages will be installed:
  djvulibre-desktop libaqbanking-data libaqbanking20 libboost-python1.34.1
  libcwidget3 libdjvulibre21 libept0 libgadu3 libgif-dev libgif4
  libglib1.2ldbl libgoffice-0-4 libgoffice-0-common libgpm2
  libgtk2-imageview-perl libgtkimageview0 libgwenhywfar47 libhesiod0
  libktoblzcheck1c2a libmeanwhile1 libmozjs1d libnautilus-burn4 libofx4
  liborbit0ldbl libpoppler-glib3 libpoppler3 libpurple0 libserf-0-0
  libsilc-1.1-2 libtotem-plparser10 libwnck22 libxapian15 libzephyr3
  lsb-release mercurial-common pidgin pidgin-data python-decoratortools
  python-eggtrayicon python-gtkhtml2 python-gtkmozembed python-pexpect
  python-pkg-resources python2.5-dev vim-gnome xulrunner-1.9
The following packages will be upgraded:
  apt apt-move apt-utils aptitude base-files devscripts dia-common dpkg
  dpkg-dev exim4-base exim4-daemon-heavy gaim gdk-imlib11 gimp gimp-data
  gimp-gnomevfs gnome-bin gnome-breakout gnome-libs-data gnucash
  gnucash-common gpppon gtimer gtk-gnutella gtkglarea5 libao2 libapt-pkg-perl
  libauthen-pam-perl libc6 libcairo-perl libcrypt-ssleay-perl
  libdbd-mysql-perl libdbd-pg-perl libdbi-perl libgimp2.0 libglib-perl
  libglib1.2-dev libgnome2-canvas-perl libgnome2-perl libgnome2-vfs-perl
  libgnome32 libgnomesupport0 libgnomeui32 libgnorba-dev libgnorba27
  libgnorbagtk0 libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libgtk1.2
  libgtk1.2-common libgtk1.2-dev libgtk2-perl libgtkhtml3.8-15
  libgtkhtml3.8-dev libimage-imlib2-perl liblocale-gettext-perl libmetacity0
  libnet-ssleay-perl liborbit-dev libpanel-applet2-0 libpg-perl libruby1.8
  libsdl-perl libstring-approx-perl libsvn-perl libsvn1 libsys-syslog-perl
  libtext-charwidth-perl libtext-iconv-perl libtext-unaccent-perl
  libungif4-dev libungif4g libunicode-map8-perl libunicode-string-perl libvte9
  libxdelta2 libxml-libxml-common-perl libxml-libxml-perl libxml-parser-perl
  libzvt2 metacity metacity-common mp3info-gtk orbit perl-base perl-tk
  python-central python-setuptools python2.4 python2.4-dev python2.4-minimal
  subversion synaptic tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev tzdata vim vim-common
  vim-full vim-gui-common vim-runtime xchat xchat-common xdelta
106 upgraded, 46 newly installed, 58 to remove and 1158 not upgraded.
380 not fully installed or removed.
Need to get 0B/130MB of archives.
After unpacking 26.1MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 250825 files and directories currently installed.)
Removing python-turbogears ...
Removing python-turbojson ...
Removing python-dispatch ...
(Reading database ... 250091 files and directories currently installed.)
...
...
...
    

The upgrade continued without any other issues.

Update: After the above command completed, I found that apt had "fixed" my system by installing necessary packages to fulfill dependencies, but that the full upgrade had not completed. So I re-ran the upgrade command:

trotzdem:/# apt-get dist-upgrade
    

Posted by Jason Hildebrand <jason@opensky.ca> Saturday Apr 18, 2009 at 12:28 PM