Monday, August 25, 2014

Upgrading to Ubuntu 14.04: "Error: Timeout was reached", "Segmentation fault (core dumped)" with APT and other stranges errors


This last weed-end, I tried to upgrade my old Bodhi Linux 2.4 based on Ubuntu 12.04 LTS to Bodhi 3.0 based on Ubuntu 14.04 LTS.


At some point something goes wrong with the update of the 1500 or so packages. I'm not sure about what happenned, but I started to see stranges errors, especially when trying to install/remove/correct package, but also in other part, for example when running some Python3 scripts.

Finally, everything was looking like working, but just almost working. Google fails on me on that, and I spend quite some time this week-end trying to go to the bottom of that problem, so I let a testimonial here, if it can help other people.

Symptoms

Segmentation fault (core dumped) with apt-get and python3 related scripts


This appears especially when trying to install/install -f "update-notifier-common" software, for example (sorry for the French):

% sudo apt-get install -f
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances      
Lecture des informations d'état... Fait
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
1 partiellement installés ou enlevés.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Paramétrage de update-notifier-common (0.154.1) ...
Segmentation fault (core dumped)
dpkg: error processing package update-notifier-common (--configure):
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 139
Des erreurs ont été rencontrées pendant l'exécution :
 update-notifier-common
Error: Timeout was reached
E: Sub-process /usr/bin/dpkg returned an error code (1)



The other aspect of that problem was that any Python3 related errors lead to a stack trace like that:

% python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> foo                                                                                                                                                                                                     
Traceback (most recent call last):
  File "", line 1, in
NameError: name 'foo' is not defined
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 20, in
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in
    import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-x86_64-linux-gnu.so: undefined symbol: _ZN13pkgTagSectionC1Ev

Original exception was:
Traceback (most recent call last):
  File "", line 1, in
NameError: name 'foo' is not defined



Error: Timeout was reached

The second main symptom was that when using apt-* tools, I was getting an error message "Error: Timeout was reached" just at the end of the process. Nonetheless, everything seemed to be correctly installed/removed/etc.


Bug tracking, short version


That led me to some bug about a timeout to short for packagekit:

/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 4 --method org.freedesktop.PackageKit.StateHasChanged cache-update

So I tested with a really big number, and got:

/usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 300 --method org.freedesktop.PackageKit.StateHasChanged cache-update

Error: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of org.freedesktop.PackageKit timed out


What lead to testing packagkit itself:

% sudo /usr/lib/packagekit/packagekitd --verbose
11:12:57        PackageKit          Verbose debugging enabled (on console 1)
11:12:57        PackageKit          keep_environment: 0
11:12:57        PackageKit          using config file '/etc/PackageKit/PackageKit.conf'
11:12:57        PackageKit          syslog fucntionality disabled
11:12:57        PackageKit          Log all transactions: 1
11:12:57        PackageKit          daemon shutdown set to 300 seconds
11:12:57        PackageKit          clearing download cache at /var/cache/PackageKit/downloads
11:12:57        PackageKit          destination eth0 is valid
11:12:57        PackageKit          setting config file watch on /etc/PackageKit/PackageKit.conf
11:12:57        PackageKit          ProxyHTTP read error: Key file does not have key 'ProxyHTTP'
11:12:57        PackageKit          searching for plugins in /usr/lib/x86_64-linux-gnu/packagekit-plugins
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-systemd-updates.so: A plugin to write the prepared-updates file
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-clear-firmware-requests.so: Clears firmware requests
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-check-shared-libraries-in-use.so: checks for any shared libraries in use after a security update
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so: Scans desktop files on refresh and adds them to a database
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so: Checks for running processes during update for session restarts
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so: Updates the package lists after refresh
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so: Maintains a database of all packages for fast read-only access to package information
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin_scripts.so: Runs external scrips
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so: A dummy plugin that doesn't do anything
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-check-shared-libraries-in-use.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          Trying to load : aptcc
11:12:57        PackageKit          dlopening '/usr/lib/x86_64-linux-gnu/packagekit-backend/libpk_backend_aptcc.so'
Failed to load the backend: opening module aptcc failed : /usr/lib/x86_64-linux-gnu/packagekit-backend/libpk_backend_aptcc.so: undefined symbol: _ZN13pkgTagSectionC1Ev11:12:57 PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-check-shared-libraries-in-use.so

11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          already closed (nonfatal)
11:12:57        PackageKit          parent_class->finalize


HooooOOoo... What about Aptitude ?


% aptitude
aptitude: symbol lookup error: aptitude: undefined symbol: _ZN3APT11CacheFilter39PackageArchitectureMatchesSpecificationC1ERKSsb



Solution

The problem was that somehow, I get a bad version of libapt-pkg4.12. So anything related to apt in some way had a chance to end badly.

Reinstalling the correct version of them (the one provided with my distribution) corrected all the problems:

