Autor Thema: /etc/ld.so.preload conflicts on ubuntu  (Gelesen 8964 mal)

tvrulesme

  • Newbie
  • *
  • Beiträge: 6
    • Profil anzeigen
/etc/ld.so.preload conflicts on ubuntu
« am: Dezember 01, 2018, 09:32:27 Vormittag »
I have a Sundtek MediaTV Pro which used to be installed on a raspberry Pi.

I am moving to Ubuntu Server with the following os:
ubuntu:~/$ lsb_release -a
No LSB modules are available.
Distributor ID:   Ubuntu
Description:   Ubuntu 18.04.1 LTS
Release:   18.04
Codename:   bionic

There is a problem with ld.so.preload
With the line /opt/lib/libmediaclient.so # I can use wscan to view my channels
w_scan -c GB
w_scan version 20170107 (compiled for DVB API 5.10)
using settings for UNITED KINGDOM
DVB aerial
DVB-T GB
scan type TERRESTRIAL, channellist 6
output format vdr-2.0
WARNING: could not guess your codepage. Falling back to 'UTF-8'
output charset 'UTF-8', use -C <charset> to override
Info: using DVB adapter auto detection.
/dev/dvb/adapter0/frontend0 -> TERRESTRIAL "Sundtek DVB-T (III)": very good :-))

Using TERRESTRIAL frontend (adapter /dev/dvb/adapter0/frontend0)
-_-_-_-_ Getting frontend capabilities-_-_-_-_
Using DVB API 5.10
frontend 'Sundtek DVB-T (III)' supports
DVB-T2
INVERSION_AUTO
QAM_AUTO not supported, trying QAM_64.
TRANSMISSION_MODE_AUTO
GUARD_INTERVAL_AUTO
HIERARCHY_AUTO
FEC_AUTO
BANDWIDTH_AUTO not supported, trying 6/7/8 MHz.
FREQ (42.00MHz ... 1002.00MHz)
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Scanning DVB-T...
Scanning 8MHz frequencies...
474000: (time: 00:02.608) ^C
..

But this causes errors for all other programs:
ERROR: ld.so: object '/opt/lib/libmediaclient.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
But if I comment the line wscan fails
w_scan -c GB
w_scan version 20170107 (compiled for DVB API 5.10)
using settings for UNITED KINGDOM
DVB aerial
DVB-T GB
scan type TERRESTRIAL, channellist 6
output format vdr-2.0
WARNING: could not guess your codepage. Falling back to 'UTF-8'
output charset 'UTF-8', use -C <charset> to override
Info: using DVB adapter auto detection.
main:4007: FATAL: ***** NO USEABLE TERRESTRIAL CARD FOUND. *****
Please check wether dvb driver is loaded and
verify that no dvb application (i.e. vdr) is running.

Clearly this server is not only used for your Sundtek MediaTV Pro so do you have a fix for this conflict?

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #1 am: Dezember 01, 2018, 09:37:53 Vormittag »
You're mixing 32 and 64bit applications.
Libc is quite advanced, but the dot on the i is missing by separating /etc/ld.so.preload to 64 and 32bit.

You can isolate the command by prefixing your application:
Zitat
LD_PRELOAD=/opt/lib/libmediaclient.so w_scan -c GB

or running "export LD_PRELOAD=/opt/lib/libmediaclient.so" before accessing the tuner within a terminal/shell session

/etc/ld.so.preload is global, and the default behaviour.

The driver can be installed with the flag -service to not register in /etc/ld.so.preload, and you could also use our streaming server: https://support.sundtek.com/index.php?topic=2099.0 (which is work in progress).

The background here is that linux offers 2 kind of drivers, kernelspace and userspace drivers for USB. While kernelspace drivers need to be compiled for every single kernel version out there the userspace drivers lets us having one driver per architecture only supporting all Linux versions from 2006 on.
When we update the driver all systems will benefit of the latest updates because it's so easy to install.
« Letzte Änderung: Dezember 01, 2018, 09:40:22 Vormittag von Sundtek »
Failure is a good thing! I'll fix it

tvrulesme

  • Newbie
  • *
  • Beiträge: 6
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #2 am: Dezember 03, 2018, 08:05:42 Nachmittag »
I think you're missing the point here

