Linux

USB-Serial Port adapter on linux

First type “lsusb”. You will see a list of output similar to this.

Bus 003 Device 001: ID 0000:0000
Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard
Bus 002 Device 006: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical Mouse H3003
Bus 002 Device 004: ID 15d9:0a33

Next plug in the USB-Serial Port adapter to one of your USB ports. Wait for a couple of second, then type “dmesg”. You should see these message at the end of dmesg output.

usb 1-1: new full speed USB device using uhci_and address 2
usb 1-1: configuration #1 chosen from 1 choice

Now run “lsusb” again, and you shall see an additional line, like this.

Bus 003 Device 001: ID 0000:0000
Bus 002 Device 007: ID 03f0:4f11 Hewlett-Packard
Bus 001 Device 002: ID 4348:5523 — — — (notice the additional line!)
Bus 002 Device 006: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical Mouse H3003
Bus 002 Device 004: ID 15d9:0a33

Now we know the vendor id and the product id of the USB-Serial Port converter, this will enable us to load the linux kernel module “usbserial” to activate the device, like this :

sudo modprobe usbserial vendor=0×4348 product=0×5523

Run “dmesg” again and you shall see lines similar like this :

usbserial_generic 1-1:1.0: generic converter detected
usb 1-1: generic converter now attached to ttyUSB0
usbcore: registered new interface driver usbserial_generic

As you can see, the new serial port device is mapped to /dev/ttyUSB0. You can instruct Ubuntu to load this module automatically by include the line : “usbserial vendor=0×4348 product=0×5523″ inside “/etc/modules” file.

When I plugged the usb adapter I bought into my hardy box it automatically configured the port for me.  I didn’t have to do anything to get it working.

Instructions found at http://blog.mypapit.net/2008/05/how-to-use-usb-serial-port-converter-in-ubuntu.html

Wednesday, November 12th, 2008 Linux No Comments

Finally moved the masterbackend to the new case

Today I finally had some time to move all of the hardware for my masterbackend to the new antec case I had bought awhile ago.  I thought I had lost the new 500 gig drive I just bought also.  Not sure what happened to it but everything is working fine now.  Got the replacement samsung drive this past Friday also.  In the new case I have 6 sata drives now.  1.5 TB  of space for recordings with about 1 TB free right now.  Need to think about the backup disk solution now.  It is almost full due to the Olympics.  Need to think about the configuration of that drive now.

The new case is much much quieter and also has so much more airflow.  I wonder if the other drives were getting a little hot due to how that old case was setup.  I have 3 120mm fans in the new case and 1 140mm fan.  Plenty of air movement.

If this change has no problems the next change will be to put the faster processor in this box.  If that goes smooth then I will plan on building the box with a fresh ubuntu amd64 build to take full advantage of the 4 gigs of memory.

Sunday, August 17th, 2008 Linux No Comments

Setting up Virtualbox on ubuntu

This is written for Ubuntu hardy 8.04 and virtualbox 1.6.2

  • Download the deb package from virtualbox/sun.  Or install with apt

deb http://download.virtualbox.org/virtualbox/debian hardy non-free
wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -

  • Install the package: dpkg -i package name, or apt-get install virtualbox-2.0 bridge-utils uml-utilities
  • create any machines you want and make any customizations you would like.
  • add a few lines to rc.local

# change permissions for vbox

chmod 0666 /dev/net/tun

  • add the following to /etc/network/interfaces “that will get you 2 tap devices, enough for two machines”

auto tap1 tap2
iface tap1 inet manual
tunctl_user desktop
iface tap2 inet manual
tunctl_user desktop
auto br0
iface br0 inet dhcp
bridge_ports eth0 tap1 tap2
bridge_maxwait 0

  • create /etc/vbox
  • nano /etc/vbox/machines_enabled
  • put a list of all virtual machines you want started and stopped at boot and shutdown/reboot
  • nano /etc/init.d/virtualbox

contents of above file

#! /bin/sh
### BEGIN INIT INFO
# Provides: virtualbox_vms
# Required-Start:    $local_fs $syslog $remote_fs
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: Control VirtualBox Virtual Machine instances
### END INIT INFO
#
# Version 20080531-0 AR
#
################################################################################
# INITIAL CONFIGURATION
VBOXDIR="/etc/vbox"
RUNAS_USER=desktop
SU="su $RUNAS_USER -c"
VBoxMDAEMON="VBoxManage"
VBoxSDAEMON="VBoxHeadless"

. /lib/lsb/init-functions

# Are we running from init?
run_by_init() {
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
}

