Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Permission denied" When run Command On Startup

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?

like image 906
Ali Avatar asked Jul 01 '17 12:07

Ali


1 Answers

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
like image 116
gbajson Avatar answered Nov 07 '22 08:11

gbajson