How do you run a 32-bit program on a 64-bit version of Ubuntu?

405

Solution 1

There isn't need of the ia32-libs package anymore (since 12.04 to be exact), if you use the APT system, you have nothing to worry about installing 32-bit packages in a 64-bit system. This happened since the introduction of multiarch, one of the Debian most game changing policies in the way Debian manages it dependencies. This method allows to have different binary targets in the same system without care of the kernel architecture. This doesn't mean that you can run any 32-bit package without preparation, but if you install the libraries/binaries any applications in theory should be able to run. This is true from 64-bit to 32-bit and vice-versa.

enter image description here

For using such method is recommended using the APT managers, to prevent unmet dependencies. The changelog includes a small history about how the changes were made:

  1. In precise the package was emptied and made a transitional package. It was added several dependencies against packages that hasn't been moved to multiarch.
  2. Slowly but surely, all packages were rebuild with multiarch support and the reverse dependencies were being dropped or changed to ia32-lib-multiarch. When theses packages stop needing the ia34-libs packages the dependencies were dropped at the same time. The dependencies were changed from ia32-libs to package:arch being package the name of the library needed and arch the architecture (below there is a example with skype).
  3. With the last release the ia32-libs-multiarch package was removed from pre-raring releases and ia32-libs don't got published to saucy. All Ubuntu packages are multiarch capable and you can install different architecture packages in your system.

Now, when installing a package that needs 32-bit binaries, if you don't pay attention you will never know that you are using a 32-bit package, since the package manager will pull automatically the necessary dependencies:

sudo apt-get --no-install-recommends -q -y install skype
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libaudio2:i386 libjbig0:i386 liblcms1:i386 libmng1:i386 libqt4-dbus:i386 libqt4-declarative:i386
  libqt4-network:i386 libqt4-opengl:i386 libqt4-script:i386 libqt4-sql:i386 libqt4-xml:i386
  libqt4-xmlpatterns:i386 libqtcore4:i386 libqtgui4:i386 libqtwebkit4:i386 libssl1.0.0:i386 libtiff5:i386
  libxss1:i386 libxv1:i386 skype-bin:i386
Suggested packages:
  nas:i386 liblcms-utils:i386 libqt4-declarative-folderlistmodel:i386 libqt4-declarative-gestures:i386
  libqt4-declarative-particles:i386 libqt4-declarative-shaders:i386 qt4-qmlviewer:i386 libqt4-dev:i386
  libthai0:i386 libicu48:i386 qt4-qtconfig:i386
Recommended packages:
  libqt4-sql-mysql:i386 libqt4-sql-odbc:i386 libqt4-sql-psql:i386 libqt4-sql-sqlite:i386 libcups2:i386
  sni-qt:i386 libasound2-plugins:i386
The following NEW packages will be installed:
  libaudio2:i386 libjbig0:i386 liblcms1:i386 libmng1:i386 libqt4-dbus:i386 libqt4-declarative:i386
  libqt4-network:i386 libqt4-opengl:i386 libqt4-script:i386 libqt4-sql:i386 libqt4-xml:i386
  libqt4-xmlpatterns:i386 libqtcore4:i386 libqtgui4:i386 libqtwebkit4:i386 libssl1.0.0:i386 libtiff5:i386
  libxss1:i386 libxv1:i386 skype skype-bin:i386