tvrulesme@ubuntu:~/sundtek$ export LD_PRELOAD=/opt/lib/libmediaclient.so
tvrulesme@ubuntu:~/sundtek$ docker ps
ERROR: ld.so: object '/opt/lib/libmediaclient.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/opt/lib/libmediaclient.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

So your meeting of an environment variable for LD_PRELOAD becomes accessible to all applications. Surely this is terrible practice. Even if it doesn't actually cause anything to fail it seems very badly written to me

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #3 am: Dezember 03, 2018, 09:38:20 Nachmittag »
This is Libc not our code.
libc was not adapted to separate 32 and 64bit.

You only need to export LD_PRELOAD before running your target TV application - the export command is only temporary for the current session, if you know what you're doing (and prefer to isolate it) you can just isolate it that way.

Redhat once fixed that by introducing LD_PRELOAD_64 etc. however it's not a mainline thing.
The issue should be addressed to the libc project, and mixing 32 and 64bit system binaries.

it's clearly fixable but someone with access to the glibc library has to fix it.

Reference:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/33994
« Letzte Änderung: Dezember 03, 2018, 09:40:47 Nachmittag von Sundtek »
Failure is a good thing! I'll fix it

tvrulesme

  • Newbie
  • *
  • Beiträge: 6
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #4 am: Dezember 04, 2018, 08:32:16 Vormittag »
"if you know what you're doing (and prefer to isolate it) you can just isolate it that way"

Honestly given the very high price of this unit (89,00 € currently) I would expect you to be a lot more proactive with your help. Libc is included with every single Linux distribution which makes me assume that their customer base is far far wider than yours. The expectation in this case is that you adapt to their changes, not the other way round. The bug you link to was reported in 2006 so they are clearly not in a hurry to resolve it and it also gave you plenty of time to come up with a fix yourselves.

Let's compare this workaround with your competition.

https://www.ebay.co.uk/p/Xbox-One-Digital-TV-Tuner-Xb1-Genuine-Microsoft/2255654535?iid=123475149092&_trkparms=aid%3D333200%26algo%3DCOMP.MBE%26ao%3D1%26asc%3D20140107084022%26meid%3D452b916268ae46ababd5a28c76c8bc06%26pid%3D100011%26rk%3D3%26rkt%3D12%26sd%3D173381285507%26itm%3D123475149092&_trksid=p2047675.c100011.m1850

So for £10.99 I get the equivalent of your product. Installation is simple, drop the dvb-usb-dib0700-1.20.fw into /lib/firmware and sudo reboot. That's it!

When I'm shopping around for products I always check out the support forums to know I will get after sales service, I assume others are the same.

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #5 am: Dezember 04, 2018, 10:27:24 Vormittag »
MediaTV Pro supports:
* AnalogTV { PAL / SECAM / NTSC }
* FM radio
* S-Video/Composite
* DVB-C/T/T2 { bandwidth up to 144 MBit is supported }

And comes with:
* Remote Control
* Antenna
* USB extension
* S-Video/Composite extension cable

USB Transfers support:
* Bulk / Isochronous

Nearly all Linux Versions from 2006 are supported (ARM{32/64}bit, MIPS, PPC, SH4, x86{32/64}bit, various libcs) are supported and the driver can be installed within 10 seconds.

Drivers are available for Windows, Mac, Linux, Android (last one on request)

I think you're comparing the wrong items, we have spent tons of time to make things as easy as possible.

Aside of that our driver supports devices which we have sold since 2008, and updates are also regular { while the tuner you mentioned does not get any update especially from the vendor }

If you think anyone would really give a damn about customers for £10.99 for the next years that's pure insulting.
Several users have reported that the mentioned cheap tuner gives some glitches from time to time - the sensitivity is not as good as our one.
Plus even our manufacturing cost for that tuner is far above that price (and we already assemble by ourself - so the pure component cost is higher than that price)
Surely it might work fine for you but it doesn't for everyone.

I've told you what you can do, if you cannot live with that you might better sell the unit and get the other tuner.
The mentioned issue is a libc issue, I'm not even sure if we have reported this already years ago.

Alternatively the driver can be installed with the -service flag and our streamingserver can be used, because the LD_PRELOAD command is only needed to provide native support for legacy applications. TV applications could also directly connect to the driver {server} application (just as our DLNA streamingserver is doing)
https://support.sundtek.com/index.php?topic=2099.0

