How do I install a 32-bit proprietary deb on a 64-bit system without causing dependency problems?

I know Guitar pro doesn't support 64 bit, but i did get it to work with this command

jeggy@jeggy-XPS:~$ sudo dpkg --force-architecture -i GuitarPro6-rev9063.deb
[sudo] password for jeggy: 
Selecting previously unselected package guitarpro6:i386.
(Reading database ... 285729 files and directories currently installed.)
Unpacking guitarpro6:i386 (from GuitarPro6-rev9063.deb) ...
dpkg: dependency problems prevent configuration of guitarpro6:i386:
 guitarpro6:i386 depends on gksu.
dpkg: error processing guitarpro6:i386 (--install):
 dependency problems - leaving unconfigured
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Errors were encountered while processing:
 guitarpro6:i386

And even after i get that error the program perfectly works fine and updating and adding PPA's to the system works great, but when I'm trying to install some other software i get this error:

jeggy@jeggy-XPS:~$ sudo apt-get install elinks
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 elinks : Depends: libfsplib0 (>= 0.9) but it is not going to be installed
          Depends: liblua50 (>= 5.0.3) but it is not going to be installed
          Depends: liblualib50 (>= 5.0.3) but it is not going to be installed
          Depends: libtre5 but it is not going to be installed
          Depends: elinks-data (= 0.12~pre5-7ubuntu1) but it is not going to be installed
 guitarpro6:i386 : Depends: gksu:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

And whenever i write "apt-get -f install" i get this

jeggy@jeggy-XPS:~$ sudo apt-get -f install
[sudo] password for jeggy: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  dconf-gsettings-backend:i386 python-levenshtein python-indicate libav-tools libstartup-notification0:i386
  libxmuu1:i386 libavfilter-extra-2 libbabl-0.0-0 libgegl-0.0-0 libgconf2-4:i386 python-vobject libgtk-3-0:i386
  libpam-cap:i386 python-utidylib libdconf0:i386 python-iniparse python-xmpp libpam-gnome-keyring:i386
  libxcb-util0:i386 python-farstream
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  guitarpro6:i386
0 upgraded, 0 newly installed, 1 to remove and 7 not upgraded.
1 not fully installed or removed.
After this operation, 84,0 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 286979 files and directories currently installed.)
Removing guitarpro6:i386 ...
dpkg: warning: while removing guitarpro6:i386, directory '/opt/GuitarPro6/updater' not empty so not removed.
dpkg: warning: while removing guitarpro6:i386, directory '/opt/GuitarPro6/Data/Soundbanks' not empty so not removed.
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...

And now Guitar Pro is deleted.
How can i install Guitar Pro and still be able to install other software afterwards?


Solution 1:

Warning:

The GuitarPro deb is dangerously packaged!

  • On a 64-bit system, if you apt-get -f install after trying to install it, apt-get will want to remove the following system critical packages, which can ruin your Ubuntu installation!

    The following packages will be REMOVED:
    gksu guitarpro6:i386 libgksu2-0 libpam-gnome-keyring sudo ubuntu-desktop
    ubuntu-minimal update-manager update-notifier xauth xinit xorg
  • sudo? update-manager?? X! What are the developers thinking?! It also makes apt-get think a bunch of i386 packages are installed when none have been. Here's the full gory pastebin.


Safely Install GuitarPro without apt-get wanting to remove it

  • I believe the above behavior comes from the deb's dumb dependency on gksu:i386 (which is the graphical root elevation package)
  • Unfortunately, the only safe way to install this and not have to deal with apt-get's whining is to manually install it and its dependencies. Here's how:

How to manually examine and safely install a binary i386 deb with its dependencies

  • First, remove the current half-installed packaged with sudo dpkg --remove guitarpro:i386
  • Now, change to the directory where your deb file is stored. For easy typing let's create a short symlink - my deb called gp6-full-linux-demo-r11100.deb, yours may differ:
    • ln -s gp6-full-linux-demo-r11100.deb gp6.deb

1. Examine the deb's architecture and dependencies

First, we examine the deb's dependencies without installing it.

  • dpkg-deb -I gp6.deb shows us:

     new debian package, version 2.0.
    size 172147458 bytes: control archive= 75020 bytes.
     375 bytes,    10 lines      control
    335109 bytes, 2770 lines md5sums
    Package: GuitarPro6 Version: 6.1.3 Section: non-free/audio Priority: optional Architecture: i386 Depends: libc6 (>= 2.1.3), libstdc++6, libasound2, libxml2, libxslt1.1, libportaudio0, libportaudio2, libglu1-mesa, gksu, libssl0.9.8 Installed-Size: 222632 Maintainer: Arobas Music Description: http://www.guitar-pro.com Guitar Pro 6, Linux Version.
  • So this is an i386 application, and all its dependencies are also going to be i386.

  • The first thing to do is install the ia32-libs i386 compatibility package, if you haven't already:
    • sudo apt-get install ia32-libs
  • Let's also copy and paste the package's dependencies in a text file, for later.

