09 January 2013

310. Remote mounting using sshfs

I've run out of USB ports on my work desktop, so I occasionally cheat and attach USB drives to one of my compute nodes and transfer the files across the network to my desktop. Since I've got a gigabit switch set up, the speeds are quite acceptable.

NFS isn't really a solution here. Instead, sshfs is the tool to use.

The local and remote computer will be referring to Desktop and Node, respectively. The specific example I'm using here is that of a USB drive manually mounted on the Node, which contains pictures that I want to transfer to my Desktop.

On the Node
The plugged in USB device is found as /dev/sdb, and holds only one partition, /dev/sdb1.

sudo mkdir /media/usbdrive
sudo mount /dev/sdb1 /media/usbdrive


On the Desktop

sudo apt-get install sshfs
sudo mkdir /media/remote
sudo sshfs $USER@Node:/media/usbdrive /media/remote -o allow_other

That's about it. To unmount do
sudo umount /media/remote

and
sudo umount /media/usbdrive

respectively.

08 January 2013

309. Installing Office 2003 in Wine on Debian Testing

UPDATE 4 Feb 2013: Equation Editor under Office 2003 used to be support on Wine/Crossover. The devs are aware of it and looking into fixing the regression.


Bug reports to that effect:
http://bugs.winehq.org/show_bug.cgi?id=32697 and http://www.codeweavers.com/support/tickets/browse/?ticket_id=931759


UPDATE: I've since tried this using CrossOver 12 as well. The installation goes much more smoothly (the .exe file works fine), and you basically don't need to do anything except click 'Next' a couple of time. The Equation editor still doesn't work though. There's a free 15 day trial version of CrossOver available at http://www.codeweavers.com/products/. If running Office 2003 is your goal there seems to be little difference between CrossOver and Wine. However, I ended up buying a copy of crossover anyway since at this stage of my life and career it's not that much money and by supporting crossovre you indirectly support wine.

Since I would guess at the lack of Office for Linux as the single most problematic issue facing those wishing to switch from Windows or Mac to Linux, and since it would be something attempted very early on in someone's experience of Linux, it doesn't hurt to show the steps in detail -- especially since there are a few stumbling stones.

The linux community like to suggest new adopters to run Word under Wine, or better yet, to use libre/openoffice. It's an open secret that there are issues though. Most casual users won't notice most of the time,  but problems do exist.

In the particular case of Office 2003 under Wine, my main issue is that there's no way of installing Microsoft Equation Editor from what I can see, and it is a feature I do use when publishing together with other people (sweet, sweet TeX...). Another issue is that figures tend not to show up well or at all (complaints about memory -- most of our collaborative files are >5 Mb) when I use Word under Wine. These aren't issues when running in a virtual machine, which is the way I usually suffer through my bouts with Office.

An added head ache is this: http://wine.1045685.n5.nabble.com/Bug-26358-New-Office-2003-installer-crashes-immediately-td3414859.html and  http://bugs.winehq.org/attachment.cgi?id=35449. Using any of the versions of Wine above I just can't install using the setuppro.exe. This bug report ( http://bugs.winehq.org/show_bug.cgi?id=31942) showed me the simple solution though: using pro11.msi instead.

Anyway, just be aware of the limitations -- you can't install office, then do wine control, "add/remove programs", and add e.g. Microsoft Equation Editor. Likewise, if you try to be smart and do a custom install, and choose advanced customization, the installation will fail and complain about missing CAB files (in the case of equation editor: 01561403.cab). I've also tried installing MathType 4, which shows up under Objects, but is reported as missing when selected.

Otherwise this works fine.

Wine
To install the official wheezy version of wine:
sudp dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install wine wine-bin:i386 libwine-bin:i386 libwine:i386

You can also see the following posts on this blog for how to install/compile wine:
1.5.21 (using multiarch)
1.5.19 (using the dev.carbon-project.org rules)
1.5.5 (using the dev.carbon-project.org rules)
1.5.5 (downloading precompiled debs)

For this installation I've used Wine 1.5.19.

Installation
First set up cabextract and winetricks and install corefonts etc.
sudo apt-get install cabextract ttf-mscorefonts-installer
wget http://winetricks.org/winetricks
chmod +x winetricks
./winetricks corefonts fontfix

