Changelog
- note this will be probably automated in the future
LnOS Autostart Fixes - Final Changes
Overview
This document summarizes the final changes made to fix the autostart functionality across all LnOS platforms (x86_64 ISO, Full ARM, and Minimal ARM). The solution uses a custom shell script approach that runs the LnOS installer automatically when root logs in.
Problem Summary
- x86_64 ISO: Autostart was not working - scripts were running but output was hidden in log files
- ARM Images: Using different autostart methods (instructions-only bashrc, systemd services)
- Root Cause: Complex systemd services and shell profile issues prevented direct terminal output
Solution: Custom Shell Script Approach
How It Works
- Boot system → Auto-login as root → Custom shell script runs → LnOS installer starts → Drop to bash shell
- No complex systemd services
- No shell profile dependencies
- Direct terminal output
- Simple and reliable
Files Modified
1. x86_64 ISO Files
archiso/airootfs/usr/local/bin/lnos-shell.sh
(NEW)
#!/bin/bash
# LnOS Shell - runs installer then drops to bash
echo "=========================================="
echo " Welcome to LnOS Live Environment"
echo "=========================================="
echo ""
# Wait a moment for system to settle
sleep 2
# Check if installer exists and run it
if [[ -f /root/LnOS/scripts/LnOS-installer.sh ]]; then
cd /root/LnOS/scripts
chmod +x ./LnOS-installer.sh
echo "Starting LnOS installer..."
./LnOS-installer.sh --target=x86_64
else
echo "ERROR: LnOS installer not found!"
echo "Available files in /root/LnOS/scripts/:"
ls -la /root/LnOS/scripts/ 2>/dev/null || echo "Directory not found"
fi
echo ""
echo "LnOS installer completed. Dropping to shell..."
echo ""
# Drop to bash shell
exec /bin/bash
archiso/airootfs/root/.bashrc
(SIMPLIFIED)
#!/bin/bash
# Simple LnOS Autostart - run once on tty1
if [[ $(tty) == "/dev/tty1" ]] && [[ ! -f /tmp/lnos-autostart-run ]]; then
# Mark that we've run
touch /tmp/lnos-autostart-run
# Wait a moment for system to settle
sleep 2
# Run the autostart script directly
if [[ -f /usr/local/bin/lnos-autostart.sh ]]; then
/usr/local/bin/lnos-autostart.sh
fi
fi
archiso/airootfs/root/.profile
(NEW)
#!/bin/bash
# Simple LnOS autostart - run once when root logs in
if [[ ! -f /tmp/lnos-autostart-run ]]; then
touch /tmp/lnos-autostart-run
# Wait a moment for system to settle
sleep 2
# Run the installer directly
if [[ -f /root/LnOS/scripts/LnOS-installer.sh ]]; then
cd /root/LnOS/scripts
chmod +x ./LnOS-installer.sh
./LnOS-installer.sh --target=x86_64
fi
fi
archiso/airootfs/root/customize_airootfs.sh
(UPDATED)
- Added: Custom shell script creation
- Added:
chsh -s /usr/local/bin/lnos-shell.sh root
to set custom shell - Disabled: Systemd services that don't work with terminal output
- Simplified: Autologin configuration
archiso/profiledef.sh
(UPDATED)
- Added: File permissions for new shell script and profile files
- Added:
["/root/.profile"]="0:0:644"
- Added:
["/usr/local/bin/lnos-shell.sh"]="0:0:755"
archiso/airootfs/etc/systemd/system/lnos-autostart.service
(UPDATED)
- Changed: Output from
journal
totty
for terminal display - Added: TTY configuration for direct terminal output
2. ARM Build Files
build-arm-image.sh
(UPDATED)
- Replaced: Instruction-only bashrc with custom shell script
- Added:
lnos-shell.sh
creation for ARM - Added:
chsh -s /usr/local/bin/lnos-shell.sh root
- Simplified: bashrc to just source system bashrc
build-arm-minimal.sh
(UPDATED)
- Replaced: Basic autostart script with custom shell script
- Removed: Old systemd service approach
- Added:
lnos-shell.sh
creation for minimal ARM - Added:
chsh -s /usr/local/bin/lnos-shell.sh root
Key Changes Summary
Removed Complexity
- ❌ Systemd services for autostart (don't work well with terminal output)
- ❌ Complex bashrc logic with extensive logging
- ❌ Output redirection to log files
- ❌ Multiple autostart methods causing conflicts
Added Simplicity
- ✅ Custom shell script as root's default shell
- ✅ Direct terminal output - no hidden logs
- ✅ Consistent approach across all platforms
- ✅ Simple execution flow - boot → login → installer → shell
Platform Consistency
- ✅ x86_64 ISO: Custom shell script autostart
- ✅ Full ARM Image: Custom shell script autostart
- ✅ Minimal ARM Image: Custom shell script autostart
Testing Results
x86_64 ISO
- ✅ Autostart works - installer runs automatically
- ✅ Terminal output visible - no hidden logs
- ✅ Simple flow - boot → login → installer → shell
ARM Images (Expected)
- ✅ Same behavior as x86_64 ISO
- ✅ Automatic installer startup
- ✅ Direct terminal output
- ✅ Consistent user experience
Commit History
720e278
- fix: add /root/.bashrc to file permissions so it's included in ISOdfaf721
- fix: add multiple autostart methods - system bashrc, boot service, and enhanced logging5b7a985
- fix: remove TTY restriction from autostart script to allow it to run on any TTY5c83ab4
- fix: change systemd service to output to terminal instead of journal2f9b08f
- fix: use bashrc method for autostart with direct terminal output, disable systemd services0ca85ba
- simplify: remove complex logic and logging, use direct terminal output3c08562
- simple: add .profile for direct autostart when root logs inb9f77b5
- fix: use custom shell script as root's default shell for direct autostart09bcc75
- fix: update ARM builds to use same shell-based autostart as x86_64
Final Solution Benefits
- Reliability: No complex dependencies or shell profile issues
- Visibility: Direct terminal output - no hidden logs
- Consistency: Same approach across all platforms
- Simplicity: Easy to understand and maintain
- User Experience: Automatic installer startup on all platforms
Usage
Building x86_64 ISO
./build-iso.sh
Building ARM Images
# Full ARM image
sudo ./build-arm-image.sh rpi4
# Minimal ARM image
sudo ./build-arm-minimal.sh rpi4
Expected Behavior
- Boot the ISO/image
- Automatic login as root
- LnOS installer starts automatically
- After installer completes, drops to bash shell
The autostart functionality is now consistent, reliable, and provides direct terminal output across all LnOS platforms.