################################################################################
# RUN
case "$1" in
start)
cat $VBOXDIR/machines_enabled | while read VM; do
log_action_msg "Starting VM: $VM ..."
#                su $RUNAS_USER -c "$VBoxSDAEMON startvm \"$VM\" -type vrdp &"
su $RUNAS_USER -c "$VBoxSDAEMON --startvm \"$VM\" &"
done
;;
stop)
# NOTE: this stops all running VM's. Not just the ones listed in the
# config
cat $VBOXDIR/machines_enabled | while read VM; do
log_action_msg "Shutting down VM: $VM ..."
su $RUNAS_USER -c "$VBoxMDAEMON controlvm \"$VM\" savestate"
done
;;
start-vm)
log_action_msg "Starting VM: $2 ..."
su $RUNAS_USER -c "$VBoxSDAEMON --startvm \"$2\" > /dev/null 2 >&1"
;;
stop-vm)
log_action_msg "Stopping VM: $2 ..."
su $RUNAS_USER -c "$VBoxMDAEMON controlvm \"$2\" savestate"
;;
poweroff-vm)
log_action_msg "Powering off VM: $2 ..."
$VBoxMDAEMON "controlvm \"$2\" poweroff"
;;
status)
log_action_msg "The following virtual machines are currently running:"
echo "Still thinking about what to do here."
#$VBoxMDAEMON "list runningvms" | while read VM; do
#echo -n "$VM ("
# not yet figured this out
#echo -n `"$VBoxMDAEMON showvminfo $VM|grep Name:|sed -e 's/^Name:\s*//g'"`
#echo ')'
#done
;;
*)
log_failure_msg "Usage: $0 {start|stop|status|start-vm <VM name>|stop-vm <VM name>|poweroff-vm"
exit 3
esac
exit 0
  • chmod 755 /etc/init.d/virtualbox
  • update-rc.d virtualbox defaults
  • one last adjustment to make sure there is enough time between the vboxdrv and vboxnet starting and virtualbox: mv /etc/rc2.d/S20virtualbox /etc/rc2/d/S99virtualbox
  • That should be it. Now when you shutdown the virtualmachines should be saved and when you boot the virtualmachines should start up.

Init script created by a great co-worker of mine. Could not have done this without his help. It works great, think I like this setup better than vmware.

Friday, June 6th, 2008 Linux No Comments

How to get a lava pci serial card working in ubuntu hardy

apt-get install setserial

When you run a lspci -v it will list your lava card and it should look something like this:

Serial controller: Lava Computer mfg Inc Unknown device 0900 (prog-if 02 [16550])
Flags: slow devsel, IRQ 16
I/O ports at 9800 [size=256]
I/O ports at 9400 [size=256]
From this info you can create a command with setserial.  For me the command I run is below

setserial /dev/ttyS0 port 0×9800 irq 16 uart 16550a baud_base 115200

If that works you can now just create a file:

/etc/serial.conf

/dev/ttyS0 port 0×9800 irq 16 uart 16550a baud_base 115200

Is the only thing in the file.   You should be up and running. That is all I had to do.

Friday, May 30th, 2008 Linux No Comments

Building a mythfrontend box on hardy from scratch

start os install ( I use the hardy i386 alternate cd)

during install routine I create a default user and we will call it desktop.

make desktop user login automatically

install nvidia restricted driver

apt-get install openssh-server portmap nfs-common xfsprogs lm-sensors snmpd smartmontools mutt postfix ssh dstat iptraf subversion checkinstall apache2 php5 qt3-dev-tools libdts-dev libfreetype6-dev lame apcupsd apcupsd-cgi logwatch dselect openbox phpmyadmin lirc mailx sysv-rc-conf mysql-client libqt3-mt-mysql

nano /etc/fstab

192.168.1.210:/offline /offline nfs soft,intr,rsize=32768,wsize=32768,async,nfsvers=3,bg,actimeo=0,tcp
192.168.1.210:/dvr /dvr nfs soft,intr,rsize=32768,wsize=32768,async,nfsvers=3,bg,actimeo=0,tcp
mkdir /dvrmkdir /offline

mount -a

cp /offline/archive/mbox/etc/apt/sources.list /etc/apt

apt-get clean

apt-get update

apt-get upgrade

apt-get build-dep mythtv

apt-get install libmad0 libmad0-dev flac libflac-dev libcdaudio-dev libtag1-dev libcdparanoia0-dev xine-ui libxine1-ffmpeg mplayer

download nx debs

sudo dpkg -i nxclient_3.0.0-89_i386.deb
sudo dpkg -i nxnode_3.0.0-93_i386.deb
sudo dpkg -i nxserver_3.0.0-79_i386.deb

