Author Topic: [not quite SOLVED]lmce beta- media not being displayed  (Read 4925 times)

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
[not quite SOLVED]lmce beta- media not being displayed
« on: August 18, 2012, 12:43:21 am »
I installed the new beta after having trouble with my old install
Everything went rather nicely so far. The only issue while installing was with my MD, where the whole process took very long at "downloading XMLTV utils", but I was assured in the IRC that it would eventually finish, which it did.
However I found out later in the day, that none of my orbiters would display any kind of media. I checked in the webadmin and there they were..all nice on my two hdd residing in the core.
I checked with windows media player if mediatomb would serve them as well...which it did.
After some more checking, I found out, that when I booted the core/hybrid only, without the MD, then all the files would be displayed...and played too. Then I started the MD and after about 20 seconds, the media was gone from the orbiters.
So far I have no idea what causes it, or how I can prevent it....
Does anyone else has seen this?
« Last Edit: August 23, 2012, 07:24:28 pm by maverick0815 »

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
Re: [SOLVED]lmce beta- media not being displayed
« Reply #1 on: August 18, 2012, 07:03:58 pm »
it appears there is still a little bug out in the wild
so for anyone else who will encounter this problem:
webadmin>advanced>configuration>devices Select the affected drive and scroll down to ONLINE. This one is probably unchecked. Check it, Save, Reload Router and everything is back.
Thanks to Tschak for pointing me there.

Cheers
Mario

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1081
    • View Profile
Re: [SOLVED]lmce beta- media not being displayed
« Reply #2 on: August 19, 2012, 03:19:55 pm »
I am aware of the problem and am looking into it.
I never quit... I just ping out.

jamo

  • Guru
  • ****
  • Posts: 460
    • View Profile
    • LMCE user Page
Re: [SOLVED]lmce beta- media not being displayed
« Reply #3 on: August 20, 2012, 09:06:44 am »
it appears there is still a little bug out in the wild
so for anyone else who will encounter this problem:
webadmin>advanced>configuration>devices Select the affected drive and scroll down to ONLINE. This one is probably unchecked. Check it, Save, Reload Router and everything is back.
Thanks to Tschak for pointing me there.

Cheers
Mario
Mario, if it happens again, confirm that it is not a problem with SAMBA shares- that's what was happening to me and the reason it was going offline when an MD booted was because the MD could  not mount the samba share, so it told the system the drive must be offline.

See http://forum.linuxmce.org/index.php/topic,12721.0.html

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
Re: [SOLVED]lmce beta- media not being displayed
« Reply #4 on: August 20, 2012, 11:31:40 am »
hmm... I will check this out. When Thom told me to check the offline-flag in the webadmin, I assumed it would be a one time thing....but it really is happening at every boot of the md.
Interestingly, when I boot my windowsmachine, I receive a notification that not all my networkdrives could be reconnected (never happened with previous installs), but when I check them, they got the red crossout, but are fully accessible.

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1081
    • View Profile
Re: [SOLVED]lmce beta- media not being displayed
« Reply #5 on: August 20, 2012, 04:32:28 pm »
hmm... I will check this out. When Thom told me to check the offline-flag in the webadmin, I assumed it would be a one time thing....but it really is happening at every boot of the md.
Interestingly, when I boot my windowsmachine, I receive a notification that not all my networkdrives could be reconnected (never happened with previous installs), but when I check them, they got the red crossout, but are fully accessible.

Oh... thats awesome. I can't reproduce this... so if you can reliably reproduce it then you can help me fix it :)

I have a few different directions I am going with this, so what I will do is drop several versions of StorageDevices_StatsRadar.sh which you will replace on all machines.
I never quit... I just ping out.

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
Re: [SOLVED]lmce beta- media not being displayed
« Reply #6 on: August 20, 2012, 05:13:29 pm »
okay, no problem....just shoot

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
Re: [SOLVED]lmce beta- media not being displayed
« Reply #7 on: August 20, 2012, 08:39:11 pm »
so I tried from here http://forum.linuxmce.org/index.php/topic,12721.msg91271.html#msg91271
Quote
smbclient -A /usr/pluto/var/sambaCredentials.secret --list=//192.168.80.1 --grepable