That one is still being developed.
« Letzte Änderung: Dezember 04, 2018, 11:56:29 Vormittag von Sundtek »
Failure is a good thing! I'll fix it

tvrulesme

  • Newbie
  • *
  • Beiträge: 6
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #6 am: Dezember 17, 2018, 07:29:33 Vormittag »
Still unable to get this working and struggling to find any decent documentation to help out.

Here's what I have tried. All as sudo

#remove all the old drivers
./sundtek_netinst.sh -u
wget http://www.sundtek.de/media/sundtek_installer_180626.045108.sh
./sundtek_installer_180626.045108.sh
unpacking...
checking system... testing libc OK 2.27.0
64Bit System detected
installing (local mode) ...
installing remote control support
finalizing configuration... (can take a few seconds) 
Starting driver...
This system is using systemctl for starting the driver...
done.

#remove the dodgy preload
rm /etc/ld.so.preload

Then I modify the service to isolate the dodgy preload
me@ubuntu:~/sundtek$ service sundtek status
● sundtek.service - Sundtek MediaTV
   Loaded: loaded (/lib/systemd/system/sundtek.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2018-12-17 05:07:25 GMT; 11min ago
  Process: 8255 ExecStop=/opt/bin/mediaclient --shutdown (code=exited, status=0/SUCCESS)
  Process: 8267 ExecStart=/opt/bin/mediaclient --start=4 (code=exited, status=0/SUCCESS)
  Process: 8261 ExecStartPre=/bin/bash -c export LD_PRELOAD=/opt/lib/libmediaclient.so (code=exited, status=0/SUCCESS)
 Main PID: 8267 (code=exited, status=0/SUCCESS)
    Tasks: 19 (limit: 4915)
   CGroup: /system.slice/sundtek.service
           ├─8296 /opt/bin/rtspd --daemon
           ├─8297 /opt/bin/mediasrv -d --pluginpath=/opt/bin
           └─8301 /opt/bin/mediasrv -d --pluginpath=/opt/bin

Dec 17 05:07:25 ubuntu systemd[1]: Starting Sundtek MediaTV...
Dec 17 05:07:25 ubuntu systemd[1]: Started Sundtek MediaTV.

Permissions on /dev/dvb are not what I am expecting
me@ubuntu:~/sundtek$ ls -la /dev/dvb/adapter0
total 0
drwxrwxrwx 2 root root    100 Dec 17 05:07 .
drwxrwxrwx 3 root root     60 Dec 17 05:07 ..
crwxrwxrwx 1 root root 212, 1 Dec 17 05:07 demux0
crwxrwxrwx 1 root root 212, 2 Dec 17 05:07 dvr0
crwxrwxrwx 1 root root 212, 0 Dec 17 05:07 frontend0

scan fails
me@ubuntu:~/sundtek$ sudo scan /usr/share/dvb/dvb-t/uk-CrystalPalace
scanning /usr/share/dvb/dvb-t/uk-CrystalPalace
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
main:2745: FATAL: failed to open '/dev/dvb/adapter0/frontend0': 6 No such device or address

Mod info if that helps
me@ubuntu:~/sundtek$ modinfo dvb-usb
filename:       /lib/modules/4.15.0-42-generic/kernel/drivers/media/usb/dvb-usb/dvb-usb.ko
license:        GPL
description:    A library module containing commonly used USB and DVB function USB DVB devices
author:         Patrick Boettcher <patrick.boettcher@posteo.de>
version:        1.0
srcversion:     E5E4BE0514FD701C49D3E36
depends:        rc-core,dvb-core
retpoline:      Y
intree:         Y
name:           dvb_usb
vermagic:       4.15.0-42-generic SMP mod_unload
signat:         PKCS#7
signer:         
sig_key:       
sig_hashalgo:   md4
parm:           debug:set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64,mem=128,uxfer=256  (or-able)). (debugging is not enabled) (int)
parm:           disable_rc_polling:disable remote control polling (default: 0). (int)
parm:           force_pid_filter_usage:force all dvb-usb-devices to use a PID filter, if any (default: 0). (int)

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #7 am: Dezember 17, 2018, 09:26:48 Vormittag »
Zitat
me@ubuntu:~/sundtek$ LD_PRELOAD=/opt/lib/libmediaclient.so scan /usr/share/dvb/dvb-t/uk-CrystalPalace

no sudo required for the scan.


./sundtek_netinst.sh -service only installs the driver without using the PRELOAD mechanism.

No kernelmodules are required for our tuners.
Failure is a good thing! I'll fix it

tvrulesme

  • Newbie
  • *
  • Beiträge: 6
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #8 am: Dezember 17, 2018, 10:28:48 Vormittag »
Still something wrong I'm afraid

sme@ubuntu:~/sundtek$ ls -la /dev/dvb/adapter0/
total 0
drwxrwxrwx 2 root root    100 Dec 17 08:21 .
drwxrwxrwx 3 root root     60 Dec 17 08:21 ..
crwxrwxrwx 1 root root 212, 1 Dec 17 08:21 demux0
crwxrwxrwx 1 root root 212, 2 Dec 17 08:21 dvr0
crwxrwxrwx 1 root root 212, 0 Dec 17 08:21 frontend0
me@ubuntu:~/sundtek$ /opt/bin/mediaclient --setdtvmode=DVBT
Using device: /dev/dvb/adapter0/frontend0
Setting Frontend Properties to: DVBT
Done.
me@ubuntu:~/sundtek$ LD_PRELOAD=/opt/lib/libmediaclient.so scan /usr/share/dvb/dvb-t/uk-CrystalPalace
scanning /usr/share/dvb/dvb-t/uk-CrystalPalace
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
ERROR: cannot parse'[C23 BBC A]
'
ERROR: cannot parse' DELIVERY_SYSTEM = DVBT
'
ERROR: cannot parse' FREQUENCY = 490000000
'
ERROR: cannot parse' BANDWIDTH_HZ = 8000000
'
ERROR: cannot parse' CODE_RATE_HP = 2/3
'
ERROR: cannot parse' CODE_RATE_LP = NONE
'
ERROR: cannot parse' MODULATION = QAM/64
'
ERROR: cannot parse' TRANSMISSION_MODE = 8K
'
ERROR: cannot parse' GUARD_INTERVAL = 1/32
'
ERROR: cannot parse' HIERARCHY = NONE
'
ERROR: cannot parse' INVERSION = AUTO
'
ERROR: cannot parse'[C26 D3&4]
'
ERROR: cannot parse' DELIVERY_SYSTEM = DVBT
'
ERROR: cannot parse' FREQUENCY = 514000000
'
ERROR: cannot parse' BANDWIDTH_HZ = 8000000
'
ERROR: cannot parse' CODE_RATE_HP = 2/3
'
ERROR: cannot parse' CODE_RATE_LP = NONE
'
ERROR: cannot parse' MODULATION = QAM/64
'
ERROR: cannot parse' TRANSMISSION_MODE = 8K
'
ERROR: cannot parse' GUARD_INTERVAL = 1/32
'
ERROR: cannot parse' HIERARCHY = NONE
'
ERROR: cannot parse' INVERSION = AUTO
'
ERROR: cannot parse'[C33 COM7 HD]
'
ERROR: cannot parse' DELIVERY_SYSTEM = DVBT2
'
ERROR: cannot parse' FREQUENCY = 570000000
'
ERROR: cannot parse' BANDWIDTH_HZ = 8000000
'
ERROR: cannot parse' CODE_RATE_HP = 2/3
'
ERROR: cannot parse' CODE_RATE_LP = NONE
'
ERROR: cannot parse' MODULATION = QAM/256
'
ERROR: cannot parse' TRANSMISSION_MODE = 32K
'
ERROR: cannot parse' GUARD_INTERVAL = 1/128
'
ERROR: cannot parse' HIERARCHY = NONE
'
ERROR: cannot parse' STREAM_ID = 0
'
ERROR: cannot parse' INVERSION = AUTO
'
ERROR: cannot parse'[C25 SDN]
'
ERROR: cannot parse' DELIVERY_SYSTEM = DVBT
'
ERROR: cannot parse' FREQUENCY = 506000000
'
ERROR: cannot parse' BANDWIDTH_HZ = 8000000
'
ERROR: cannot parse' CODE_RATE_HP = 3/4
'
ERROR: cannot parse' CODE_RATE_LP = NONE
'
ERROR: cannot parse' MODULATION = QAM/64
'
ERROR: cannot parse' TRANSMISSION_MODE = 8K
'
ERROR: cannot parse' GUARD_INTERVAL = 1/32
'
ERROR: cannot parse' HIERARCHY = NONE
'
ERROR: cannot parse' INVERSION = AUTO
'
ERROR: cannot parse'[C22 ARQ A]
'
ERROR: cannot parse' DELIVERY_SYSTEM = DVBT
'
ERROR: cannot parse' FREQUENCY = 482000000
'
ERROR: cannot parse' BANDWIDTH_HZ = 8000000
'
ERROR: cannot parse' CODE_RATE_HP = 3/4
'
ERROR: cannot parse' CODE_RATE_LP = NONE
'
ERROR: cannot parse' MODULATION = QAM/64
'
ERROR: cannot parse' TRANSMISSION_MODE = 8K
'
ERROR: cannot parse' GUARD_INTERVAL = 1/32
'
ERROR: cannot parse' HIERARCHY = NONE
'
ERROR: cannot parse' INVERSION = AUTO
'
ERROR: cannot parse'[C28- ARQ B]
'
ERROR: cannot parse' DELIVERY_SYSTEM = DVBT
'
ERROR: cannot parse' FREQUENCY = 529833000
'
ERROR: cannot parse' BANDWIDTH_HZ = 8000000
'
ERROR: cannot parse' CODE_RATE_HP = 3/4
'
ERROR: cannot parse' CODE_RATE_LP = NONE
'
ERROR: cannot parse' MODULATION = QAM/64
'
ERROR: cannot parse' TRANSMISSION_MODE = 8K
'
ERROR: cannot parse' GUARD_INTERVAL = 1/32
'
ERROR: cannot parse' HIERARCHY = NONE
'
ERROR: cannot parse' INVERSION = AUTO
'
ERROR: cannot parse'[C30- BBC B HD]
'
ERROR: cannot parse' DELIVERY_SYSTEM = DVBT2
'
ERROR: cannot parse' FREQUENCY = 545833000
'
ERROR: cannot parse' BANDWIDTH_HZ = 8000000
'
ERROR: cannot parse' CODE_RATE_HP = 2/3
'
ERROR: cannot parse' CODE_RATE_LP = NONE
'
ERROR: cannot parse' MODULATION = QAM/256
'
ERROR: cannot parse' TRANSMISSION_MODE = 32K
'
ERROR: cannot parse' GUARD_INTERVAL = 1/128
'
ERROR: cannot parse' HIERARCHY = NONE
'
ERROR: cannot parse' STREAM_ID = 0
'
ERROR: cannot parse' INVERSION = AUTO
'
ERROR: initial tuning failed
dumping lists (0 services)
Done.

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #9 am: Dezember 17, 2018, 02:04:02 Nachmittag »
I guess you have to adjust the antenna it might have received some incomplete data and the scantool was unable to parse it, for DVB-T/T2 it's very important that you get the right direction to the TV tower.

I'm also in the chat room in case you would like to receive answers quicker.

https://support.sundtek.de/chat.php
Failure is a good thing! I'll fix it

tvrulesme

  • Newbie
  • *
  • Beiträge: 6
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #10 am: Dezember 17, 2018, 06:46:01 Nachmittag »
No unfortunately my xbox tuner is working fine with the same Ariel.

One really weird thing which makes me think it's a permissions issue is that I can see the adapter in TVheadend but when I select a Network and Network type it disappears until I restart Sundtek service. Here's the error log from Tvheadend
2018-12-17 16:36:23.611 [  DEBUG]:satip: SAT>IP DVB-T Tuner #2 (172.17.0.1@UDP) - stopped control thread
2018-12-17 16:36:24.556 [  ERROR]:http: 192.168.0.82: HTTP/1.1 POST (3) /api/mpegts/input/network_list -- 400

Clearly this is not the same for the Xbox tuner which works fine.

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #11 am: Dezember 17, 2018, 07:28:06 Nachmittag »
I'm not really sure what you're trying to do, our tuner has its flexibility and might have to be used differently than you are used to.

Best is to check the chat.

The tuner works just perfectly with tvheadend and there are no issues with it.
Failure is a good thing! I'll fix it

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re: /etc/ld.so.preload conflicts on ubuntu
« Antwort #12 am: Dezember 18, 2018, 06:15:26 Nachmittag »
Ok the problem was that you were using our SAT>IP implementation it's still under development.

other than that, your tvheadend version had some bug in the configuration file (which caused some weird issue with tvheadend itself (even without any tuner)).
Failure is a good thing! I'll fix it