RSYNC
cp /offline/files/rsync/rsyncd.conf /etc
cp /offline/files/rsync/rsyncd.secrets /etc
nano /etc/default/rsync and enable
chmod 600 /etc/rsyncd.secrets

/etc/init.d/rsync restart

SNMP

cp /offline/archive/m1box/snmpd.conf /etc/snmp

nano /etc/default/snmpd remove 127.0.0.1 our of config line

/etc/init.d/snmpd restart
SMARTD

cp /offline/archive/m1box/smartd.conf /etc/smartd.conf
nano /etc/default/smartmontools
start_smartd=yes
/etc/init.d/smartmontools restart

WEBMIN

apt-get install libauthen-pam-perl libio-pty-perl libmd5-perl libnet-ssleay-perl
dpkg -i webmin_1.390_all.deb

apt-get update

apt-get upgrade

Wake on lan if supported

echo 'ethtool -s eth0 wol g' >> /etc/rc.local

APCUPSD
cp /offline/archive/m1box/apcupsd/apcupsd.conf /etc/apcupsd
nano /etc/default/apcupsd and make isconfigured=yes
/etc/init.d/apcupsd restart

Customize desktop for mythtv

nano /usr/share/xsessions/mythtv.desktop
[Desktop Entry]
Encoding=UTF-8
Name=MythTV
Comment=Use this session to run MythTV
Exec=/usr/local/bin/mythtv.sh
Icon=
Type=Application

nano /usr/local/bin/mythtv.sh
mythfrontend&
killall irexec
irexec -d
nvidia-settings -l
mtd -d

exec openbox

chmod +x /usr/local/bin/mythtv.sh

LIRC

cp /dvr/files/lircrc /home/desktop/.mythtv
ln -s /home/desktop/.mythtv/lircrc /home/desktop/.lircrc

To get basic things setup for myth I just do a apt-get install mythtv. Then go and uninstall all mythtv packages(that is if you want to build your own packages, just let it be if you are going to use the packages)

Otherwise a few steps you will have to take to get things working like the Backend at reboot and what not.

cp /dvr/scripts/mythtv-backend /etc/init.d

cp /dvr/scripts/mythtv-backend.default /etc/default/mythtv-backend

update-rc.d mythtv-backend defaults

mkdir /var/log/mythtv

make sure /root/.mythtv/mysql.txt is created and correct

/etc/init.d/mythtv-backend start

Install medibuntu stuff

sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update

Tuesday, May 27th, 2008 Linux, Mythtv 1 Comment

Nagios2 Ubuntu

This always gets me.  The nagios2 package for ubuntu (hardy and many others) is broken.  If you want to submit any commands from the web interface do the following.

/etc/nagios2#/etc/init.d/nagios2 stop
/etc/nagios2# dpkg-statoverride –update –add nagios www-data 2710 /var/lib/nagios2/rw
/etc/nagios2# dpkg-statoverride –update –add nagios nagios 751 /var/lib/nagios2
/etc/nagios2# /etc/init.d/nagios2 start

Thursday, May 22nd, 2008 Linux No Comments

pxe boot with ubuntu and dd-wrt

What I am using in my environment.

Ubuntu Gutsy as atftpd server

DD-WRT on a linksys wrt54g as dhcp server

First go to the services tab. Under “Additional DNSMasq Options” add “dhcp-boot=pxelinux.0,m5box,192.168.1.215″ where m5box is the name of the tftp server and 192.168.1.215 is the ip of the tftpserver

apt-get install atftpd tftp atftp

sed -e '/USE_INETD=/s/true/false/' -i /etc/default/atftpd
/etc/init.d/atftpd restart
mkdir /tftpboot
cd /tftpboot
wget http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/netboot/netboot.tar.gz
tar zxf netboot.tar.gz
chown -R nobody: .
You should now be able to pxe boot to ubuntu 7.10 and install a system.

Next task is to pxe/nfs diskless boot a mythfrontend box.

Thursday, March 13th, 2008 Linux 2 Comments

How to setup your own ubuntu mirror using apt-mirror

apt-get install apt-mirror apache2

apt-mirror’s configuration file is /etc/apt/mirror.list. There should already be a default configuration in it

Make changes you would like to have.

If you used the defaults you should be all set. If you moved where you want the files stored make sure you create the correct file structure and it has the correct permissions.

When you are ready and have the time just run the following command.

su - apt-mirror -c apt-mirror

Depending on what changes you made to the mirror.list this may take a very long time. I let it go over night the first time I ran it.

Once it is all finished, if you want to point to this mirror from other boxes on your network then you will have to publish the new files via apache2. Example of mythbuntu truck repo below.

ln -s /jn/apt-mirror/mirror/weeklybuilds.mythbuntu.org/mythbuntu-trunk/ /var/www/mythbuntu-trunk