and get also this:
Quote
NT_STATUS_LOGON_FAILURE
I don't know if that helps

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
Re: [not quite SOLVED]lmce beta- media not being displayed
« Reply #8 on: August 25, 2012, 07:10:53 pm »
I've been pondering right now whether or not scrap this installation and try the latest snapshot...since it seems I might more or less be the only one with this weird issue.
Right now my procedure is always the following:
boot up MD
go to webadmin, set the two host drives as online
reload router
wait until everything has quieted down
start mythtv,mythvtv crahes,start mythtv...repeat until stable enough to watch

so, what is your experience with the beta so far? anything like this showing up on your radar?

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3013
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: [not quite SOLVED]lmce beta- media not being displayed
« Reply #9 on: August 25, 2012, 07:51:52 pm »
* posde is using VDR and has been for a LOOOONG time

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
Re: [not quite SOLVED]lmce beta- media not being displayed
« Reply #10 on: August 25, 2012, 08:35:47 pm »
When I started using linuxmce it was still 7.10....I actually tried vdr first, but I was a bit underwhelmed because integration wasn't so great at that time.
So right now with mythtv, all I have to do is install the firmware for my tv-card and only need to perform a channelscan and that's it...how is vdr now ...aside from the fact that mythtv is scrapping out, while you have vdr reliably running(?)

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1081
    • View Profile
Re: [not quite SOLVED]lmce beta- media not being displayed
« Reply #11 on: August 25, 2012, 11:19:59 pm »
Sorry... sort of forgot about this. Will start creating radars now.
I never quit... I just ping out.

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1081
    • View Profile
Re: [not quite SOLVED]lmce beta- media not being displayed
« Reply #12 on: August 26, 2012, 02:40:53 am »
Please try this one.
This one assumes that enough time is not being given for a response before determining that it is offline.


Code: [Select]
#!/bin/bash

if [[ $1 != "background" ]] ;then
        echo "Backgrounding ..."
        screen -d -m -S "StorageStatusRadar" "$0" "background"
        exit 0
fi


. /usr/pluto/bin/SQL_Ops.sh 2>/dev/null || exit 1
. /usr/pluto/bin/Config_Ops.sh 2>/dev/null || exit 1

TPL_BUFFALO=1794
TPL_FILESERVER=1837
TPL_WINDOWS_SHARE=1768
TPL_NFS_SHARE=1769
TPL_INTERNAL_DRIVE=1790
TPL_RAID_0=1854
TPL_RAID_1=1851
TPL_RAID_5=1849
TPL_MEDIA_PLUGIN=2

CMD_REFRESH_LIST_OF_ONLINE_DEVICES=831

DD_SHARE_NAME=126
DD_USERNAME=127
DD_PASSWORD=128
DD_ONLINE=195
DD_UUID=267
DD_READONLY=194
DD_BLOCK_DEV=152

EV_User_Password_Mismatch=70

EVP_PK_Device=26
EVP_Comment=58

function CacheSet() {
local Key="$1";
local Val="$2"
local Id=$(echo "$Key" | md5sum | cut -d' ' -f1)

eval "Cache_${Id}='$Val'"
}

function CacheGet() {
local Key="$1"
local Id=$(echo "$Key" | md5sum | cut -d' ' -f1)

Cache="Cache_${Id}"
echo "${!Cache}"
}

