Monday, December 31, 2012

FBReader on Android

Finally, I used the FBReader on an Android tablet. It is far easier to read on it than I had expected. The 7inch screen is a very convenient alternate to the paperback.

I ended the year 2012 by reading two stories - perhaps symbolic for the last day of the year.

Kurt Vonnegut's 2BR02B and Kafka's Metamorphosis.

I had read Metamorphosis 40 years ago and its impact had been so strong and saddening that although I had downloaded the book months ago, I had been hesitating to read it again. Yesterday, I heard Kafka's A Hunger Artist and overcame my hesitation. Rereading it was an amazing experience even on a tablet.

Saturday, November 3, 2012

Renewing and speeding up my desktop

I had decided to buy a new desktop as the current one seemed too slow. It just did not seem useful to buy more cpu cores for primarily browsing the web.

I had been looking for solid state disk options for the last few months after reading about their prices crashing. Unfortunately, this was not reflected in the prices of these disks in my area. However, recently I found an online store offering a reasonably attractive price for a 60GB SSD. It was delivered to me the day I read Linus Torvalds"Get thee behind me, Satan" comment . A very nice coincidence.

Indeed, my desktop's performance now is terrific. I can save it from a landfill for another few years :)

Saturday, August 11, 2012

VBA Macros of Indian Income Tax forms failed on current LibreOffice

I had experimented with filing Indian tax returns using OpenOffice earlier. Last year, I had used LibreOffice and filed my return. The effort was minimal as I had not felt the need to document it.

This year, the result was painful. The simplest of forms failed with LibreOffice 3.5 and I could not even make any sense of the problems. I tried older versions (3.4) that I found on some of my partitions and those failed as well.

In desperation, as the deadline was approaching, I downloaded OpenOffice and, surprisingly, that worked on ITR1 (simplest return). However, editing the macros needed for the other forms was a pain. Running the macro from within the editor started the execution from the first line of the file and not from the selected macro. I found the behavior confusing in comparison to LibreOffice and preferred to give up :)

I realized that I had used version 3.3 last year and I had an old partition with an old version of ArchLinux - which had the 'right' version of LibreOffice. The process of filling the tax return forms was very tedious. I had to find the password for the sheets, unlock them and make some manual changes to the cell formulas. However, at the end of it, I did manage to submit the returns using the open source tools.

I had planned to experiment and see if I can find out what changed from LibreOffice 3.3 to 3.4 to cause this 'regression' but now I will wait till the 3.6 version is available through ArchLinux or Fedora.

Meanwhile, I plan to preserve the old ArchLinux partition for next year and, hopefully, thanks to this entry, I won't struggle too much.

Tuesday, June 26, 2012

Drupal 7 - Creation of Content Disappeared - Problems of Point and Click

I have been exploring Drupal 7,  particularly in trying to control access to creation of content followed by moderation by the appropriate editor. Even though I may be convinced that the level of control sought is unnecessary; but since it should be doable, might as well make it available.

I added the Workbench Access and Workbench Moderation modules. After I had suitably configured everything along with LDAP authentication, I found that the content just could not be created. I repeated the process, without LDAP, and still the same result.

I created a new content type and it worked the way it was intended. I just could not figure out what was going wrong with existing content types.

In a moment of "inspiration", I decided to examine the Navigation menu. As the Workbench user interface includes a tab for creation of content, I had excluded the "Add content" and subsidiary content creation entries from the Navigation menu. The new content type I created had the entry in the sub-menu enabled. Since the parent "Add content" was not in the menu, the child entries were not visible.

I enabled the existing content types in the Navigation menu and the content could indeed be created by the correct users.

Finally - after going around in circles for over a day! In retrospect, that wasn't too bad.

Friday, June 22, 2012

OpenLdap, Fedora 17 and Modifying Schema

Continuing my experiments with OpenLDAP, I needed to add mail attribute, which requires inetorgperson.schema. As I had not included it in the beginning, I wanted to modify  the schema. It should not be hard but I couldn't find a simple answer.

The discussion  "how-to-add-a-new-schema-to-openldap-2-4-11" gave a hint. Ldif files were needed and Fedora distribution includes them. So, I tried the the command
$ sudo ldapadd  -Y EXTERNAL -H ldapi:///  -f /etc/openldap/schema/inetorgperson.ldif

And it worked. However, since migration tools use the objectClass account which is inconsistent with inetOrgPerson, it turned out to be easier to recreate the ldap database.

Wednesday, June 6, 2012

OpenLDAP, Slapd, Fedora 17 and Authentication

Once the LDAP database is ready following the steps in the previous post, we can use authconfig-gtk to configure authentication via ldap. On Fedora, for using LDAP passwords either TLS/SSL or LDAPS is required.

