1

I have a virtual machine in EXSI 6.5 and install Ubuntu on that. I write a bash file to run a command in start up as bellow:

#!/bin/bash

# Bash script to dvblast

sleep 10

gnome-terminal --title="foo" -x bash -c \
"printf '\e[8;13;90t'&&dvblast -a 3 -f 12596000 -s 27500000 -v 13 -c Tuner4.cfg -i 1; read line" &

Its run DVBLast in start up with first 10 second sleep. This bash file work fine.

But when I export ovf template from this VM and deploy again to Esxi and start vm, the bash file failed to run by Permission denied. this is output window image:

output

When I run the command with strace see this log:

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 +++

If I run terminal and run sudo -s and then run the bash file its work fine.

Anybody know how I solve this problem? Thanks in advance

Ali
  • 93
  • 12
  • Probably a bad idea because of security implications but what about disabling password prompt of sudo command using NOPASSWD in /etc/sudoers and then adding sudo infront of the dvblast command in your script? – ArtiZirk Aug 02 '17 at 12:44
  • i do that for bash file and bash file run without password request but still have problem, how to do that for dvblast? – Ali Aug 02 '17 at 13:02
  • You run your script as `root` (using `sudo`) after which your script works when running it with non-root user too? What hardware are you using? Can you provide the output of `lsmod` for before (script failing) and after (script working)? – sebasth Aug 06 '17 at 16:07
  • It looks like the device is not ready yet when the script is run. – simlev Aug 07 '17 at 07:55

1 Answers1

1

As simlev has pointed out the error is actually about the problem reaching the DVB device. When exporting the OVF and importing again on another host the configuration of VM might have omitted the DVB tuner, or it could simply be non-existant on the other machine. Check the configuration of the copied Virtual Machine and make sure that the DVB device is passed through exactly as in the source Virtual Machine.

Then log in to the cloned VM, and check if the udev rules did not reserve the name of the DVB device from the first esxi, or the tuner on the new VM has another device address like /dev/dvb/adapter4/frontend0 instead of /dev/dvb/adapter3/frontend0, or perhaps the frontend must be altered (not the same INPUT on the tuner for example, or a different make/model of hardware)

I believe it is the problem in addressing the device rather than anything related to BASH itself.

bocian85
  • 411
  • 3
  • 3
  • when i want to export OVF i must deattached the dvb cart because that is a PCI device...then add the DVB cart when deploy to host, then it should not refer to EXIST the card on vm or not – Ali Aug 09 '17 at 09:13
  • about addressing of device i test with adapter 3 and still have that problem...i confused on this problem :/ – Ali Aug 09 '17 at 09:14
  • 1
    The udev.rules reserve names like eth0 etc using for example PCI addresses/ MAC addresses, so even removing the device will not remove the binding. This mechanism makes sure that after you reattach the device later it will get the same designation as before. If I were you I would log into the new VM and do ls -la /dev/dvb/* and check what appears there, then try manually to run the dvblast. I believe the problem is originating from PCI device having different designation in linux. – bocian85 Aug 09 '17 at 09:16
  • you mean that if i install Ubuntu again, the command might be work correctly? – Ali Aug 09 '17 at 09:19
  • No, when you run the cloned VM you can log into it, right ? just do the `ls -la /dev/dvb/*` and post the results You can also paste the `lspci` command result – bocian85 Aug 09 '17 at 09:19