0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 33.9 MB/38.2 MB of archives.
After this operation, 118 MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package libssl1.0.0:i386.
(Reading database ... 208485 files and directories currently installed.)
Unpacking libssl1.0.0:i386 (from .../libssl1.0.0_1.0.1c-4ubuntu8.1_i386.deb) ...
Selecting previously unselected package libaudio2:i386.
Unpacking libaudio2:i386 (from .../libaudio2_1.9.3-5ubuntu0.13.04.1_i386.deb) ...
Selecting previously unselected package liblcms1:i386.
Unpacking liblcms1:i386 (from .../liblcms1_1.19.dfsg-1.2ubuntu2_i386.deb) ...
Selecting previously unselected package libmng1:i386.
Unpacking libmng1:i386 (from .../libmng1_1.0.10-3build1_i386.deb) ...
Selecting previously unselected package libqtcore4:i386.
Unpacking libqtcore4:i386 (from .../libqtcore4_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-xml:i386.
Unpacking libqt4-xml:i386 (from .../libqt4-xml_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-dbus:i386.
Unpacking libqt4-dbus:i386 (from .../libqt4-dbus_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-network:i386.
Unpacking libqt4-network:i386 (from .../libqt4-network_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-script:i386.
Unpacking libqt4-script:i386 (from .../libqt4-script_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-sql:i386.
Unpacking libqt4-sql:i386 (from .../libqt4-sql_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-xmlpatterns:i386.
Unpacking libqt4-xmlpatterns:i386 (from .../libqt4-xmlpatterns_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libjbig0:i386.
Unpacking libjbig0:i386 (from .../libjbig0_2.0-2ubuntu1_i386.deb) ...
Selecting previously unselected package libtiff5:i386.
Unpacking libtiff5:i386 (from .../libtiff5_4.0.2-4ubuntu2.1_i386.deb) ...
Selecting previously unselected package libqtgui4:i386.
Unpacking libqtgui4:i386 (from .../libqtgui4_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-declarative:i386.
Unpacking libqt4-declarative:i386 (from .../libqt4-declarative_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqt4-opengl:i386.
Unpacking libqt4-opengl:i386 (from .../libqt4-opengl_4%3a4.8.4+dfsg-0ubuntu9.4_i386.deb) ...
Selecting previously unselected package libqtwebkit4:i386.
Unpacking libqtwebkit4:i386 (from .../libqtwebkit4_2.3.0-0ubuntu2_i386.deb) ...
Selecting previously unselected package libxss1:i386.
Unpacking libxss1:i386 (from .../libxss1_1%3a1.2.2-1_i386.deb) ...
Selecting previously unselected package libxv1:i386.
Unpacking libxv1:i386 (from .../libxv1_2%3a1.0.7-1ubuntu0.13.04.1_i386.deb) ...
Selecting previously unselected package skype-bin.
Unpacking skype-bin (from .../skype-bin_4.2.0.11-0ubuntu0.12.04.2_i386.deb) ...
Selecting previously unselected package skype.
Unpacking skype (from .../skype_4.2.0.11-0ubuntu0.12.04.2_amd64.deb) ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for hicolor-icon-theme ...
Setting up libssl1.0.0:i386 (1.0.1c-4ubuntu8.1) ...
Setting up libaudio2:i386 (1.9.3-5ubuntu0.13.04.1) ...
Setting up liblcms1:i386 (1.19.dfsg-1.2ubuntu2) ...
Setting up libmng1:i386 (1.0.10-3build1) ...
Setting up libqtcore4:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-xml:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-dbus:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-network:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-script:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-sql:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-xmlpatterns:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libjbig0:i386 (2.0-2ubuntu1) ...
Setting up libtiff5:i386 (4.0.2-4ubuntu2.1) ...
Setting up libxss1:i386 (1:1.2.2-1) ...
Setting up libxv1:i386 (2:1.0.7-1ubuntu0.13.04.1) ...
Setting up libqtgui4:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-declarative:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqt4-opengl:i386 (4:4.8.4+dfsg-0ubuntu9.4) ...
Setting up libqtwebkit4:i386 (2.3.0-0ubuntu2) ...
Setting up skype-bin (4.2.0.11-0ubuntu0.12.04.2) ...
Setting up skype (4.2.0.11-0ubuntu0.12.04.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

Notice that skype is a i386 package. If I use apt-get to install it, I will save myself of headaches later.

But some people prefer to use .deb packages, then brace yourself because it can get a bit messy. You should manually install all dependencies before hand so your system don't end with unmet dependencies. A command that will help is dpkg-deb -I since it shows the information of the package:

dpkg-deb -I zynaddsubfx-dssi_2.4.3-3_amd64.deb 
 new debian package, version 2.0.
 size 266936 bytes: control archive=845 bytes.
     917 bytes,    19 lines      control              
     232 bytes,     3 lines      md5sums              
 Package: zynaddsubfx-dssi
 Source: zynaddsubfx
 Version: 2.4.3-3
 Architecture: amd64
 Maintainer: Ubuntu Developers <[email protected]>
 Original-Maintainer: Debian Multimedia Maintainers <[email protected]>
 Installed-Size: 633
 Depends: libasound2 (>= 1.0.16), libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libjack-jackd2-0 (>= 1.9.5~dfsg-14) | libjack-0.116, libmxml1, libstdc++6 (>= 4.6), zlib1g (>= 1:1.1.4)
[...]

As you can see, it lists the dependencies, so you only have to sudo apt-get install them and then sudo dpkg -i. Again, prefer installing software from the repositories instead of downloading them and manually installing it with dpkg -i.

Now, if yours is development, you can install any library using the apt-get syntax. Just add :i386 to the library you want to download, and done. No need to do this manually if you install the software from the repositories.

Bottom line: No, you can run 32-bit packages without installing ia32-libs, if you install the packages from the repositories, even better. If you are into development, try to always use the APT system.

Solution 2

Remember to add i386 architecture or you won't be able to install 32-bit packages:

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

Check the package troubleshooting guide: https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure

Share:
405

Related videos on Youtube

Prachi Bhardwaj
Author by

Prachi Bhardwaj

Updated on September 18, 2022

Comments

  • Prachi Bhardwaj
    Prachi Bhardwaj over 1 year

    I am implementing A Cache in DAO layer using Spring Cache by using annotation @Cacheable. This is my following Code .

        @Override
    @Cacheable(value="saleSegmentCache3")
    public List<SaleSegment> findBySuborder(String pincode,long subcatID) {
        // TODO Auto-generated method stub
        System.out.println("String is printing");
        return ssRepo.findSaleSegmentsByPincodeAndSubcategoryIdAndSegmentType(pincode,subcatID, SaleSegmentType.SUBCAT_PINCODE);
    }
    

    Over here i am able to retreive the data , but i am not being able to put the data into Cache. I am using one more example :

        @Override
    @Cacheable(value="saleSegmentCache3" ,key="#soData")
    public String findBySuborderTemp(String soData) {
        // TODO Auto-generated method stub
        System.out.println("String XYZZZZZZZ");
        return "MyString";
    
    }
    

    Here i am able to Cache the String Perfectly and able to store the data in the cache . I think Something is wrong with the syntax that i have used

    • bain
      bain almost 10 years
    • web.learner
      web.learner almost 10 years
      @bain This is not a duplicate. This question is about general situations, that is a specific issue, not to mention this is the older, better question.
    • Mateo
      Mateo almost 10 years
      And Braiam's answer is awesome! so if it were to be duped anywhere it should be merged.
  • Merlijn Sebrechts
    Merlijn Sebrechts over 10 years
    What can I do with a .bin installer that checks if the ia32-libs package is installed? As far as I know, even if I manually install the correct dependencies, the .bin will still fail to install because it searches for the ia32-libs package. Is there a way of "fooling" the installer to think that ia32-libs is installed?
  • Braiam
    Braiam over 10 years
    @Galgalesh ask the maintainer to fix their stuff, they are in the past.
  • AlexLordThorsen
    AlexLordThorsen about 10 years
    The only problem with removing ia32-libs is when you have programs like PlayOnLinux which attempt to use 32 bit libraries to run 32bit windows programs. Then this is a breaking backwards in-compatibility.
  • Braiam
    Braiam about 10 years
    @Rawrgulmuffins they had to change... OpenSUSE and Red Hat were already compliant with the LSB and FHS standards, and the ia32-libs package didn't allow them to easily manage the changes to be done, which was a single directory for each architecture. Developers should instead just follow the introduction to multiarch and repackage their packages accordingly. If they haven't in the last 3 years, they are being lazy.
  • AlexLordThorsen
    AlexLordThorsen about 10 years
    @Braiam So the fault is wtih the LSB and FHS standards for breaking backwards compatibility then. It seems like folly to state that this just requires developers to repackage, especially since this breaks all packages that relied on lib32.
  • Braiam
    Braiam about 10 years
    @Rawrgulmuffins how many distros you know that relied in ia32-libs?
  • AlexLordThorsen
    AlexLordThorsen about 10 years
    a large portion of wine programs, skype, citrix. To be blunt, I'm mainly trying to get old (and some new) games to work on Linux. I would like to not have to create a windows VM. I would like to be able to tell my friends that they don't need a windows box to build a gaming machine.
  • Braiam
    Braiam about 10 years
    @user265140 I think he means "windows applications that needs to be run with wine". Wine is multiarch since very very long ago, Skype from Canonical repositories (directly from Skype's always gave problems).
  • e40
    e40 over 8 years
    The above two commands didn't install any 32-bit packages for me. What am I missing?
  • e40
    e40 over 8 years
    OK, for me, I had to do two additional commands: apt-get install libc6:i386 and apt-get install libgtk2.0-0:i386 (the latter because it's a GTK app).