The changes in Fedora 17 make getting started much easier. OpenLDAP creates a directory /etc/openldap/certs and creates an empty database of certificates (using /usr/libexec/openldap/create-certdb.sh)

During the installation, openldap-servers  runs /usr/libexec/openldap/generate-server-cert.sh which creates a dummy certificate for the local host and adds it to the certificates database in /etc/openldap/certs.

There is a small inconsistency, which should be resolved soon or it could have been caused by a file from earlier versions which is not replaced by the upgrade.

The files /etc/openldap/ldap.conf and /etc/sssd/sssd.conf use /etc/openldap/cacerts as the directory for the certificates. I needed to manually change that to /etc/openldap/certs.

When I was having problems with certificates, including ldaps in SLAPD_URLS in /etc/sysconfig/slapd and using the following command was helpful:
ldapsearch -ZZ -d 1 -x -LLL  -W -D cn=Manager,dc=example,dc=com -H ldaps:///
Update and caution: I find that slapd fails to start on reboot. It seems to timeout on some operation. However, it works fine upon:
$ sudo systemctl start slapd.service
Update: this was an issue of too small a timeout for my system in /usr/lib/systemd/system/slapd.service. Commenting the timeout solved the issue.
#TimeoutSec=3

Next: Modifying the schema.

OpenLDAP on Fedora 17 - Understanding Installation

As per the motivation in my previous post, I cleaned up slapd.d and various other files to start with a blank state on Fedora 17. Slapd would not start. It now needs slapd.d to exist.

Examining the installation script:
rpm -q --scripts openldap-servers
we notice that it creates fresh slapd.d at start as follows:
 /usr/libexec/openldap/convert-config.sh
                           -f /usr/share/openldap-servers/slapd.ldif
Obviously, the script is smart enough to upgrade the existing files and database in case slapd is already running.

We can customize slapd.conf as follows for our needs:
  1. Modify realm in olcAccess, olcSuffix and olcRootDN entries. 
  2. Add an entry for olcRootPW -  olcRootPW:"slappasswd output"
  3. Add needed schemas, e.g. cosine and nis as only core schema is included by default.
Create the starting slapd database and start the daemon:
$ sudo /usr/libexec/openldap/convert-config.sh -f slapd.ldif
$ sudo systemctl start slapd.service
 I created base.ldif, users.ldif and groups.ldif using the migrationtools and added them to the ldap database:
$ ldapadd -x -W  -D cn=Manager,dc=example,dc=com  -f base.ldif 
It should now be possible to use this server for authentication.

More in next post.

OpenLdap, Slapd and Fedora 17

Single most useful statement about OpenLdap I found was in "LDAP for Rocket Scientists" :
The bad news is that IOHO never has so much been written so incomprehensibly about a single topic with the possible exceptions of BIND and ... and ...
Last time I had used slapd was some years ago. I needed to help a colleague. Fortunately, it was on Ubuntu and the absence of slapd.conf was not too intimidating. It wasn't hard to find that all one needed to do was
# dpkg-reconfigure slapd
I would need to help my colleague some more. So, I decided to set one up at home - on Fedora 16. And that is when I found the comment from "LDAP for Rocket Scientists". There did not seem to be an equivalent of Debian option for getting started. Also, the slapd.d files are substantial differences in the files in slapd.d in Debian and Fedora. Although I managed to get started using ldapmodify, the feeling has been that there has to be a simpler way, especially when I started using tls.

I used self-signed certificates but was having difficulty in getting the certificated trusted. Meanwhile, I upgraded to Fedora 17. There were changes in the way slapd is setup. Instead of /usr/openldap/cacerts, it uses /usr/openldap/certs directory. There are some scripts like generate-server-cert.sh and upgrade-db.sh. There must be some documentation somewhere about these changes. I just haven't found it yet.

So, I plan to drop the slap setup done so far. Start afresh on Fedora 17, making use of the tools provided and see if it makes life simpler.

A few simple things which have tripped me so far -
  • Each ldap application is a client and has its own configuration file. It does not need to use /etc/openldap/ldap.conf
  • Fedora now relies on sssd for ldap authentication. Since I keep upgrading my system, it did not have this server and was using nss_ldap and pam_ldap.
  • The 'Common Name' on the certificate. 
The steps in next post.

Saturday, June 2, 2012

Upgrading to Fedora 17 - using yum

Since my experience with preupgrade on the desktop was not so great, I decided to take a chance with upgrading my Lenovo S10-3 netbook to fedora 17 using yum.

The additional steps of modifying the filesystem using dracut were not really complex.

Most of the packages had already been downloaded by preupdate, which I had preserved. I copied them into the cache of  yum and executed:

# yum --releasever=17 --disableplugin=presto distro-sync

