mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2024-11-25 02:36:17 +00:00
82508e7a83
port of
7c034fe482
196 lines
5.5 KiB
Bash
Executable File
196 lines
5.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
|
|
|
# create logfile
|
|
|
|
DATE=`date -u +%Y-%m-%d-%H.%M.%S`
|
|
BASEDIR="/tmp"
|
|
LOGDIR="log-$DATE"
|
|
RELEASE="`cat /etc/release`"
|
|
GIT="`cat /etc/issue | grep git`"
|
|
|
|
getlog_cmd() {
|
|
if command -v $1 >/dev/null; then
|
|
echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "# ... output of $@" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "# Lakka release: $RELEASE" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "# $GIT" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
$@ >> $BASEDIR/$LOGDIR/$LOGFILE 2>&1
|
|
echo "" >> $BASEDIR/$LOGDIR/$LOGFILE
|
|
fi
|
|
}
|
|
|
|
get_governor_details() {
|
|
(
|
|
cat_all_files /sys/devices/system/cpu
|
|
cat_all_files /sys/devices/system/cpu/cpufreq
|
|
for cpun in /sys/devices/system/cpu/cpu[0-9]*; do
|
|
cat_all_files ${cpun}/cpufreq
|
|
done
|
|
)
|
|
}
|
|
|
|
cat_all_files() {
|
|
local adir=$1
|
|
local afile var
|
|
|
|
[ -d ${adir} ] || return 0
|
|
|
|
echo "${adir}"
|
|
|
|
cd ${adir}
|
|
for afile in $(find . -maxdepth 1 -print | sort); do
|
|
afile=${afile:2}
|
|
if [ -n "${afile}" ]; then
|
|
if [ -d ${afile} ]; then
|
|
var="<dir>"
|
|
else
|
|
var="$(cat ${afile} 2>/dev/null)"
|
|
fi
|
|
[ -n "${var}" ] && printf " %-30s : %s\n" "${afile}" "${var}"
|
|
fi
|
|
done
|
|
}
|
|
|
|
rm -rf $BASEDIR/$LOGDIR
|
|
mkdir -p $BASEDIR/$LOGDIR
|
|
|
|
# RetroArch.log
|
|
LOGFILE="01_RetroArch.log"
|
|
echo "The retroarch.service will be stopped and separate RetroArch process will be started to acquire log. Perform actions that lead to the bug/issue. In case the issue does not end with a segmentation fault / RetroArch crashing, exit RetroArch via 'Restart RetroArch'."
|
|
read -p "Press ENTER to continue..."
|
|
systemctl stop retroarch.service
|
|
export LIBGL_DEBUG=verbose
|
|
getlog_cmd retroarch -v
|
|
|
|
# System.log
|
|
LOGFILE="02_System.log"
|
|
getlog_cmd dmesg
|
|
getlog_cmd lsmod
|
|
getlog_cmd ps xa
|
|
for i in /storage/.config/hwdb.d/*.hwdb \
|
|
/storage/.config/modprobe.d/*.conf \
|
|
/storage/.config/modules-load.d/*.conf \
|
|
/storage/.config/sleep.d/*.power \
|
|
/storage/.config/sysctl.d/*.conf \
|
|
/storage/.config/udev.rules.d/.rules \
|
|
; do
|
|
if [ -f "$i" ] ; then
|
|
getlog_cmd cat $i
|
|
fi
|
|
done
|
|
if [ -f "/storage/.config/autostart.sh" ] ; then
|
|
getlog_cmd cat /storage/.config/autostart.sh
|
|
fi
|
|
if [ -f "/storage/.config/shutdown.sh" ] ; then
|
|
getlog_cmd cat /storage/.config/shutdown.sh
|
|
fi
|
|
getlog_cmd ls -laR /storage/.config/system.d
|
|
# note: we dont add .mount units here as they may contan
|
|
# login credentials
|
|
for i in /storage/.config/system.d/*.service ; do
|
|
if [ -f "$i" -a ! -L "$i" ] ; then
|
|
getlog_cmd cat $i
|
|
fi
|
|
done
|
|
|
|
# Hardware.log
|
|
LOGFILE="03_Hardware.log"
|
|
getlog_cmd lspci -vvvvnn
|
|
getlog_cmd lsusb -vvv
|
|
getlog_cmd lsusb -t
|
|
getlog_cmd cat /proc/cpuinfo
|
|
getlog_cmd get_governor_details
|
|
getlog_cmd cat /proc/meminfo
|
|
|
|
# Audio.log
|
|
LOGFILE="04_Audio.log"
|
|
getlog_cmd aplay -l
|
|
getlog_cmd aplay -L
|
|
getlog_cmd amixer
|
|
|
|
# Network.log
|
|
LOGFILE="05_Network.log"
|
|
getlog_cmd ifconfig -a
|
|
getlog_cmd netstat -rn
|
|
getlog_cmd netstat -nalp
|
|
getlog_cmd connmanctl services
|
|
getlog_cmd cat /etc/resolv.conf
|
|
|
|
# varlog.log
|
|
LOGFILE="06_varlog.log"
|
|
for i in `find /var/log -type f`; do
|
|
getlog_cmd cat $i
|
|
done
|
|
|
|
# Input.log
|
|
LOGFILE="07_input.log"
|
|
getlog_cmd cat /proc/bus/input/devices
|
|
# make RPi users happy
|
|
if [ -e /proc/acpi/wakeup ] ; then
|
|
getlog_cmd cat /proc/acpi/wakeup
|
|
fi
|
|
|
|
# Filesystem.log
|
|
LOGFILE="08_Filesystem.log"
|
|
getlog_cmd cat /proc/mounts
|
|
getlog_cmd df -h
|
|
getlog_cmd blkid
|
|
|
|
# Journal (current)
|
|
LOGFILE="09_Journal-cur.log"
|
|
getlog_cmd journalctl --no-pager -b -0
|
|
|
|
# Journal (prev)
|
|
LOGFILE="10_Journal-prev.log"
|
|
getlog_cmd journalctl --no-pager -b -1
|
|
|
|
# pack logfiles
|
|
mkdir -p /storage/logfiles
|
|
zip -jq /storage/logfiles/log-$DATE.zip $BASEDIR/$LOGDIR/*
|
|
|
|
# remove logdir
|
|
rm -rf $BASEDIR/$LOGDIR
|
|
|
|
# upload / move to /flash
|
|
echo "Archive with logs 'log-$DATE.zip' was created and stored in the samba share 'Logs' (/storage/logfiles)."
|
|
echo " 1) Leave the archive only in the samba share (requires working access to the Lakka shared folders)"
|
|
echo " 2) Copy the archive to the FAT32 partition (requires a computer where you can read your SD/USB)"
|
|
echo " 3) Upload the archive to https://transfer.sh (requires working internet connection on the Lakka device)"
|
|
echo ""
|
|
while true ; do
|
|
read -rsn1 -p "Your choice? (1-3) " choice
|
|
if [ $choice -eq 1 -o $choice -eq 2 -o $choice -eq 3 ]; then
|
|
break
|
|
else
|
|
echo "Invalid choice: $choice"
|
|
fi
|
|
done
|
|
case $choice in
|
|
1)
|
|
echo "The archive is prepared in the 'Logs' share."
|
|
break
|
|
;;
|
|
2)
|
|
echo "Remounting /flash (FAT32) partition for write access..."
|
|
mount -o remount,rw /flash
|
|
echo "Copying archive to /flash partition..."
|
|
cp /storage/logfiles/log-$DATE.zip /flash
|
|
echo "Remounting /flash (FAT32) partition for read-only access..."
|
|
mount -o remount,ro /flash
|
|
echo "The archive was copied to the root of the FAT32 partition."
|
|
break
|
|
;;
|
|
3)
|
|
echo "Uploading archive to https://transfer.sh:"
|
|
curl --upload-file /storage/logfiles/log-$DATE.zip https://transfer.sh/log-$DATE.zip
|
|
echo " <- provide this URL in your bug/issue report."
|
|
break
|
|
;;
|
|
esac
|
|
echo ""
|
|
echo "Finished. You may now start RetroArch (systemctl start retroarch.service) or poweroff / reboot your Lakka device."
|