function SetDeviceOnline() {
local Device_ID=$1
local OnlineValue=$2
local Q=""


OldValue=$(CacheGet "$Device_ID")
if [[ "$OldValue" == "" ]] ;then
Q="SELECT IK_DeviceData FROM Device_DeviceData WHERE FK_Device = '$Device_ID' AND FK_DeviceData='$DD_ONLINE'"
OldValue=$(RunSQL "$Q")
OldValue=$(Field "1" "$OldValue")
fi

CacheSet "$Device_ID" "$OnlineValue"
if [[ "$OldValue" != "$OnlineValue" ]] ;then

Q="UPDATE Device_DeviceData SET IK_DeviceData = '$OnlineValue' WHERE FK_Device = '$Device_ID' AND FK_DeviceData= '$DD_ONLINE'"
RunSQL "$Q"

if [[ $OnlineValue == "0" ]] ;then
umount -lf /mnt/device/$Device_ID 2>/dev/null 1>/dev/null
fi

/usr/pluto/bin/MessageSend "$DCERouter" -targetType template $Device_ID $TPL_MEDIA_PLUGIN 1 $CMD_REFRESH_LIST_OF_ONLINE_DEVICES

Log "----------------- DEVICE $Device_ID $OnlineValue"
else

Log "----------------- DEVICE $Device_ID $OnlineValue (unchanged)"
fi
}

function SetKidsOnline() {
local Device_ID=$1
local OnlineValue=$2
local Q=""
local R=""
local Device_Child=""

Q="SELECT PK_Device FROM Device WHERE FK_Device_ControlledVia = '$Device_ID' AND FK_DeviceTemplate IN ($TPL_INTERNAL_DRIVE, $TPL_WINDOWS_SHARE, $TPL_NFS_SHARE)"
R=$(RunCSQL "$Q")
for Device_Child in $R ;do
Device_Child=$(Field 1 "$Device_Child")
SetDeviceOnline "$Device_Child" "$OnlineValue"
done
}

function Log() {
local Message=$1

echo "$(date -R) $Message"
}

InitCSQL "StorageDevices_StatusRadar"
PurgeCSQL "StorageDevices_StatusRadar"
LastRouterReload="$(stat -c %Y /usr/pluto/var/DCERouter.running)"
while : ;do
if [[ "$LastRouterReload" != "$(stat -c %Y /usr/pluto/var/DCERouter.running)" ]] ;then
LastRouterReload="$(stat -c %Y /usr/pluto/var/DCERouter.running)"
PurgeCSQL "StorageDevices_StatusRadar"
fi

## Get a list with all the File Servers from the database
Q="
SELECT
Device.PK_Device,
Device.IPaddress,
Username.IK_DeviceData,
Password.IK_DeviceData
FROM
Device
LEFT JOIN Device_DeviceData Username ON Username.FK_Device = Device.PK_Device AND Username.FK_DeviceData = '$DD_USERNAME'
LEFT JOIN Device_DeviceData Password ON Password.FK_Device = Device.PK_Device AND Password.FK_DeviceData = '$DD_PASSWORD'
WHERE
Device.FK_DeviceTemplate IN ($TPL_BUFFALO, $TPL_FILESERVER)

"
FileServerList=$(RunCSQL "$Q")

## Test each file server
for FileServer in $FileServerList ;do
Device_ID=$(Field 1 "$FileServer")
Device_IP=$(Field 2 "$FileServer")
Device_Username=$(Field 3 "$FileServer")
Device_Password=$(Field 4 "$FileServer")

if [[ "$Device_IP" == "" ]] ;then
SetKidsOnline "$Device_ID" "0"
Log "Device $Device_ID has no IP address associated with it."
continue
fi

## Test to see if the file server is online or not
ping -qnc 2 -W 5 "$Device_IP" &> /dev/null
HostIsUp=$?
if [[ "$HostIsUp" != "0" ]] ;then
SetKidsOnline "$Device_ID" "0"
Log "Device $Device_ID ($Device_IP) doesn't respond to our ping."
continue
fi