Unfortunately, after updating about 500 packages, yum seemed to be doing nothing. I killed the command. And ran yum-complete-transaction. It seemed to be using the repositories of Fedora 16 even though fedora-release files had been installed. So, I ran

# yum-complete-transaction --releasever=17

After a pretty long time, it told me that there were problems. I tried again with

# yum-complete-transaction --releasever=17 --skip-broken

An equally long wait and no better result. The problem was that rpm database had entries for both 16 and 17 versions for the packages which were updated.

The following command also did not help (Next time, I need to try with  the -t option to see if it would have tolerated errors).

# package-cleanup --cleandupes

The problem was that packages which had not yet been updated depended on the duplicates. Had I allowed this script to run, it would have deleted most of the packages.

I found a python script I had written when an upgrade from FC7 had failed because of power failure. The script created a file with the list of older duplicates, which could be used as an input to rpm as below:

# rpm --nodeps -e `cat deleteList.txt`

Finally, I cleaned up the failed yum transaction and ran:

# yum --releasever=17 --disableplugin=presto distro-sync

This time, the upgrade finished cleanly. Although it took about the same time and effort as the preupgrade, I enjoyed solving these problems a bit more.

Firefox crashes

As on the desktop, firefox crashed with even a few tabs. It seemed to be a random problem. However, I downloaded Firefox 12 from Mozilla and firefox works fine!


Updgrading to Fedora 17 - preupgrade

I took this advice in upgrading via yum seriously :
However Fedora 17 is very special. You should seriously consider stopping now and just using anaconda via. DVD or preupgrade, unlike all previous releases it's what the yum/rpm developers recommend. Continue at your own risk.
I decided to use preupgrade. I would have preferred yum as I would have more control over the update even if it were riskier. Anyway, the preupgrade went through nicely overnight. About 4 GB was downloaded and I was ready for the final stage.

Uses grub2 

I rebooted the system and it did nothing. I have continued to use grub and had not migrated to grub2. Preupgrade had created a new file grub.cfg in /boot/grub2. After failing to get the upgrade kernel to boot from grub, I installed grub2. It was easier than I had feared. It left the grub.cfg file untouched. I rebooted and the upgrade started.

It soon told me that I needed an additional GB of space. After making the additional space, I rebooted and the upgrade started. Everything was fine until it was cleaning up files. It just wouldn't end. I noticed at least 3 times glibc being cleaned up. There was little option but to reboot.

The reboot went through the upgrade process and felt that everything was done. I was ready to reboot into Fedora 17, except that the grub.cfg file was still the same and the preupgrade files had been removed. Fortunately, using the minimal editor in grub, I could boot using the F17 kernel. The first thing I did was to create a new grub.cfg file. The fireworks on the desktop looked nice.

SSH and password-less login

One minor issue was that I needed to give the password for using ssh from my remote system. I needed to copy authorized_keys2 to authorized_keys in .ssh.

Firefox crashes

Firefox seems to crash with a few tabs. It seems to be a random problem. However, if I download Firefox 12 from Mozilla, it works fine!

Save preupgrade files in case you want to upgrade more than one system.

I did not want to download the files again for my netbook. As a precaution, I had saved all the preupgrade files, in particular the rpm packages. As I feared, it cleaned up and even though keepcache was set, there were no packages of fedora 17 in the yum cache after the upgrade.

Thursday, May 17, 2012

Making Canon LiDE 110 flatbed scanner work on Fedora 64 bit

Update: I will never know what was the actual the reason because I can no longer reproduce the problem. The scanner works with the same sane-backend rpms.

It has been bothering me for months as to why does the Canon LiDE 110 work fine on Ubuntu and Arch Linux but not on Fedora. However, I finally got around to spending some effort on it.

I downloaded the stable source from the sane project. Installed it on top of fedora's rpm's. It worked. However, it seemed surprising but may be fedora had made some changes. They hadn't.

I had made a silly mistake and installed the libraries in /usr/lib instead of /usr/lib64. So, I uninstalled it and rebuilt sane-backends with
./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64

Now, the scanner stopped working!

Uninstalled it, rebuilt sane-backends with
 ./configure --prefix=/usr --sysconfdir=/etc

The scanner was now recognized! So, it somehow needed some libraries to be installed in lib.

Ubuntu uses lib on x64 as well. And I was using 32 bit version on Arch Linux!

Saturday, April 28, 2012

Why I prefer talking to Software

My wife suggested that I call the call center for a billing clarification. I prefer not to do so and this experience again reinforces my preference.

I got the clarification that the additional bill amount was some additional installation charges - it was too small for me to argue about it. However, the human insisted on telling me about a great 70% off promotional offer, which I declined politely without even listening to it. To my surprise my no was ignored. A few hours later, the offer was enabled on my set-top box.