If you have Office 2003 as an OFFICE11.iso file (likely if you're at e.g. a university) then loop mount that file
In the directory where your iso file is:

sudo mkdir /media/OFFICE11
sudo mount -o loop OFFICE11 /media/OFFICE11
mount: warning: /media/OFFICE11/ seems to be mounted read-only.
wine msiexec /i /media/OFFICE11/pro11.msi

If you get any questions about Gecko or Mono, go ahead and let them install. Anyway, this launches the installation -- just do what you'd do under Windows, with the following caveats:

Important: You can't go back and install missing programs, so install all that you want from the beginning. Also, if you try to do advanced customisation and install Equation Editor (maybe other programs too) the installation will fail and complain about a missing CAB file. It hasn't always been so  apparently.


Running
Launch it as any other gnome or kde program, or from the terminal do
wine ~/.wine/drive_c/Program\ Files/Microsoft\ Office/OFFICE11/WINWORD.EXE

308. Compiling Wine 1.5.21 with multiarch on Debian Testing -- clean multiarch build

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

Another update (28/1/2013): It seems like your mileage in terms of how well Wine will work for you will vary using this method. It works fine for me and I suspect it's because I've built earlier Wine versions of my systems and have ia32-libs-dev installed. This package is no longer available in Testing. ia32-libs installs the libs you need, but does not provide symlinks between .so and .so.X files -- you can probably do that by hand if necessary though. It's not for beginners.

An additional thing to remember is that the 1.5 series of Wine is a development series -- 1.4 is the stable series which is meant for end users. Progress made in 1.5 will be included in 1.6.


Update2 (26 Jan 2013): there are a couple of issues, and they will depend on how your system is set up.
* libosmesa6-dev:i386 will require mesa-common-dev:i386 which will remove libosmesa6-dev:amd64 and more, which is bad.
* libglu1-mesa-dev:i386 depends on libgl1-mesa-dev:i386 which will remove libgl1-mesa-dev:amd64 and more, which is bad.
*  libgstreamer-plugins-base0.10-dev:i386 depends on libgstreamer0.10-dev:i386 which depends on gir1.2-gstreamer-0.10:i386 which depends on gir1.2-freedesktop:i386 which depends on gir1.2-glib-2.0:i386 which depends on libgirepository-1.0-1:i386 which will remove a whole lot of packages (132 on one of my systems, including gnome, gdm3 etc.)

I'm working on figuring out what's triggering this on some systems but not others. Be aware that that doesn't necessarily mean that I will be successful in doing so -- any help is appreciated.

In the mean time see http://verahill.blogspot.com.au/2013/01/308-compiling-wine-1521-on-debian.html to see how to build wine in a chroot, which is safe. You can then install that .deb package on your normal system and HOPEFULLY there won't be any broken dependencies. You won't need the -dev:i386 packages on the install target.


ldd `which wine` 
linux-gate.so.1 => (0x55573000) libwine.so.1 => /usr/local/lib/libwine.so.1 (0x55576000) libpthread.so.0 => /lib32/libpthread.so.0 (0x556ec000) libc.so.6 => /lib32/libc.so.6 (0x55705000) libdl.so.2 => /lib32/libdl.so.2 (0x55867000)
so you really don't seem to need much in the way of shared libs installed.



Old Update: This build is safe now, and there are no remaining errors (i.e. opencl has been taken care of) (see update2 above for more recent information)


I've been building wine (e.g. http://verahill.blogspot.com.au/2012/12/building-wine-1519-on-debian.html) on a system that was set up a few years ago.

Ergo, since ia32libs are on their way out and being replaced by multiarch libs it's time to have a look at what a build from scratch looks like, and what dependencies are needed.

This time we'll build wine the old-fashioned way using configure/make/make install. The biggest challenge was to overcome the annoying
configure: error: Cannot build a 32-bit program, you need to install 32-bit development libraries.
error. The solution to that was simply to install gcc-multilib. 

To work everything out from scratch I've set up a an amd64 chroot of a clean debian testing/wheezy. , It's increasingly appearing as if this is the easiest and safest thing to do.  Hopefully the release of Jessie will get the develop/improvement of multiarch back on the road.

To follow what's new in wine, look here: http://linux.softpedia.com/progChangelog/Wine-Changelog-148.html

...and the obligatory screenshot


The chroot environment
Basically as I've shown before:

sudo apt-get install debootstrap coreutils
mkdir -p $HOME/tmp/architectures/wine
cd $HOME/tmp/architectures
sudo debootstrap --arch amd64 testing $HOME/tmp/architectures/wine/ http://ftp.au.debian.org/debian/
sudo chroot wine/
apt-get install locales sudo vim
echo 'export LC_ALL="C"'>>/etc/bash.bashrc
echo 'export LANG="C"'>>/etc/bash.bashrc
source /etc/bash.bashrc
adduser winebuild
usermod -g sudo winebuild
echo 'Defaults !tty_tickets' >> /etc/sudoers

Edit /etc/hosts and add your hostname (here beryllium) to the end of the line e.g.
127.0.0.1 localhost beryllium

Exit, and the log in again
exit
sudo chroot wine

Then change user:
su winebuild
cd ~

Change at the very least the country code for the repo above (n red) so that you're using the closest/fastest one.

Compiling Wine
Set up multiarch (we're using amd64 but also want to support i386). I'm setting this up from scratch.

sudo dpkg --add-architecture i386
sudo apt-get update

Get the wine dependencies:

sudo apt-get install libx11-dev:i386 libfreetype6-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxxf86vm-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcomposite-dev:i386 libglu-dev:i386 libosmesa-dev:i386 libglu-dev:i386 libosmesa-dev:i386 libdbus-1-dev:i386 libgnutls-dev:i386 libncurses-dev:i386 libsane-dev:i386 libv4l-dev:i386 libgphoto2-2-dev:i386 liblcms-dev:i386 libgstreamer-plugins-base0.10-dev:i386 libcapi20-dev:i386 libcups2-dev:i386 libfontconfig-dev:i386 libgsm1-dev:i386 libtiff-dev:i386 libpng-dev:i386 libjpeg-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libldap-dev:i386 libxrender-dev:i386 libxml2-dev:i386 libxslt-dev:i386 libhal-dev:i386 libcurl4-openssl-dev:i386

sudo apt-get install gettext prelink bzip2 bison flex oss4-dev checkinstall ocl-icd-libopencl1:i386 opencl-headers

sudo apt-get install gcc-multilib

mkdir ~/tmp/
wget http://mirrors.ibiblio.org/wine/source/1.5/wine-1.5.21.tar.bz2 -O wine-unstable_1.5.21.orig.tar.bz2
tar xvf wine-unstable_1.5.21.orig.tar.bz2
cd wine-1.5.21/
./configure
config.status: executing include/wine commands config.status: executing Makefile commands configure: Finished. Do 'make' to compile Wine.
time make -j4

where -j4 is the number threads to launch, normally number of cores+1 (see here). Took around 15 minutes on a 3 core AMD.

Next
sudo checkinstall

to build a .deb package and install it (preferred solution) or
sudo make install

to just install.
Done!


Note that while this build works without issue, the transition to multiarch in debian is not complete and you will likely encounter this problem:
p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: cannot open shared object file: No such file or directory
If you try to fix it you get
sudo apt-get install gnome-keyring:i386 libcap-ng0:i386 libgck-1-0:i386 libgcr-3-1:i386 gcr:i386 libcap2-bin:i386
The following packages have unmet dependencies: libgcr-3-1:i386 : Depends: libgcr-3-common:i386 but it is not installable
This is known. The question is what the consequences of this are -- in this thread it's been suggested that it prevents any program needing to use SSL under wine from working. More at wine HQ here and here. More at Debian here. If I'm reading this right -- and I might not be -- we'll at the least have to wait for gnome-keyring 3.6 to make it out of experimental to sid, then from sid to testing (which is frozen).

 For no particular reason I think this may be what's causing issues with the installation of Office 2003 (and a few other programs, including Agilent HP Chemstation).

Links to this page:
http://linux.org.ru/forum/desktop/8571617/page1?lastmod=1358076186524