diagnose-boot.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #!/bin/bash
  2. # Diagnostic script to check boot auto-start issues
  3. echo "=========================================="
  4. echo "Dune Weaver Touch Boot Diagnostics"
  5. echo "=========================================="
  6. echo ""
  7. # Check if service file is installed
  8. echo "1. Service Installation:"
  9. if [ -f /etc/systemd/system/dune-weaver-touch.service ]; then
  10. echo " ✅ Service file exists"
  11. echo " Path: /etc/systemd/system/dune-weaver-touch.service"
  12. else
  13. echo " ❌ Service file NOT found!"
  14. fi
  15. echo ""
  16. # Check if service is enabled
  17. echo "2. Service Enabled Status:"
  18. if systemctl is-enabled dune-weaver-touch >/dev/null 2>&1; then
  19. echo " ✅ Service is enabled for auto-start"
  20. else
  21. echo " ❌ Service is NOT enabled!"
  22. echo " Run: sudo systemctl enable dune-weaver-touch"
  23. fi
  24. echo ""
  25. # Check service status
  26. echo "3. Current Service Status:"
  27. systemctl status dune-weaver-touch --no-pager -l | head -n 10
  28. echo ""
  29. # Check framebuffer device
  30. echo "4. Framebuffer Device:"
  31. if [ -c /dev/fb0 ]; then
  32. echo " ✅ /dev/fb0 exists"
  33. ls -la /dev/fb0
  34. if command -v fbset >/dev/null 2>&1; then
  35. echo ""
  36. echo " Framebuffer info:"
  37. fbset -fb /dev/fb0 2>&1 | head -n 5
  38. fi
  39. else
  40. echo " ❌ /dev/fb0 NOT found!"
  41. fi
  42. echo ""
  43. # Check wrapper script
  44. echo "5. Startup Wrapper Script:"
  45. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  46. if [ -f "$SCRIPT_DIR/start-with-fb-check.sh" ]; then
  47. echo " ✅ Wrapper script exists"
  48. ls -la "$SCRIPT_DIR/start-with-fb-check.sh"
  49. if [ -x "$SCRIPT_DIR/start-with-fb-check.sh" ]; then
  50. echo " ✅ Wrapper is executable"
  51. else
  52. echo " ❌ Wrapper is NOT executable!"
  53. echo " Run: chmod +x $SCRIPT_DIR/start-with-fb-check.sh"
  54. fi
  55. else
  56. echo " ❌ Wrapper script NOT found!"
  57. fi
  58. echo ""
  59. # Check service logs
  60. echo "6. Recent Service Logs (last 20 lines):"
  61. echo " ----------------------------------------"
  62. sudo journalctl -u dune-weaver-touch -n 20 --no-pager
  63. echo ""
  64. # Check boot logs
  65. echo "7. Service Logs from Last Boot:"
  66. echo " ----------------------------------------"
  67. sudo journalctl -u dune-weaver-touch -b --no-pager | tail -n 30
  68. echo ""
  69. # Check Python and venv
  70. echo "8. Python Virtual Environment:"
  71. if [ -d "$SCRIPT_DIR/venv" ]; then
  72. echo " ✅ Virtual environment exists"
  73. if [ -f "$SCRIPT_DIR/venv/bin/python" ]; then
  74. echo " ✅ Python binary exists"
  75. echo " Version: $("$SCRIPT_DIR/venv/bin/python" --version)"
  76. else
  77. echo " ❌ Python binary NOT found in venv!"
  78. fi
  79. else
  80. echo " ❌ Virtual environment NOT found!"
  81. echo " Run: sudo ./install.sh"
  82. fi
  83. echo ""
  84. # Check main.py
  85. echo "9. Application Files:"
  86. if [ -f "$SCRIPT_DIR/main.py" ]; then
  87. echo " ✅ main.py exists"
  88. else
  89. echo " ❌ main.py NOT found!"
  90. fi
  91. echo ""
  92. # Recommendations
  93. echo "=========================================="
  94. echo "Recommendations:"
  95. echo "=========================================="
  96. # Check if any critical issues
  97. ISSUES=0
  98. if ! systemctl is-enabled dune-weaver-touch >/dev/null 2>&1; then
  99. echo "❌ Enable the service: sudo systemctl enable dune-weaver-touch"
  100. ISSUES=$((ISSUES + 1))
  101. fi
  102. if [ ! -x "$SCRIPT_DIR/start-with-fb-check.sh" ]; then
  103. echo "❌ Make wrapper executable: chmod +x $SCRIPT_DIR/start-with-fb-check.sh"
  104. ISSUES=$((ISSUES + 1))
  105. fi
  106. if [ ! -d "$SCRIPT_DIR/venv" ]; then
  107. echo "❌ Reinstall: sudo ./install.sh"
  108. ISSUES=$((ISSUES + 1))
  109. fi
  110. if systemctl is-failed dune-weaver-touch >/dev/null 2>&1; then
  111. echo "⚠️ Service has failed - check logs above"
  112. echo " Try: sudo systemctl restart dune-weaver-touch"
  113. ISSUES=$((ISSUES + 1))
  114. fi
  115. if [ $ISSUES -eq 0 ]; then
  116. echo "✅ No critical issues detected"
  117. echo ""
  118. echo "If auto-start still doesn't work:"
  119. echo "1. Check logs: sudo journalctl -u dune-weaver-touch -b"
  120. echo "2. Try manual start: sudo systemctl start dune-weaver-touch"
  121. echo "3. Check for errors in output above"
  122. fi
  123. echo ""
  124. echo "=========================================="