26 February 2012

79. Bankid/nexus personal and iceweasel on Debian Testing

Update 19 Feb. 2013:
Here's an updated post: http://verahill.blogspot.com.au/2013/02/341-upgradinginstalling-bankid-on-64.html -- see that one instead, in particularly if you're upgrading.

Note that you may have to compile your own nspluginwrapper:
http://verahill.blogspot.com.au/2013/03/366-nspluginwrapper-on-debian.html

and you will need to enable multiarch to install ia32-libs:
sudo dpkg --add-architecture i386
sudo apt-get update

Original post:
Swedish banks and government institutions use bankid/nexus personal for electronic id verification. Sadly, it's a horrible solution -- it seems to be closed source, the bankid website is a POS which prevents me from downloading the 64 bit version claiming that it's not supported (I've used it for a few years now, so it's clearly bunkum).

Note that there's a FOSS alternative in Fribid (http://verahill.blogspot.se/2012/02/debian-testing-wheezy-64-fribid-as.html) which seems to be working perfectly -- and if you can use it, use it. The main limitation is that in practice you'll have to collect your certificate/ID with it, since newer versions of BankID saves the ID in an incompatible format. Like many foreigners, I don't have the opportunity to visit Sweden for the sole sake of picking up a new ID, so I'm stuck with BankID. But you may not be.

* A Swedish how-to is available here: http://ubuntu-se.org/wiki/NexusPersonal#Installation_p.C3.A5_64-bitarssystem

* Another, more recent how-to is here: http://popqvarnstrom.blogspot.com.au/2011/06/bankid-nexus-personal-on-ubuntu-1104-64.html

Note: I have never 'exported' my ID, but have always copied the ~/.personal directory between computers. The problem with exporting is that you are only allowed to do it once. The problem with Nexus allowing your to copy the file itself is that anyone with physical access to your computer can copy the key.

--START HERE --
 Here's a summary of how to get it working on debian testing wheezy:

In theory you should install nexus personal from here:
https://install.bankid.com/

I've got v 4.17.0.11 installed on a 64 bit system. The message on this page is a load of bollocks:


Whatever -- the good guys over at Arch supply a link:
wget http://install.bankid.com/Repository/BISP-4.19.0.11351.tar.gz

EDIT: you can use this generic url instead  https://install.bankid.com/Download?defaultFileId=Linux

tar -xvf  BISP-4.19.0.11351.tar.gz
cd  BISP-4.19.0.11351
 sudo sh install.4.19.0.11351.sh i
 Installing BankID Security Application
ln: failed to create symbolic link `/usr/lib/firefox-addons/plugins': No such file or directory
WARNING: Failed installing plugin for Firefox 3. Manually add symlink to libplugins.so in your Firefox 3 plugin directory if this browser is to be used.
Installation complete.

Since the plugin is 32 bit, you need to link it with nspluginwrapper, and you need 32 bit libs, so

sudo apt-get install nspluginwrapper ia32-libs




Also, as far as I can tell, you need iceweasel/firefox. Chrome/ium won't work.

sudo nspluginwrapper -i /usr/local/lib/personal/libplugins.so  

Check to see if it's installed:
nspluginwrapper -l
 /usr/lib/mozilla/plugins/npwrapper.libplugins.so 
 Original plugin: /usr/local/lib/personal/libplugins.so 
Plugin viewer: /usr/lib/nspluginwrapper/i386/linux/npviewer
Wrapper version string: 1.3.0  
And visit  the following page to make sure
 https://test.bankid.com/
Or your bank.


Your  key -- on a computer where you've used bankid before -- will be in ~/.personal -- don't bother trying to import or export it using the bankid/nexus personal programme (http://popqvarnstrom.blogspot.com.au/2011/06/bankid-nexus-personal-on-ubuntu-1104-64.html) since you're apparently only allowed to do that a certain number of times.

If you just plain copy the files, however, you can do it as many times as you want. I told you the programme is a POS. Anyway,

tree .personal
.personal
|-- backup
|   |-- config
|   |   `-- Personal.cfg
|   `-- store
|-- config
|   `-- Personal.cfg
`-- store
    |-- 1.ngp
    `-- 2.ngp


Nexus Personal/BankID is installed in /usr/local/lib/personal/

Links to this page:
http://popqvarnstrom.blogspot.se/2011/06/bankid-nexus-personal-on-ubuntu-1104-64.html

78. Fribid as an alternative to nexus personal on debian

Anyone who has needs to interact electronically with banks and government agencies in Sweden will become a victim of BankID/Nexus Personal.

It's a piece of crap. I've used it for several years, and have managed to get by. Now, however, if you try to download a newer version (I currently have 4.17.0.11) from a 64 bit debian machine you end up on a page that says:
 And there's little hope of getting past it.

