0

For some legacy application I decided to use chroot with CentOS 5.

I did install CentOS 5 on virtual machine, then I boot virtual machine with live CD and using tar, I "copied" the files from the virtual disk to my (Linux laptop's) HDD.

Then I tried to chroot, but to my surprise I got "Segmentation fault".

For "host" machine I use Archlinux 64 bit 4.17.13.

CentOS 5 have kernel 2.6.9

Here some info that might be useful:

[nmmm@zenbook c5]$ file centos.5.fs/bin/bash    # this is chroot
centos.5.fs/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, stripped

[nmmm@zenbook c5]$ file /bin/bash               # this is my laptop
/bin/bash: ELF 64-bit LSB pie executable x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=42602c973215ba5b8ab5159c527e72f38e83ee52, stripped

On same laptop I use CentOS 7 chroot without any problem.

Do I need some kernel module or something?

Nick
  • 826
  • 2
  • 15
  • 42
  • 1
    CentOS 5 is past end of life. It should not be used for anything at this point. – Michael Hampton Aug 23 '18 at 15:22
  • I agree of course with MichaelHampton. But just out of curiosity, I'd check 1/ with `strace` 2/ the options of `setarch x86_64`: --uname-2.6 --addr-compat-layout --addr-no-randomize etc. – A.B Aug 23 '18 at 18:33
  • @A.B can you elaborate more about this? how can i check etc... – Nick Aug 24 '18 at 07:42
  • `setarch x86_64 --uname-2.6 --addr-compat-layout --addr-no-randomize chroot ...` see if that makes any difference. then [use](https://www.thegeekstuff.com/2011/11/strace-examples) [strace](https://www.tecmint.com/strace-commands-for-troubleshooting-and-debugging-linux/) to see if you find something. But actually if you have no prior knowledge to unix/linux, strace won't help much (in case it could help at all here) – A.B Aug 24 '18 at 11:25

1 Answers1

1

Sounds like what https://vargolino.com/wp/?p=145 is describing: Newer kernels disable LEGACY_VSYSCALL.

Try to boot your live CD with boot parameter "vsyscall=emulate". Using grml, this worked for me:

  • On the boot screen, select "Isolinux prompt"
grml vsyscall=emulate

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907918

Larsen
  • 315
  • 2
  • 14