#!/bin/bash # Troubleshooting script for 32-bit bcrypt issues echo "🔍 32-BIT SYSTEM TROUBLESHOOTING" echo "================================" # System info echo "1. System Information:" echo " Architecture: $(uname -m)" echo " OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)" echo " Python: $(python3 --version)" echo "" # Check if we're in virtual environment echo "2. Environment Check:" if [ -n "$VIRTUAL_ENV" ]; then echo " ✅ In virtual environment: $VIRTUAL_ENV" echo " Python location: $(which python)" echo " Pip location: $(which pip)" else echo " ❌ Not in virtual environment" echo " System Python: $(which python3)" fi echo "" # Check bcrypt installation echo "3. Bcrypt Investigation:" if [ -n "$VIRTUAL_ENV" ]; then echo " Checking installed bcrypt..." pip list | grep bcrypt || echo " ❌ bcrypt not installed" echo " Testing bcrypt import..." python3 -c " try: import bcrypt print(' ✅ bcrypt imports successfully') # Check bcrypt module location print(f' Module location: {bcrypt.__file__}') # Test basic functionality test_pw = b'test123' hashed = bcrypt.hashpw(test_pw, bcrypt.gensalt()) if bcrypt.checkpw(test_pw, hashed): print(' ✅ bcrypt functionality works') else: print(' ❌ bcrypt functionality failed') except ImportError as e: print(f' ❌ bcrypt import failed: {e}') except Exception as e: print(f' ❌ bcrypt error: {e}') " else echo " ⚠️ Please activate virtual environment first" fi echo "" echo "4. Library Files Check:" if [ -d "req_libraries_32bit" ]; then echo " ✅ req_libraries_32bit exists" if ls req_libraries_32bit/bcrypt*.whl >/dev/null 2>&1; then BCRYPT_FILE=$(ls req_libraries_32bit/bcrypt*.whl | head -1) echo " 32-bit bcrypt: $(basename $BCRYPT_FILE)" # Quick check of wheel architecture echo " Checking wheel architecture..." unzip -l "$BCRYPT_FILE" | grep "\.so" | head -1 || echo " No .so files found" else echo " ❌ No bcrypt wheel found in 32-bit libraries" fi else echo " ❌ req_libraries_32bit folder missing" fi echo "" echo "5. Recommendations:" echo " • Ensure you're on 32-bit Raspberry Pi OS (armv7l)" echo " • Use: source .venv/bin/activate" echo " • Run: ./install_32bit.sh for clean installation" echo " • If still failing, remove .venv and reinstall"