Log "Device $Device_ID ($Device_IP) is online trying each of samba kids to see it they are still available"
## Get a list of samba shares related to this device
Q="
SELECT
PK_Device,
ShareName.IK_DeviceData,
Username.IK_DeviceData,
Password.IK_DeviceData
FROM
Device
LEFT JOIN Device_DeviceData ShareName ON ShareName.FK_Device = Device.PK_Device AND ShareName.FK_DeviceData = '$DD_SHARE_NAME'
LEFT JOIN Device_DeviceData Username ON Username.FK_Device = Device.PK_Device AND Username.FK_DeviceData = '$DD_USERNAME'
LEFT JOIN Device_DeviceData Password ON Password.FK_Device = Device.PK_Device AND Password.FK_DeviceData = '$DD_PASSWORD'
WHERE
FK_Device_ControlledVia = '$Device_ID'
AND
FK_DeviceTemplate = '$TPL_WINDOWS_SHARE'
"
SambaShareList=$(RunCSQL "$Q")

## Test each samba share to see if is available or not
for SambaShare in $SambaShareList ;do

if [[ "$SambaShare" == "" ]] ;then
continue
fi

Share_ID=$(Field "1" "$SambaShare")
Share_Name=$(Field "2" "$SambaShare")
Share_Username=$(Field "3" "$SambaShare")
Share_Password=$(Field "4" "$SambaShare")

## Test if the share is still in the list
smbclient -U $Device_Username%$Device_Password --list=//$Device_IP --grepable 2>/dev/null | grep "^Disk" | cut -d'|' -f2 | grep -q "^${Share_Name}$"
isShareInList=$?

## Try with the listing the shares with the username/password of the share
if [[ "$isShareInList" != 0 ]] ;then
set -x
smbclient -U $Share_Username%$Share_Password --list=//$Device_IP --grepable 2>/dev/null | grep "^Disk" | cut -d'|' -f2 | grep -q "^${Share_Name}$"
isShareInList=$?
set +x
fi

if [[ "$isShareInList" != "0" ]] ;then
Log "Share $Share_ID ($Share_Name) is not advertised by the smb server, trying any how"
# SetDeviceOnline "$Share_ID" "0"
# continue
fi

## Test if the share is still mountable with the username/password that we have
smbclient -U $Share_Username%$Share_Password "//$Device_IP/$Share_Name" -c 'pwd' 1>/dev/null 2>/dev/null
isShareMountable=$?

if [[ "$isShareMountable" != "0" ]] ;then
Msg="Share $Share_ID ($Share_Name) is not mountable with the username/pass that i have"
Log "$Msg"
/usr/pluto/bin/MessageSend "$DCERouter" 0 -1001 2 "$EV_User_Password_Mismatch" "$EVP_PK_Device" "$Share_ID" "$EVP_Comment" "$Msg"
SetDeviceOnline "$Share_ID" "0"
continue
fi

SetDeviceOnline "$Share_ID" "1"
done


## Get a list of nfs shares related to this device
Q="
                SELECT
                        PK_Device,
                        ShareName.IK_DeviceData,
                        Username.IK_DeviceData,
                        Password.IK_DeviceData
                FROM
                        Device
                        LEFT JOIN Device_DeviceData ShareName ON ShareName.FK_Device = Device.PK_Device AND ShareName.FK_DeviceData = '$DD_SHARE_NAME'
                        LEFT JOIN Device_DeviceData Username ON Username.FK_Device = Device.PK_Device AND Username.FK_DeviceData = '$DD_USERNAME'
                        LEFT JOIN Device_DeviceData Password ON Password.FK_Device = Device.PK_Device AND Password.FK_DeviceData = '$DD_PASSWORD'
                WHERE
                        FK_Device_ControlledVia = '$Device_ID'
                        AND
                        FK_DeviceTemplate = '$TPL_NFS_SHARE'
                "
NFSShareList=$(RunCSQL "$Q")

## Test each nfs share to see if is available on not
for NFSShare in $NFSShareList ;do
if [[ "$NFSShare" == "" ]] ;then
continue
fi

Share_ID=$(Field "1" "$NFSShare")
                        Share_Name=$(Field "2" "$NFSShare")
                        Share_Username=$(Field "3" "$NFSShare")
                        Share_Password=$(Field "4" "$NFSShare")

