2

I know this question has been asked a number of times, but my system seems to contradict itself…

Following the answer to this question, I have run the following:

$ uname -a
Linux manaha 3.13.7-x86_64-linode38 #1 SMP Tue Mar 25 12:59:48 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
$ file /sbin/init
/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xc0d86a25a7abb14cad4a65a1f7d03605bcbd41f6, stripped

So, while uname seems to suggest 64-bit, /sbin/init suggests 32-bit. What's happening here?

forquare
  • 123
  • 5
  • That is strange! Did you ever re-compile the kernel yourself? – jobin Apr 20 '14 at 15:37
  • dpkg --print-architecture will give your original architecture. – Avinash Raj Apr 20 '14 at 15:54
  • $ dpkg --print-architecture yields i386. I haven't recompiled the kernel -this box is hosted by Linode and recently I swapped to be kernel in their web management backend to enable some free upgrades they were offering. – forquare Apr 21 '14 at 08:05

2 Answers2

2

In computing, the Executable and Linkable Format (ELF) is a common standard file format for executables, object code, shared libraries, and core dumps. In your question /sbin/init: ELF 32-bit LSB shared object identifies ELF as the format for a 32-bit shared object from a shared library. Your operating system is a 64-bit OS that has a 32-bit shared object somewhere in it. There is no contradiction in this.

karel
  • 114,770
  • That would mean file /sbin/init is not a reliable method to know whether you are running a 32-bit or a 64-bit OS, right? – jobin Apr 20 '14 at 16:11
  • @Jobin uname -a is a simpler and less potentially confusing way to know whether you are running a 32-bit or a 64-bit OS than file /sbin/init. – karel Apr 20 '14 at 18:23
  • So, if init is 32-bit, and init starts all processes (sorry, been a few years since I've done this low-level stuff), does this mean that I can only run 32-bit apps, but the kernel is running in 64-bit mode? – forquare Apr 21 '14 at 08:03
  • Take a look at this answer that I posted today. It will also help to read the question and visit the link in the answer. In a nutshell, Ubuntu 14.04 64-bit (64-bit Linux kernel) can also run 32-bit apps by running the command: sudo dpkg --add-architecture i386. – karel Apr 21 '14 at 08:12
0

While the uname command tells you something about your system, the file command tells you something about a file. So the file command says "init" is a 32-bit file and the uname command says you have a 64-bit computer. I hope this helps.
Please point out any mistakes I made as fast as possible, just in case it causes any harm.
PS did you read the other answers to the post you're linking to? This answer seems a really easy way to find out your architecture: https://askubuntu.com/a/65731/271517

Leo2807
  • 1
  • 3