This time I used the online complaint but the call center called back as I expected. He was going to delete the additional package but wanted to explain the offer to me. I got irritated - the f.. word got him off my back but ruined my mood.

I think it is in God Bless You Mr. Rosewater that Kurt Vonnegut raises the question - what's the purpose of humans on earth!

Sunday, April 22, 2012

Goofing up with Miro - could the UI be smarter?

I have been using Miro for several years. So, it isn't that I was unfamiliar with the user interface. However, I am still bewildered that how did I remove all the TED videos I had downloaded instead of deleting the one sentimental video I intended to delete.

A major part of the problem was the poor response of Miro on the netbook. I had clicked the delete option on the video as it was playing. It did not seem to have worked. I deleted it from the video list and clicked on a menu option to confirm deletion. I clicked on the form several times as it did not seem to respond. I clicked multiple times because on the netbook, I often needed to click twice for Miro to queue my download request.

Since nothing seemed to be happening, I suspect that I must have clicked on remove podcast option absentmindedly. I am hoping that I had clicked on a confirmation screen after I clicked on remove podcast. It would have been a very unfortunate programming issue if one of my earlier clicks had been taken as a confirmation for the deletion of the podcast!

This is, obviously, nothing more than a minor 'disaster' or, more precisely, an irritation. It does raise the issue of how does the software UI behave in a sluggish environment. Can we code UI in such a way that the intentions of the user and their interpretation is not distorted by performance issues of the application?

We also need a better alternative to the confirmation screen. I doubt if anyone reads the confirmation screen before clicking after the first few times. So, how about a confirmation screen after the event with an UNDO button instead of an OK?

Tuesday, March 27, 2012

Creating a presentation for showing source code

Giving a presentation which has source code fragments has never been easy.

Normally, I have been pasting code fragments in an OpenOffice presentation. The effort in getting it right has been sufficiently irritating that I try to avoid it.

I finally used a process which I found very convenient.

1. Use vim :TOhtml command to get color coded source code. It was even easier using gvim.

2. Open the html file in OpenOffice. Change the font size to 16.

3. Create a new OpenOffice text document. Choose page size as A5 and landscape orientation.

4. Copy paste the fragments. Add comments, etc. Edit like a normal text document.

5. Export it to pdf.

6. Show it using the presentation mode in evince or  okular.




Monday, March 5, 2012

Overcoming Slow Boot of Fedora 16 after LiveCD installation

I had failed to upgrade Lenovo S10-3 netbook to Fedora 16 using yum as I have been doing for several years and successfully did on my desktop. The system became unusable under Fedora; so, I could not diagnose the cause.

I installed KDE livecd spin on the netbook. The boot time seemed to be ages in comparison to Fedora 15 and, especially, Arch Linux which I normally use on this netbook.

Searching the net for plausible reasons led to using "systemd-analyze blame". The top of the list was "udev-settle.service", which really is not the issue.

Anyway, I noticed that there were livesys.service and livesys-late.service which are not needed once the livecd is installed. The time shown for these by "systemd-analyze blame" was 290ms and 44msec respectively. Hardly something to worry about. However, disabling the livesys and livesys-late services resulted in the userspace boot time decreasing from 87 sec to 36 sec! The overall decrease was 97 sec to 44  sec :)

Now, "systemd-analyze blame" gave a little more useful details. The top entry was iscsi.service. Wikipedia entry indicated that this was not something I was likely to use. Disabling iscsi and iscsid services reduced the userspace boot time to 27 sec and overall time to 37 sec.

Removing mdmonitor-takeover and lvm2-monitor services did not make any significant difference.

Disabling httpd and and mysqld, which I normally do not need on the netbook, saved another 5 sec and the boot time now is 32 sec of which 22 is the userspace time.

Next step is to use bootchart to see if I can understand where the time goes before the system becomes usable.

Saturday, February 4, 2012

Depressing use of technology

The parking lot at the Chandigarh airport is computerised!

You get a ticket on entering the airport - NOT the parking lot. If you leave within 5 minutes, you pay nothing. If you are in the airport longer than 5 minutes, you pay Rs. 25/ (50 cents) on exiting.

The problem - it is a small airport. There is only one exit from the parking lot and another exit in case you do not enter the parking lot.

It is pretty obvious that the traffic the arrival of vehicles will follow a statistical pattern but the exit is deterministic. People want to leave as soon as the plane arrives. Hence, the exiting from the parking lot is a pain! It is easier to exit if one does not enter the parking lot.

Technology has achieved the remarkable goal of making the life of people who park miserable while rewarding the folks who create chaos on the unloading/loading curb :)

Oh, well, at least the airport is using software and the two exit points and the entry point are even NETWORKED :)