title: x86 Assembly Program's binary executable does not run on Kali WSL
body: <p>I am starting to learn x86 Assembly Programming, following this <a href="https://www.tutorialspoint.com/assembly_programming/assembly_basic_syntax.htm" rel="nofollow noreferrer">Tutorial</a> and I wrote a Hello World Program saved as hello.asm</p>
  <pre><code>section .text
     global _start
  
  _start:
     mov  edx,len
     mov  ecx,msg
     mov  ebx,1
     mov  eax,4
     int  0x80
  
     mov  eax,1
     int  0x80
  
  section .data
  msg db 'Hello, world!', 0xa
  len equ $ - msg
  </code></pre>
  <p>I then used nasm as</p>
  <blockquote>
  <p>nasm -f elf32 hello.asm</p>
  </blockquote>
  <p>and got the object file hello.o</p>
  <p>then I used ld as</p>
  <blockquote>
  <p>ld -m elf_i386 -o hello hello.o</p>
  </blockquote>
  <p>I then got the hello binary file, executing it with ./hello I get</p>
  <blockquote>
  <p>./hello: cannot execute binary file: Exec format error</p>
  </blockquote>
  <p>I have 64 bit OS,output of &quot;uname -a&quot;</p>
  <blockquote>
  <p>uname -a</p>
  <p>Linux DESKTOP-JO8V9QJ 5.10.16.3-microsoft-standard-WSL #1 SMP Fri Apr
  2 22:23:49 UTC 2021 x86_64 GNU/Linux</p>
  </blockquote>
  <p>the hello binary file is 32 bit , output of file ./hello is</p>
  <blockquote>
  <p>file ./hello</p>
  <p>./hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
  statically linked, not stripped</p>
  </blockquote>
  <p>Now x64 is supposed to be Backward Compatible, that means it should be able to run this binary... My Question is , is there a problem in the Code or is there something wrong with my instance of Kali on WSL which I am using to execute this because <a href="https://stackoverflow.com/questions/69656217/puts-all-command-line-input-in-a-single-array-element-in-bash">WSL has Given me Problems earlier</a> and what is the solution for this&quot;Exec Format Error&quot; ?</p>
  <p>Other stack overflow articles come close to this issue but nothing related to running it on WSL...</p>
  <p><strong>EDIT 1:</strong>
  wsl -l -v gives</p>
  <blockquote>
  <p>NAME          STATE           VERSION</p>
  <ul>
  <li>kali-linux    Running         1</li>
  </ul>
  </blockquote>
  <p>and I didn't knew that WSL doesnt Support 32 bit so , Upgrded to WSL2 and it works perfectly.....</p>