## Test if the share is still in the list
showmount -e $Device_IP | cut -d ' ' -f1 | grep "^${Share_Name}$"
isShareInList=$?

if [[ "$isShareInList" != "0" ]] ;then
Log "Share $Share_ID ($Share_Name) is not advertised by the nfs server"
SetDeviceOnline "$Share_ID" "0"
continue
fi

                        ## See if the share is mountable
                        mountDirTemp=$(mktemp -d /tmp/StorageDevices_StatusRadar.temp.mount.XXXXXXXXX)
                        mount ${Device_IP}:${Share_Name} $mountDirTemp 1>/dev/null 2>/dev/null
                        isShareMountable=$?

                        if [[ "$isShareMountable" != "0" ]] ;then
                                Log "Share $Share_ID ($Share_Name) cannot be mounted"
                                SetDeviceOnline "$Share_ID" "0"
rmdir $mountDirTemp
continue
                        else
                                umount -lf $mountDirTemp 1>/dev/null 2>/dev/null
                                rmdir $mountDirTemp
                        fi

SetDeviceOnline "$Share_ID" "1"
done
done

## Get a list of internal drives
Q="
SELECT
PK_Device,
FK_Device_ControlledVia,
UUID.IK_DeviceData,
BlockDev.IK_DeviceData,
FK_DeviceTemplate
FROM
Device
LEFT JOIN Device_DeviceData BlockDev ON BlockDev.FK_Device = Device.PK_Device AND BlockDev.FK_DeviceData = '$DD_BLOCK_DEV'
LEFT JOIN Device_DeviceData UUID     ON UUID.FK_Device     = Device.PK_Device AND UUID.FK_DeviceData     = '$DD_UUID'
WHERE
FK_DeviceTemplate IN ($TPL_INTERNAL_DRIVE, $TPL_RAID_0, $TPL_RAID_1, $TPL_RAID_5)
"
InternalDriveList=$(RunCSQL "$Q")

## Test each internal drive and see if is available
for InternalDrive in $InternalDriveList ;do
if [[ "$InternalDrive" == "" ]] ;then
continue;
fi

IDrive_ID=$(Field "1" "$InternalDrive")
IDrive_Parent=$(Field "2" "$InternalDrive")
IDrive_UUID=$(Field "3" "$InternalDrive")
IDrive_BlockDev=$(Field "4" "$InternalDrive")
IDrive_DeviceTemplate=$(Field "5" "$InternalDrive")

## If is a New Raid with no UUID associated (UUID="") or a Internal Drive in the old format (UUID="NULL" or UUID="")
## then we translate the block device to uuid
if [[ "$IDrive_Parent" == "$PK_Device" ]] ;then
if [[ "$IDrive_UUID" == "" || "$IDrive_UUID" == "NULL" ]] && [[ "$IDrive_BlockDev" != "NULL" ]] ;then
IDrive_UUID=$(udevadm info --query=all --name="$IDrive_BlockDev" |  grep 'ID_FS_UUID=' | cut -d'=' -f2)

if [[ "$IDrive_UUID" != "" ]] ;then
RunSQL "UPDATE Device_DeviceData SET IK_DeviceData = '$IDrive_UUID' WHERE FK_Device = '$IDrive_ID' AND FK_DeviceData = '$DD_UUID'"
else
echo "Can't find the uuid of device $IDrive_ID"
continue
fi
fi
fi

## Is one of our internal drives
if [[ "$IDrive_Parent" == "$PK_Device" ]] ;then

if [[ "$IDrive_DeviceTemplate" == "$TPL_INTERNAL_DRIVE" ]] ;then
## See if a device with that UUID can be found in the hal tree
IDrive_HalUDI=$(hal-find-by-property --key 'volume.uuid' --string "$IDrive_UUID")
if [[ "$IDrive_HalUDI" == "" ]] ;then
Log "Drive $IDrive_ID ($IDrive_UUID) cannot be found in hal tree"
SetDeviceOnline "$IDrive_ID" "0"
continue
fi