This line setups a symbolic link in apache2 to the new area created with apt-mirror.

Now just go to the source.list file on all of your boxes and point them to the new mirror instead of the official mirror it currently points to.

My current mirror.list:

############# config ##################
#
# set base_path    /var/spool/apt-mirror
set base_path    /jn/apt-mirror
#
# if you change the base path you must create the directories below with write privlages
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  x86
set nthreads     20
set tilde 0
#
############# end config ##############

#deb http://us.archive.ubuntu.com/ubuntu gutsy main restricted universe multiverse
deb http://mirror.cs.umn.edu/ubuntu gutsy main restricted universe multiverse
deb-amd64 http://mirror.cs.umn.edu/ubuntu gutsy main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse
deb http://mirror.cs.umn.edu/ubuntu gutsy-updates main restricted universe multiverse
deb-amd64 http://mirror.cs.umn.edu/ubuntu gutsy-updates main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse
deb http://mirror.cs.umn.edu/ubuntu gutsy-backports main restricted universe multiverse
deb-amd64 http://mirror.cs.umn.edu/ubuntu gutsy-backports main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse
deb http://mirror.cs.umn.edu/ubuntu gutsy-security main restricted universe multiverse
deb-amd64 http://mirror.cs.umn.edu/ubuntu gutsy-security main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu gutsy-proposed main restricted universe multiverse
deb http://mirror.cs.umn.edu/ubuntu gutsy-proposed main restricted universe multiverse
deb-amd64 http://mirror.cs.umn.edu/ubuntu gutsy-proposed main restricted universe multiverse

#deb-src http://archive.ubuntu.com/ubuntu gutsy main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu gutsy-proposed main restricted universe multiverse

#deb http://weeklybuilds.mythbuntu.org/mythbuntu-trunk/ubuntu gutsy multiverse universe restricted main
#deb-amd64 http://weeklybuilds.mythbuntu.org/mythbuntu-trunk/ubuntu gutsy multiverse universe restricted main

#deb http://mirror.cs.umn.edu/ubuntu hardy main restricted universe multiverse
#deb-amd64 http://mirror.cs.umn.edu/ubuntu hardy main restricted universe multiverse

clean http://mirror.cs.umn.edu/ubuntu
#clean http://weeklybuilds.mythbuntu.org/mythbuntu-trunk/ubuntu

Tuesday, March 11th, 2008 Linux No Comments

Both myth frontends support wakeonlan

It was nice to get wakeonlan working on both frontend boxes.  I want to test the backend sometime also.  My next step will be to get my frontends to shutdown when not in use and power up when we want to use them.  Still thinking about how I am going to do this.

Tuesday, February 19th, 2008 Linux No Comments

Howto setup wakeonlan

Based off of wiki entry at http://www.mythtv.org/wiki/index.php/Wake-on-LAN

First, find out whether your network card supports wol:

# ethtool eth0
Settings for eth0:
       Supported ports: [ TP MII ]
       Supported link modes:   10baseT/Half 10baseT/Full
                               100baseT/Half 100baseT/Full
       Supports auto-negotiation: Yes
       Advertised link modes:  10baseT/Half 10baseT/Full
                               100baseT/Half 100baseT/Full
       Advertised auto-negotiation: Yes
       Speed: 100Mb/s
       Duplex: Full
       Port: MII
       PHYAD: 1
       Transceiver: internal
       Auto-negotiation: on
       Supports Wake-on: pumbg
       Wake-on: g
       Current message level: 0x00000001 (1)
       Link detected: yes

The ‘g’ in Supports Wake-on: pumbg indicates that wake-on-lan by using a ‘magic packet’ is indeed supported. Next, you need to make sure that wake-on-lan support is enabled in the BIOS (although, this does not seem to be necessary for my motherboard). In addition, you need to tell your network card to enable wake-on-lan:

# ethtool -s eth0 wol g

Since after rebooting Wake-on will be reset, you might what to add it to /etc/rc.local:

# echo 'ethtool -s eth0 wol g' >> /etc/rc.local
Make sure this line is before the line that has exit 0

Now turn off you mythbox and send it a ‘magic packet’.

Send the ‘Macic Packet’
You will need a wake-on-lan client to send ‘magic packets’ over your network. First, determine the MAC address of the machine you what to power on:

# ifconfig

Turn off your mythbox and from another computer execute the following command (replacing the MAC address with the one you just found). I used a wake-on-lan client from Sourceforge.

$ wol 00:4F:49:07:0B:5F

If all went well, your mythbox will boot up now!

Tuesday, February 19th, 2008 Linux No Comments

Search

 

Archives

Categories

On this day...

No posts on this day.