Posts by agb


    Correct time is a good thing but is also cosmetic to the Kodi GUI so there is no reason to make Kodi start depend upon it. From a support perspective this would make things worse given that some routers act as bad/misconfigured NTP servers, users have a habit of adding typos to their input, and some ISP's blocking port 123 (lord knows why, but it happens).

    As 99% of NTP issues are seen on Raspberry Pi .. the cure is adding an RTC card not adding workarounds to the OS.

    Hmmm. It may be 'cosmetic' to you...but if Kodi starts before the clock is in sync, my network mounts fail.
    Interestingly, OSMC doesn't exhibit the problem - only difference being that I do the network mounts via /etc/fstab, rather than systemd [although I understand systemd handles fstab under the covers].
    Perhaps make it possible to configure whether Kodi uses time-sync.target or does what it currently does?
    This would mean actually implementing time-sync.target though, which you appear reluctant to support.

    PS I am aware there are workarounds for the mount failures. I have to use them :-}
    PPS I don't think my proposal is a workaround, rather a solution...
    [hr]
    chewitt
    I just reread my last reply, I wasn't being snarky, honest :-}
    [hr]
    Since LE already has an option "wait for network" in the LibreELEC settings add-on, perhaps
    another option "wait for clock synchronised" could be added, so people who don't care
    about the functionality needn't specify it.

    Extract from systemd.special

    <quote>
    time-sync.target

    Services responsible for synchronizing the system clock from a remote source (such as NTP client implementations) should pull in this target and order themselves before it. All services where correct time is essential should be ordered after this unit, but not pull it in. systemd automatically adds dependencies of type After= for this target unit to all SysV init script service units with an LSB header referring to the "$time" facility.
    </quote>

    LE currently has Kodi depend on network-online.target, but there can be a variable delay before the clock is sync'd. Implementing time-sync.target and having Kodi depend on it would would avoid problems with e.g. mounting network shares.


    The weird thing is system time was right. It was Cron had the wrong time.

    I had a similar problem in the way back with NPVR not recording, that one was because the PC BIOS clock somehow reset itself to the wrong time, but the NPVR guide had the correct time. I never figured out how that happened and the same PC has been running without any problems for several years since.

    donbrew
    Here's the tail of my journal with #1001.

    Oct 01 00:44:39 LibreELEC systemd[1]: Reached target Network is Online.
    Oct 01 00:44:39 LibreELEC connmand[407]: ntp: time slew +116391.088628 s
    Oct 02 09:04:30 LibreELEC systemd[1]: Starting Kodi Media Center...
    Oct 02 09:04:30 LibreELEC systemd[1]: Time has been changed
    Oct 02 09:04:30 LibreELEC kodi-config[689]: chmod: /storage/.kodi/addons/*/bin/*
    : No such file or directory
    Oct 02 09:04:30 LibreELEC systemd[1]: Started Kodi Media Center.

    Note the initial timestamps - kernel build time.
    On this occasion, 'Starting Kodi Media Center...' occurs after the clock is corrected.
    On other occasions it occurs before, there can be a variance of a few seconds.
    When it occurs before, my network mounts fail, because the Windows server
    doesn't like the clock difference.

    donbrew
    > Is there a way to force cron to wait for the time to set after a reboot?
    This is basically the same question I have been asking wrt mounting shares & time syncronisation :-}
    I think time-sync.target *ought* to be the answer, but systemd in LE doesn't seem to use/invoke it.

    PS If you add 'debugging' to cmdline.txt you get a raft of messages about connman and whatnot in the journal. I must confess I haven't found them very helpful :-{

    donbrew
    > I have no idea why it says Sept 29!
    Almost certainly because the time hasn't yet been sync'd :-} as per other threads...
    That date is the kernel build date of #929.
    So cron is starting before the clock is right - confirmed by the message about time disparity.

    Done all that, wouldn't be investigating otherwise :-}

    LibreELEC:~ # connmanctl clock
    Time = 1475274100
    TimeUpdates = auto
    Timezone = Europe/Belfast
    TimezoneUpdates = auto
    Timeservers = [ uk.pool.ntp.org ]
    [not quite sure where Belfast came from, I set it to Europe/London]

    donbrew
    I don't think that's quite how it works, but no point arguing about it :-}
    For the purpose of this discussion, the problem is that the Pi doesn't set its clock to the correct time before the network mounts are attempted.
    I've started another thread about Time synchronisation.

    As has been discussed recently in this thread LibreELEC
    and various other places, there are issues with LE time synchronisation.
    Systemd has a target 'time-sync.target' which does not appear to be used in LE.
    Is this by design or... ?

    I am running the Milhouse Krypton builds, currently #929.

    donbrew
    Not sure what you mean by 'gets the time from your LAN' :-}
    It gets it from an NTP server *somewhere* - be it your router, or in my case, the NTP servers specified by my DHCP server.

    I already have the 'wait for network' setting set, but the problem I am seeing is that the time doesn't get sync'd until a while after kodi starts, which is after the systemd mount services have already failed, as the Pi's time seems to be set from the kernel build time, as milhouse has explained some where.

    It isn't a showstopper, as I just SSH in and and rerun the mounts - this is OK on my 'development' Pi but would not be OK on the 'family' Pi :-}

    donbrew
    The reason I want to mount the shares outside of kodi is that I want them available across all profiles.
    *And* I want the pathnames for media to be of the form /media/share/etc/etc not smb://server/share/etc/etc.
    I appreciate that this may be a non-standard/unusual requirement :-} but it *is* my requirement.

    I use the same media and MySql dbs on OSMC.
    I have things working this way on OSMC and I would like LE to work the same way :-}

    Using systemd services I have got it all working now.
    The only fly in the ointment is that sometimes the mounts fail. I am fairly sure that this is because the Pi
    hasn't got the correct time from ntp yet, but I work around it by rerunning the mounts from a script.


    One thing: Using the /etc/fstab file is not the best solution as it will be overwritten with any upgrade (or downgrade) of LibreELEC. Either use autostart.sh with manual mount commands, or edit the smb.cnf file in /storage/.config (from the top of my head).

    Aha! I'll have to investigate autostart.sh, thanks.
    Still having trouble mounting a share manually, so will have to resolve that.
    I'm aware that /etc/fstab will get zapped, hence the reference to squashfs howto - make changes the read-only filesystem in OpenELEC - andreierdei
    in my last post.
    Can't find /storage/.config/smb.cnf - there's only a samba.conf.sample in there.
    Thanks anyway.
    [hr]
    Found the answer here:
    LibreELEC
    I'll set up some system.d services.
    Thanks all.


    Q1 Make an advancedsettings.xml file and stick a path substitution (have a look in the kodi wiki for details and examples).

    Q2. No idea.

    I'm not clear why you need multiple mysql databases (or why you need to mount for that matter) - it sounds like smart playlists would be an easier way to separate content.

    The separate libraries/databases are mainly to keep the number of entries manageable and maintain separate watched status.
    I use path substitution for other purposes, don't want to use smb:// paths in the databease, assuming the substitution
    could be made to work.
    I use smart playlists in the various profiles to subset the content via menus in the skin.
    Automounting avoids issues when switching profiles, as learned from bitter experience.
    I may have to use the technique of tweaking the squashfs as described here squashfs howto - make changes the read-only filesystem in OpenELEC - andreierdei
    if there's no other way to get the shares automounted.

    Thanks anyway.