sudo apt-get install libapt-pkg4.12=1.1.1bodhi1 apt=1.1.1bodhi1 apt-transport-https=1.1.1bodhi1 apt-utils=1.1.1bodhi1


Hope it helps !


Tuesday, April 1, 2014

Where all the activity went?

As you can see, the activity on that blog has been non existant for several years now. For the two visitor wondering, my main focus switch to my familly (2 sons, one other on its way), Normation (my company about devops, config management, etc: http://www.normation.com/ ) and of course Rudder (http://www.rudder-project.org/).

I'm still doing a ton of Scala, and you can find some articles on our company blog (http://blog.normation.com/) or slides about presentation I gave, like the one on Scala + ZeroMQ for Scala.IO 2013. It's on slideshoare: http://fr.slideshare.net/normation/

And of course, there is my Github page: https://github.com/fanf/ or twitter: https://twitter.com/fanf42

Hope to see you on these other media!

Thursday, November 17, 2011

Make firefox remember "autocomplete=off" password fields

Some site thinks that they better know than us what is security. For example, they want to prevent us to make firefox remember the login/password for them, and in the sametime, they don't allow to use a 30 char passphrase (because it does not contain a symbol, but six "!" is ok...).

If, like me, you are finding that behaviour as irrespectuous of your browsing experience as, say pop-ups, there is a trick:

  • install Firebug
  • on the page with the faulty password field, open Firebug.
  • use the blue mouse pointer in Firebug toolbar to select the password field
  • on the Firebug HTML tab, you should have a <input  type="password" autocomplete="off"....> field selected
  • double-click on "off" to edit the value and change it to "on". 
  • Now, enter you login/password as usual in the page form
  • when you hit "submit", Firefox should display the notification pop-up that allows to remember the login/password for that site. 
 Now, each time you are going to go on that page, firefox will autocomplete  the login/password as usual. 



Hop it will help other !

Sunday, February 6, 2011

Installing ZeroMQ and Java bindings on Ubunu 10.10

For some times now, I'm following the slow evolution of AMQP toward it's 1.0 release. In the trip, one traveler decided that the road was far too long, and complex, and choosed to take its independence: ZeroMQ is living its own adventure for some times now. And their choices are intersting, really focused and sharp, so I needed to see what can be done with that message system, and a bit of Scala.

So the first part was to install ZeroMQ and its Java binding into my computer, a Linux Ubuntu 10.10. It was quite easy, but as I didn't find a single post for the whole thing, I write that one as a memo, when in some days I will try to do it again and won't be able to remind the precise steps :)

Step 1: install recent ZeroMQ libraries

Before playing with some code, you need to install ZeroMQ libraries on your system. That library is on Ubuntu 10.10, but a more recent version seems to be needed for Java bindings. That's not a problem as some good will has made a PPA repository for them:

% sudo add-apt-repository ppa:chris-lea/zeromq
% sudo aptitude install libzmq-dev

That should install libzmq-dev (header files needed for the Java bindings) and the libzmq0 package - the core messaging system itself.

Step 2: get ZeroMQ binding

For that, you will have to clone the github repository of the project

% git clone https://github.com/zeromq/jzmq.git

And with that, you have a new jzmq directory with everything needed to build the Java bindings.

Step 3: build and install jzmq package

We are on a Debian based distribution, and ZeroMQ guys have the good taste to provide all what is needed to build a .deb for JZMQ, so let's just use the good work.
In the former jzmq directory, just do:

% ./autogen.sh
% dpkg-buildpackage -rfakeroot

And that's it. If all goes well, you should have a "jzmq_[some-version]_i386.deb" package on the parent directory of the one you are in. Just install it as usual:

% dpkg -i jzmq_[some-version]_i386.deb

And now, you can use ZQM from you Java code.

Some last notes

* don't forget to add the JNI library path in you JVM command line: use -Djava.library.path=/usr/lib
(/usr/lib should contains libjzmq.so, you can see it with dpkg -L jzmq)
If you the JAVA_HOME environment variable was correctly set when you buit the package,you may not have to add that parameter. 
* libjzmq.jar is in /usr/share/java/
* you will find some Java examples here.

That's it! Enjoy a world of easy message distribution.

Monday, January 31, 2011

Martin Odersky au Paris Scala User Group le 31 janvier

 Après pas mal de temps en sommeil, je réveille ce blog pour faire suivre cette annonce: Martin Odersky, le papa de Scala, fera une présentation au Paris Scala User Group, ce lundi 31 janvier. Plus de détails sont disponibles ici et ici.

J'en profite pour relayer l'information du financement à hauteur de 2.3 Million d'Euros sur 5 ans de Scala par l'Europe, ce qui devrait permettre de lever les dernières incertitudes quant à la pérénité du langage.



  © Blogger template 'Minimalist G' by Ourblogtemplates.com 2008

Back to TOP