## See if we have a block device associated with that UUID
IDrive_BlockDev=$(hal-get-property --udi "$IDrive_HalUDI" --key 'block.device')
if [[ "$IDrive_BlockDev" == "" ]] ;then
Log "Drive $IDrive_ID ($IDrive_UUID) doesn't have a block device associated"
SetDeviceOnline "$IDrive_ID" "0"
fi
fi

## See if is still available in /proc/partitions
cat /proc/partitions | grep -q "${IDrive_BlockDev##/dev/}$"
isDriveAvailable=$?

if [[ "$isDriveAvailable" != "0" ]] ;then
Log "Drive $IDrive_ID ($IDrive_UUID) that's associated with $IDrive_BlockDev cannot be found in /proc/partitions"
SetDeviceOnline "$IDrive_ID" "0"
continue
fi

## See if the drive is mountable
mountDirTemp=$(mktemp -d /tmp/StorageDevices_StatusRadar.temp.mount.XXXXXXXXX)
mount ${IDrive_BlockDev} $mountDirTemp 1>/dev/null 2>/dev/null
isDriveMountable=$?

if [[ "$isDriveMountable" != "0" ]] ;then
Log "Drive $IDrive_ID ($IDrive_UUID) that's associated with $IDrive_BlockDev cannot be mounted"
SetDeviceOnline "$IDrive_ID" "0"
rmdir $mountDirTemp
continue
else
umount -lf $mountDirTemp 1>/dev/null 2>/dev/null
rmdir $mountDirTemp
fi

SetDeviceOnline "$IDrive_ID" "1"


## Is a internal drive located on a remote computer
else

## Get the ip of the parent device
IDrive_IP=$(RunCSQL "SELECT IPaddress FROM Device WHERE PK_Device='${IDrive_Parent}'")
IDrive_IP=$(Field "1" "$IDrive_IP")

                        ## Test to see if the parent is online or not
ping -qnc 2 -W 5 "$IDrive_IP" &> /dev/null
HostIsUp=$?
if [[ "$HostIsUp" != "0" ]] ;then
SetKidsOnline "$IDrive_Parent" "0"
Log "Device $IDrive_Parent ($IDrive_IP) doesn't respond to our ping."
continue
fi

                        ## Test if the share is still in the list
                        smbclient -A /usr/pluto/var/sambaCredentials.secret --list=//$IDrive_IP --grepable 2>/dev/null | grep "^Disk" | cut -d'|' -f2 | grep -q "^Storage$IDrive_ID\$$"
                        isShareInList=$?

                        if [[ "$isShareInList" != "0" ]] ;then
                                Log "Drive $IDrive_ID ($IDrive_UUID) is not advertised by it's parent smb server ($IDrive_IP)"
                                SetDeviceOnline "$IDrive_ID" "0"
                                continue
                        fi

                        ## Test if the share is still mountable with the username/password that we have
                        smbclient -A /usr/pluto/var/sambaCredentials.secret "//$IDrive_IP/Storage$IDrive_ID\$" -c 'pwd' 1>/dev/null 2>/dev/null
                        isShareMountable=$?

                        if [[ "$isShareMountable" != "0" ]] ;then
                                Msg="Drive $IDrive_ID ($IDrive_IP $IDrive_UUID) cannot be mounted"
                                Log "$Msg"
                                SetDeviceOnline "$IDrive_ID" "0"
                                continue
                        fi

                        SetDeviceOnline "$IDrive_ID" "1"
fi
done


sleep 5
done
I never quit... I just ping out.

maverick0815

  • Addicted
  • *
  • Posts: 545
    • View Profile
Re: [not quite SOLVED]lmce beta- media not being displayed
« Reply #13 on: August 26, 2012, 09:59:57 am »
I'd be happy to do that, if I was sure about the what and where

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3013
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: [not quite SOLVED]lmce beta- media not being displayed
« Reply #14 on: August 26, 2012, 10:09:44 am »
It is a new /usr/pluto/bin/StorageRadar.sh - at least it looks like one to me.