Fix 32-bit bcrypt ELFCLASS64 error and enhance installation
- Enhanced install_32bit.sh with clean virtual environment creation - Added --force-reinstall and --clear flags for proper isolation - Improved download_32bit_libs.sh with explicit armv7l targeting - Added troubleshoot_32bit.sh for diagnosing 32-bit issues - Better architecture verification and error messages - Comprehensive package testing after installation Fixes ELFCLASS64 error on 32-bit systems by ensuring proper architecture isolation and clean package installation.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Dedicated Offline Installer for 32-bit Raspberry Pi OS (armv7l)
|
||||
# Ensures clean installation with proper architecture isolation
|
||||
|
||||
set -e
|
||||
|
||||
@@ -12,6 +13,7 @@ ARCH=$(uname -m)
|
||||
echo "Architecture: $ARCH"
|
||||
if [ "$ARCH" != "armv7l" ]; then
|
||||
echo "ERROR: This script is for 32-bit Raspberry Pi OS (armv7l) only!"
|
||||
echo "Current architecture: $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -19,6 +21,7 @@ fi
|
||||
LIBS_FOLDER="req_libraries_32bit"
|
||||
if [ ! -d "$LIBS_FOLDER" ]; then
|
||||
echo "ERROR: $LIBS_FOLDER not found!"
|
||||
echo "Please download 32-bit libraries first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -26,18 +29,75 @@ echo "Library folder: $LIBS_FOLDER"
|
||||
WHEEL_COUNT=$(ls $LIBS_FOLDER/*.whl | wc -l)
|
||||
echo "Wheel files: $WHEEL_COUNT"
|
||||
|
||||
# 3. Create .venv
|
||||
echo "Creating .venv..."
|
||||
python3 -m venv .venv
|
||||
# 3. Show key 32-bit packages
|
||||
echo ""
|
||||
echo "32-bit packages to install:"
|
||||
if ls $LIBS_FOLDER/bcrypt*.whl >/dev/null 2>&1; then
|
||||
BCRYPT_FILE=$(basename $(ls $LIBS_FOLDER/bcrypt*.whl | head -1))
|
||||
echo " BCRYPT: $BCRYPT_FILE"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 4. Activate environment
|
||||
# 4. Clean existing virtual environment
|
||||
if [ -d ".venv" ]; then
|
||||
echo "Removing existing .venv to ensure clean installation..."
|
||||
rm -rf .venv
|
||||
fi
|
||||
|
||||
# 5. Create fresh virtual environment
|
||||
echo "Creating fresh virtual environment..."
|
||||
python3 -m venv .venv --clear
|
||||
|
||||
# 6. Activate environment
|
||||
echo "Activating virtual environment..."
|
||||
source .venv/bin/activate
|
||||
|
||||
# 5. Upgrade pip
|
||||
# 7. Ensure we're using the virtual environment
|
||||
echo "Python location: $(which python)"
|
||||
echo "Pip location: $(which pip)"
|
||||
|
||||
# 8. Upgrade pip
|
||||
echo "Upgrading pip..."
|
||||
pip install --upgrade pip
|
||||
|
||||
# 6. Install packages offline
|
||||
pip install --no-index --no-deps --find-links $LIBS_FOLDER/ $LIBS_FOLDER/*.whl
|
||||
# 9. Install packages with forced 32-bit isolation
|
||||
echo ""
|
||||
echo "Installing 32-bit packages (completely isolated)..."
|
||||
pip install --no-index --no-deps --force-reinstall --find-links $LIBS_FOLDER/ $LIBS_FOLDER/*.whl
|
||||
|
||||
# 10. Verify 32-bit installation
|
||||
echo ""
|
||||
echo "Verifying 32-bit installation..."
|
||||
python3 -c "
|
||||
import sys
|
||||
print(f'Python executable: {sys.executable}')
|
||||
print(f'Architecture: $(uname -m)')
|
||||
|
||||
try:
|
||||
import bcrypt
|
||||
print('✅ bcrypt imported successfully')
|
||||
# Test bcrypt functionality
|
||||
password = b'test'
|
||||
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
|
||||
if bcrypt.checkpw(password, hashed):
|
||||
print('✅ bcrypt functionality test passed')
|
||||
else:
|
||||
print('❌ bcrypt functionality test failed')
|
||||
except Exception as e:
|
||||
print(f'❌ bcrypt import/test failed: {e}')
|
||||
|
||||
try:
|
||||
import requests
|
||||
print('✅ requests imported successfully')
|
||||
except Exception as e:
|
||||
print(f'❌ requests failed: {e}')
|
||||
|
||||
try:
|
||||
import vlc
|
||||
print('✅ python-vlc imported successfully')
|
||||
except Exception as e:
|
||||
print(f'❌ python-vlc failed: {e}')
|
||||
"
|
||||
|
||||
echo ""
|
||||
echo "✅ 32-bit installation completed!"
|
||||
|
||||
Reference in New Issue
Block a user