2. "Extract" the deb into a tar archive and examine its contents

  • Let's extract the deb to a tar archive now so we can examine its contents without having to install it:
    • dpkg-deb --fsys-tarfile gp6.deb > gp6.tar
  • And open up the File Manager (Nautilus), and mount the gp6.tar as an archive by right-clicking and selecting Open in Archive Mounter; after that you'll see gp6.tar added to the bottom the left sidebar, with an eject icon next to it:

    enter image description here

  • Go to the View Menu for File Manager, and change the Sidebar to the Tree view option instead of Places:

    enter image description here

  • Now expand the gp6.tar tree in the sidebar by clicking on the triangles; repeat for each level until you can see the folder structure of the file:

    enter image description here

  • From the structure, we see that the program's files go into two locations: /opt and /usr/share:

    • Anything that goes into /opt is self-contained and will not affect anything else on the system.
    • We see that /usr/share only contains icons/bitmaps, which are harmless.

3. If it's safe, "install" the program by extracting the tar file

  • Go back to the terminal, and make sure you are in the directory containing the downloaded deb/tar files. Then type:

    sudo tar -C / -xvf gp6.tar
    
  • This will extract the program files in the appropriate locations, showing you the file names and progress. (Sample Output)

    • The -C switch tells tar to perform this operation relative to the root directory, not the current directory.

4. Figure out which dependencies are missing with ldd, install them, and rock-and-roll!

  • Open up the /opt/GuitarPro6 folder in the File Manager:

    enter image description here

    • We see that the executable is called GuitarPro (with the diamond-"gears" icon), and also that a lot of lib-xxxx files are included in the folder.
    • This is normal for binary-only programs; they try to include the versions of the specific libraries they need, since those may not be available from the repositories of a specific distribution.
  • Along with these included libraries and the ia32-libs package, most 32-bit dependencies should have been installed. Instead of blindly installing the dependencies we saw in the deb file info via apt-get--which can cause problems-- let's figure out if we're actually missing anything.

    • Go back to the terminal, and change to the GuitarPro directory with cd /opt/GuitarPro6

Using ldd

  • Type ldd GuitarPro | grep found, and the output will be libportaudio.so.2 => not found

    • ldd prints the dependencies (shared libraries) of a program, and whether they exist or not on the system. Here's what the full output of GuitarPro looks like.
    • To make life easier, we simply filter for the ones that do not exist via grep found.
  • Here, only the libportaudio2 library is missing. But the dependencies said libportaudio0? (see step 1.) Which is it??

    • Let's search for the available versions using apt-cache search libportaudio from the terminal.
    • That's tells us that both libportaudio2 and libportaudio0 packages are available. Let's install the 2 first, with
      sudo apt-get install libportaudio2:i386
    • The :i386 part is very important, since our program is 32-bit. If apt-get asks to replace/remove libportaudio2 and/or other files, that's OK, because some libraries cannot be installed simultaneously in both 32- and 64-bit versions.
  • Let's double-check dependencies one final time: ldd GuitarPro6 | grep found gives us nothing (that's what we want!)

    • If you get the error ./GuitarPro: /opt/GuitarPro6/./libz.so.1: version ZLIB_1.2.3.3 not found (required by /usr/lib/i386-linux-gnu/libxml2.so.2) this means that Guitar Pro is using a wrong version of libz, fix this by removing the libz.so.1 file from the GuitarPro6 directory:
      sudo rm libz.so.1
      Guitar Pro will fall back to the libz version of your system.
  • Exit the terminal and go back to the /opt/GuitarPro6 folder in the File Manager. Double-click GuitarPro and...

    enter image description here

  • Clean-up the Download folder by deleting the tar file from the File Manager.

5. The launcher shortcut has already been added

  • Because the package already contained a GuitarPro6.desktop shortcut that was extracted to /usr/share/applications, there is no need to manually create one. It's sitting there in the Launcher:

    enter image description here

Solution 2:

I tried something out and got it to work!

  1. I copied "/opt/GuitarPro6" somewhere.

  2. I did sudo apt-get -f install to remove Guitar Pro.

  3. I copied the folder back into /opt/GuitarPro6 and replaced everything there.

  4. I installed more packages as follows:

    sudo apt-get install dconf-gsettings-backend python-levenshtein python-indicate libav-tools libstartup-notification0 libxmuu1 libavfilter-extra-2 libbabl-0.0-0 libgegl-0.0-0 libgconf2-4 python-vobject libgtk-3-0 libpam-cap python-utidylib libdconf0 python-iniparse python-xmpp libpam-gnome-keyring libxcb-util0 python-farstream
    
  5. I downloaded this image GuitarPro icon and saved it in /opt/GuitarPro6/icon.png so i could have an image to create my own .desktop file.

  6. I created a .desktop file with sudo gedit:

    #!/usr/bin/env xdg-open
    
    [Desktop Entry]
    Type=Application
    Name=Guitar Pro 6
    Comment=Guitar Pro 6
    Icon=/opt/GuitarPro6/icon.png
    Exec=sh /opt/GuitarPro6/gp-launcher.sh
    Terminal=false
    Categories=Audio
    

    I saved this file into /usr/share/applications with the name GuitarPro6.desktop.

Now everything works and I can find Guitar Pro in the dash.