Software⏱️ 4 min read📅 2026-06-19

How to Fix: Getting error when doing su in a newly setup chroot user in arch-linux

Error when doing su in a newly setup chroot user in arch-linux

Quick Answer: The issue is caused by the jail-shell script trying to use sudo, which is not allowed for non-root users. Change the jail-shell script to use 'su' instead of 'sudo chroot /bin/su'.

The error 'Authentication service cannot retrieve authentication info' occurs when attempting to switch users using 'su' in an Arch Linux chroot jail. This issue affects users who have set up their own jails and are trying to use the 'su' command to switch between different users within the same jail.

This error can be frustrating because it prevents users from easily switching between different user accounts within a single jail, hindering productivity and usability. In this troubleshooting guide, we will explore the root causes of this issue and provide steps to resolve it.

🔍 Why This Happens

  • The primary reason for this error is that the 'su' command in the chroot environment is unable to retrieve authentication information from the password file. This is because the 'su' command relies on the 'getent passwd' command to authenticate users, but the 'getent passwd' command is not configured correctly in the chroot environment.
  • Another possible reason for this error is that the 'su' command is unable to find the authentication database, which is typically located at '/etc/passwd'. This can happen if the 'passwd' file is not properly configured or if it is missing.

🚀 How to Resolve This Issue

Configuring the 'su' Command to Use the Chroot Environment's Authentication Database

  1. Step 1: Step 1: Edit the '/etc/pam.d/su' file to include the following line: 'auth required pam_env.so', which tells PAM to use the environment variables set in the chroot jail.
  2. Step 2: Step 2: Add the following line to the '/etc/pam.d/su' file: 'auth sufficient pam_unix.so nullok_secure', which tells PAM to use the Unix authentication mechanism for user authentication. This will allow the 'su' command to authenticate users using their password files within the chroot jail.
  3. Step 3: Step 3: Restart the PAM service by running the command '/sudo systemctl restart pam.service'. This will ensure that the changes made to the '/etc/pam.d/su' file are applied.

Configuring the 'su' Command to Use a Custom Jail Shell

  1. Step 1: Step 1: Create a new jail shell script by editing the '/jail/etc/jail-shell' file. This script should contain the following lines: 'sudo chroot /jail /bin/su jailed-user', which tells the 'su' command to switch to the specified user within the chroot jail.
  2. Step 2: Step 2: Make the '/jail/etc/jail-shell' script executable by running the command '/sudo chmod +x /jail/etc/jail-shell'. This will allow the script to be executed when the 'su' command is invoked.

💡 Conclusion

By following these steps, you should be able to resolve the 'Authentication service cannot retrieve authentication info' error and successfully use the 'su' command to switch between users within your Arch Linux chroot jail. Remember to restart the PAM service after making changes to the '/etc/pam.d/su' file.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions