8

I have a dvb card on my Ubuntu system and write a bash file that show dvb tuner in gnome-terminal and put the bash file in start up to run the script when user login to system as below:

#!/bin/bash

# Bash script to show list of bvb tuner

gnome-terminal --title="list of bvb tuners" -x bash -c "lsdvb; read line" &

gnome-terminal --title="Tuner 4:" -x bash -c "dvblast -a 4 -f 12596000 -s 27500000 -v 13 -c Tuner4.cfg -i 1 ; read line" &

lsdvb a command from dvb-app repository that show list of dvb tuner in Linux and dvblast is a program for broadcast live TV.

Everything work fine when I have 1 dvb card on server... When I add second dvb card to server and restart system the bash file start but see below error for run dvblast:

For dvblast

And this for lsdvb:

For lsdvb

And if login in gnome-terminal with sudo -s and manually run the bash file its work fine.

When remove second card the bash file work fine on start up.

I put strace in command line and see this log for lsdvb:

open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3

        lsdvb: Simple utility to list PCI/PCIe DVB devices
        Version: 0.0.4
        Copyright (C) Manu Abraham
+++ exited with 0 +++

and this log for dvblast:

open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
DVBlast 2.2 (release)
warning: restarting
open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
open("/usr/lib/x86_64-linux-gnu/gconv/ISO8859-1.so", O_RDONLY|O_CLOEXEC) = 3
debug: using linux-dvb API version 5
open("/dev/dvb/adapter3/frontend0", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such file or directory)
error: opening device /dev/dvb/adapter3/frontend0 failed (No such file or directory)
+++ exited with 1 +++

Could anyone know whats happened when the second card add to server that the bash file need special permission?

Ali
  • 3,373
  • 5
  • 42
  • 54
  • Tried executing it manually with 2 dvb cards ? – zeekhuge Jul 01 '17 at 12:16
  • i edit the question...when run manually the bash file work fine – Ali Jul 01 '17 at 13:15
  • Does it say "Permission denied" and nothing else or is there more information on that line? – Willis Blackburn Jul 01 '17 at 13:28
  • @WillisBlackburn I explain and add more about error in question – Ali Jul 01 '17 at 13:56
  • Check your boot logs (run dmesg to see the kernel ring) and grep for message relating to dvb. Also run udevadm to get a greater indication of issues with the dvb cards. Seems like a timing issue but hopefully the kernel messages will show greater detail. – Raman Sailopal Jul 01 '17 at 20:20
  • Something is running at boot time that is creating /dev entries for the DVB cards you have installed in your system. When it creates the entries in /dev for the second card, it's setting permissions differently from the permissions that the first card has, leaving you unable to access the device. Check the permissions of the file given (/dev/dvb/adapter3/...) and compare to the other entries in /dev/dvb. How long has the first card been in the computer? Maybe its /dev entries were configured by an earlier version of the OS? – Willis Blackburn Jul 02 '17 at 13:44
  • @WillisBlackburn it dont refer to setting permissions for second card because if it refer to that, the first card must work fine but the second card show permissions error. **and** other things is when remove first card the second card work fine...I use ESX and install ubuntu on that.. are you think it refer to that? – Ali Jul 02 '17 at 15:05
  • @combo_ci what are the permissions for the two entries? Are they different? Could it be that a udev rule is handling one card and not the other (udev is the tool of choice lately for setting permissions and the names of devices, etc.)? – John Szakmeister Jul 19 '17 at 00:18
  • Really l dont set permition for each one of card...and as l say _And if login in gnome-terminal with sudo -s and manually run the bash file its work fine._...i think there is no diffrent betwean permition of 2 entries as one of them work without another one...when the bash file is work fine when i login to terminal with sudo -s, i think the bach file not succesfull if authorize Sudo command in boot time..are you agree? – Ali Jul 19 '17 at 04:28
  • @WillisBlackburn I add `strace` log to question, could you please see that? – Ali Aug 02 '17 at 09:41

1 Answers1

2

You may add i.e. strace in front of the command and redirect an output to a file to see what exactly happens. You might also set auditd to monitor /dev/dvb/adapter3/frontend0, so will see the details in /var/log/messages.

auditctl -w /dev/dvb/adapter3/frontend0
gbajson
  • 1,531
  • 13
  • 32