Luckily, there's apparently an open-source project, fribid, which may be able to replace bankid/nexus personal for those who don't want to get stuck with 32 bit linux (seriously -- why does 4.17 work on 64 bit and future versions won't? And why won't you let me download an older, supported version? And why can't I chose what version I download? 32 bit windows from a 64 bit linux box -- and vice versa -- SHOULD BE POSSIBLE)

Anyway, fribid:


wget http://fribid.se/releases/source/fribid-1.0.0.tar.bz2
tar -xvf fribid-1.0.0.tar.bz2
cd fribid-1.0.0
./configure
make
sudo make install



I didn't have to do anything to 'install' it beyond that. Navigating in iceweasel to a website requiring bankid started fribid as it should and prompted me for the key file.

I can't explore the functionality beyond this, as fribid can only read keys downloaded with bankid/nexus v 4.10 or earlier -- pk12. The clincher here is that you can download the keys using fribid to begin with instead of first downloading them with bankid.

Lock-in, anyone?





Error:
ERROR: Unsatisfied dependencies:
  gtk+-2.0 >= 2.12
  gdk-2.0
  glib-2.0

Solution:
sudo apt-get install libgtk2.0-dev

77. Compiling Wine 1.4-rc4 and wine 1.4-rc5 on debian testing

UPDATE 16 May 2013: See here for Wine 1.5.30: http://verahill.blogspot.com.au/2013/05/416-wine-1530-in-chroot.html

A more exhaustive description of installing wine in general is here: http://verahill.blogspot.com.au/2012/01/debian-testingwheezy-64-bit-installing.html

I'm not a fan of running windows programmes on linux -- there are enough high-quality packages out there for linux to last you a life-time, and no matter how good wine is¸ the experience of running a windows program on linux is likely to be worse (if faster) than running it natively.

But like most people I'm help prisoner by my fellow co-workers who insists on dog+world using MS Office etc. Also, in spite of everything there are a few pieces of specialised software which lack linux equivalents.

UPDATE (10th Jan 2013): See here for Wine 1.5.21 using the multiarch approach: http://verahill.blogspot.com.au/2013/01/308-compiling-wine-1521-on-debian.html



Finally, from the point of view of easing new users off of windows and onto a real OS, wine and virtualbox fill important functions. I was myself a heavy user of both in the beginning, before learning how to use gnuplot, latex etc.

JPEG support is a PITA, but possible -- see below.

opencl -dev and lib32opencl1 require the contrib non-free repos, e.g.
deb ftp://ftp.au.debian.org/debian/ testing main contrib non-free
Updated: I've tried the same guide on wine 1.4-rc5

--- START HERE ---
With that out of the way, here's building wine 1.4-rc4

First, you need a whole lot of packages -- these will be installed if you've previously compiled wine according to this:

sudo apt-get install bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev opencl-dev lib32opencl1 oss4-dev gettext

sudo apt-get install lib32v4l-dev lib32ncurses5-dev lib32asound2-dev lib32z-dev ia32-libs-dev

To enable jpeg support you are SUPPOSED TO:
First, remove existing symlinks
sudo rm /usr/lib32/libjpeg.so.62 /usr/lib32/libjpeg.so.62.0.0
Then, create new ones
sudo ln -s /usr/lib32/libjpeg.so.8 /usr/lib32/libjpeg.so.62
sudo ln -s /usr/lib32/libjpeg.so.8 /usr/lib32/libjpeg.so.62.0.0

Download the sources and expand:
wget http://prdownloads.sourceforge.net/wine/wine-1.4-rc4.tar.bz2
bzip2 -d wine-1.4-rc4.tar.bz2
tar -xvf wine-1.4-rc4.tar
./configure

If you get errors, see below and here for solutions. Missing libraries are often ok -- it just means certain functionality will be missing. It's up to you what is important. If you followed the instructions above you'll have jpeg support in spite of what configure spits out.

make -j7

as usual 7 is the number of cores +1. If you have a dual core, replace 7 with 3. Parallel building is sometimes much, much faster than just using one core, sometimes not.
If you already have a version of wine installed, this is a good time to uninstall it. Then,

sudo checkinstall

builds a .deb package and installs it. It's useful if you need to uninstall in the future.

The

Copying documentation directory...
./
./VERSION
./AUTHORS
./LICENSE
./README
./ANNOUNCE
./COPYING.LIB

part takes forever. It will finish in about ten minutes or so. If the building of the debian package fails, make sure you set the version number correctly (see errors below).


aptitude show wine-1.4
Package: wine-1.4                      
New: yes
State: installed
Automatically installed: no
Version: 1.4-rc4-1
Priority: extra
Section: checkinstall
Maintainer: root@beryllium
Uncompressed Size: 129 M
Description: Wine 1.4-rc4

Done.

Updated 02/03/2012:

For Wine1.4-rc5:
 wget http://sourceforge.net/projects/wine/files/Source/wine-1.4-rc5.tar.bz2
tar -xvf wine-1.4-rc5.tar.bz2
cd wine-1.4-rc5/
./configure
gstreamer, libgsm, libtiff, libjpeg warnings. You can ignore them.
make
sudo checkinstall


List of errors:

Error:
configure: OpenCL 32-bit development files not found, OpenCL won't be supported.

Solution:
sudo apt-get install lib32opencl1 opencl-dev


Error:
configure: gstreamer-0.10 base plugins 32-bit development files not found, gstreamer support disabled
No solution:
Not the only one with this problem...I don't care enough about video to follow this up any more. Likely, an approach similar to this will work: http://forum.winehq.org/viewtopic.php?t=5797&sid=afde9de83a98b8cb24df2bb3646930b6


Error:
configure: OSS sound system found but too old (OSSv4 needed), OSS won't be supported.

Solution:
 sudo apt-get install oss4-dev


Error:
configure: libgsm 32-bit development files not found, gsm 06.10 codec won't be supported.
Solution, maybe:
I don't care too much,  but there are solutions if you are desperate enough: http://forum.winehq.org/viewtopic.php?t=5797&sid=afde9de83a98b8cb24df2bb3646930b6



Error:

configure: libtiff 32-bit development files not found, TIFF won't be supported.

No soution:
This comes up on some boxes, but not others. Comparing the installed packages I have no idea why.

aptitude search tiff|grep dev


v   libtiff-dev                     -                                        
i A libtiff4-dev                    - Tag Image File Format (TIFF) library (old
p   libtiff5-dev                    - Tag Image File Format library (TIFF), deve

ls /usr/lib32/libtiff* -lah
 /usr/lib32/libtiff.a
 /usr/lib32/libtiff.la
 /usr/lib32/libtiff.so -> libtiff.so.4.3.3
/usr/lib32/libtiff.so.4 -> libtiff.so.4.3.3
 /usr/lib32/libtiff.so.4.3.3
 /usr/lib32/libtiffxx.a
 /usr/lib32/libtiffxx.la
 /usr/lib32/libtiffxx.so -> libtiffxx.so.0.0.7


Error:
configure: WARNING: gettext tools not found, translations won't be built.
Solution:
sudo apt-get install gettext


Error:
configure: WARNING: libjpeg 32-bit development files not found, JPEG won't be supported.

Solution:
First, install
sudo apt-get install libjpeg8-dev

This pointed me here.

Here's how to check for the bug
 locate libjpeg | grep 32
/usr/lib32/libjpeg.a
/usr/lib32/libjpeg.la
/usr/lib32/libjpeg.so
/usr/lib32/libjpeg.so.62
/usr/lib32/libjpeg.so.62.0.0
/usr/lib32/libjpeg.so.8
/usr/lib32/libjpeg.so.8.0.2
ls /usr/lib32/libjpeg.* -lah

 /usr/lib32/libjpeg.a
/usr/lib32/libjpeg.la
/usr/lib32/libjpeg.so -> libjpeg.so.62.0.0
/usr/lib32/libjpeg.so.62 -> libjpeg.so.62.0.0
/usr/lib32/libjpeg.so.62.0.0
 /usr/lib32/libjpeg.so.8 -> libjpeg.so.8.0.2
 /usr/lib32/libjpeg.so.8.0.2

Yup, libjpeg.so points to v 6.2 instead of v 8 which I have installed.

According to the bug report, the cause of the error is that the header file jpeglib.h states one version, and the /usr/lib32/libjpeg.so points to another:

cat /usr/include/jpeglib.h|grep "LIB_VERSION"| grep define
#define JPEG_LIB_VERSION        80 /* Compatibility version 8.0 */
#define JPEG_LIB_VERSION_MAJOR  8
#define JPEG_LIB_VERSION_MINOR  4

FIX:
Remove existing symlinks
sudo rm /usr/lib32/libjpeg.so.62 /usr/lib32/libjpeg.so.62.0.0
Create new ones
sudo ln -s /usr/lib32/libjpeg.so.8 /usr/lib32/libjpeg.so.62
sudo ln -s /usr/lib32/libjpeg.so.8 /usr/lib32/libjpeg.so.62.0.0

ls /usr/lib32/libjpeg.* -lah now gives

 /usr/lib32/libjpeg.a

 /usr/lib32/libjpeg.la

/usr/lib32/libjpeg.so -> libjpeg.so.62.0.0

 /usr/lib32/libjpeg.so.62 -> /usr/lib32/libjpeg.so.8

 /usr/lib32/libjpeg.so.62.0.0 -> /usr/lib32/libjpeg.so.8

/usr/lib32/libjpeg.so.8 -> libjpeg.so.8.0.2

/usr/lib32/libjpeg.so.8.0.2


The error message remains on ./configure, but jpeg support is /supposed/ to work in spite of this.


Error:
Building Debian package... FAILED!
*** Failed to build the package
Do you want to see the log file?  [y]:
dpkg-deb: error: parsing file '/var/tmp/tmp.Y50XUaisW0/package/DEBIAN/control' near line 7 package 'wine-1.4':  error in Version string 'rc4-1': version number does not start with digit

Solution:
sudo checkinstall
This package will be built according to these values:
0 -  Maintainer: [ root@beryllium ]
1 -  Summary: [ Wine 1.4-rc4 ]
2 -  Name:    [ wine-1.4 ]
3 -  Version: [ rc4 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ wine-1.4-rc4 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ wine-1.4 ]
12 - Conflicts: [  ]
13 - Replaces: [  ]
Enter a number to change any of them or press ENTER to continue: 3
Enter new version:
>> 1.4-rc4