Monday, July 9, 2012

Permission Denied when excuting a script on OpenMediaVault

Couldn't execute my AV scan script for my downloaded files:

root@omv:/media/data/usenet/scripts# ./av_scan.sh
-bash: ./av_scan.sh: Permission denied
root@omv:/media/data/usenet/scripts# ls -lah av_scan.sh
-rwxr-xr-x 1 root root 71 Jul  9 23:20 av_scan.sh

Fought with it for a couple of hours on and off before I realised what might be going on:

 # mount
<snip>
/dev/mapper/data_vg-data_lv on /media/fa12c9af-de6a-4068-b55f-71d798ee8b6b type xfs (rw,noexec,usrquota,grpquota)


The OpenMediaVault developer made a decision that nothing on the "data" filesystem should be allowed to be executed.  I understand why it might be best for it to be that way, so I relocated the scripts to a directory on another filesystem, and everything works as it should.

Sunday, July 8, 2012

Getting a SYBA Serial card working under Debian Squeeze

I have a SYBA SY-PCI15003 that I used previously to connect to a UPS under FreeBSD 7.3 (FreeNAS).  When I moved that system over to run Debian Linux Squeeze (OpenMediaVault), NUT would not detect my UPS.  I read a bunch of pages, went down a few blind alleys, and eventually just figured it out myself.  So, here's what I did to get the serial port to be usable again:

1) Is the card detected at all, yes it is:

lspci -v

04:05.0 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02 [16550])
    Subsystem: Device a000:1000
    Flags: medium devsel, IRQ 17
    I/O ports at bce8 [size=8]
    Memory at df9fb000 (32-bit, non-prefetchable) [size=4K]
    Memory at df9fc000 (32-bit, non-prefetchable) [size=4K]
    Capabilities: [48] Power Management version 2

04:05.1 Serial controller: Illegal Vendor ID Device 9865 (prog-if 02 [16550])
    Subsystem: Device a000:1000
    Flags: medium devsel, IRQ 18
    I/O ports at bcf0 [size=8]
    Memory at df9fd000 (32-bit, non-prefetchable) [size=4K]
    Memory at df9fe000 (32-bit, non-prefetchable) [size=4K]
    Capabilities: [48] Power Management version 2

04:05.2 Serial controller: Illegal Vendor ID Device 9865 (prog-if 00 [8250])
    Subsystem: Device a000:0000
    Flags: medium devsel, IRQ 19
    I/O ports at bcf8 [size=8]
    I/O ports at <unassigned>
    Memory at df9ff000 (32-bit, non-prefetchable) [size=4K]
    Capabilities: [48] Power Management version 2
    Kernel driver in use: serial

 2) What does the system think IRQ/IO for the device is:

# setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: unknown, Port: 0x03f8, IRQ: 19
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal skip_test

3) Since this configuration doesn't work, let's change it to point to the parent device:

setserial /dev/ttyS0 uart 16550 irq 17 port 0xbce8


The documentation for the device states that the uart is a 16550, and lspci -v gave the IRQ and the I/O port (make sure that you include the 0x before the I/O port).  After the changes its looks like this:

# setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550, Port: 0xbce8, IRQ: 17
    Baud_base: 115200, close_delay: 50, divisor: 0
    closing_wait: 3000
    Flags: spd_normal

4) Test. I already had NUT configured for my UPS, so my testing was as easy as starting up the service and it actually finding the UPS.  There's tons of info about how to test your serial ports, so I won't go into that here.

5) Make configuration persistent.  This will depend on what distribution you're using, for Debian Squeeze, I found the easiest thing to do was use /etc/serial.conf.  Mine didn't exist, but the contents of the file are very simple, its just the arguments to setserial, in my case I could create it thusly:

# echo "/dev/ttyS0 uart 16550 irq 17 port 0xbce8" >> /etc/serial.conf

6) Reboot if you'd like, to make sure it correctly persists.

C'est fini!