Running centos6 chroots under newer Linux kernels

Today I realized that I couldn’t execute shell in a centos6 chroot environment while using Debian 11 and kernel 5.10:

$ sudo chroot centos /bin/sh
Segmentation fault

While some commands like ps working properly, most of the others including shells failed with segmentation fault.

After a quick search, I found a solution for that. To improve overall system call performance, there are some mechanisms named vsyscalls and vDSO.

vsyscalls method not used much anymore and disabled in Debian. Centos6 depends on this vsyscalls mechanism. To be able to solve this problem, you should append vsyscall=emulate kernel command line parameter.

For Debian based systems, edit /etc/default/grub file and append vsyscall=emulate to GRUB_CMDLINE_LINUX_DEFAULT variable, run sudo update-grub and reboot the system.

After reboot, you should successfully run the commands inside centos6 chroot.