Archive for the ‘Linux’ Category

How to: Configure Mediatomb/DLNA on Fedora 12 to work with a Samsung TV

I just purchased a Samsung LN46B650 TV and decide to play with the DLNA capiblities of the TV.  The TV come with a CD containing a Windows DLNA server but because I am a geek, I dont have a Windows machine in my house.  I though that since DLNA is a standard that it would be easy to use any DLNA server to host content for my TV.  Well I was partly right.  After reading several forum post I have successfully got everything working on my Fedora 12 netbook.  I will most likely be doing this on a Ubuntu machine at some point at which time I will update this post.

Step 1:
Assuming that you have a working Fedora 12 system that is connected to the same network as your TV make sure that you have port 50500 open or just disable your firewall (your choice).  You can manage this by going to System > Administration > Firewall

Step 2:
Open a terminal and do a yum install mediatomb.

Step 3:
Login as root and using your favorite text editor, open the /etc/mediatomb.conf file and modify the following parameter:

Enter the correct network interface for mediatomb to communicate to. In my case I am using the wireless connection of wlan0

## Network interface on which the server will run, you need to edit this!
MT_INTERFACE="wlan0"

There are other options that you can configure in this file but the network interface is the only on the I had to modify.

Step 4:
As root open a terminal and run mediatomb. This will start the software and configure the sqlite database and setup the default config.xml file that we are going to need to modify. Once the software is running go ahead and hit ctrl-c to exit from the software because we need to modify that config.xml file

Step 5:
With out this step your TV will be able to browse the content but not be able to do anything with it.
Also as root, edit the file /root/.mediatomb/config.xml
Look for the section:

<!–
<custom-http-headers>
<add header=”X-User-Agent: redsonic” />
</custom-http-headers>
<manufacturerURL>redsonic.com</manufacturerURL>
<modelNumber>105</modelNumber>
–>

and change to to this

<custom-http-headers>
<add header=”X-User-Agent: redsonic”/>
<add header=”transferMode.dlna.org: Streaming”/>
<add header=”contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000?/>
</custom-http-headers>
<manufacturerURL>redsonic.com</manufacturerURL>
<modelNumber>105</modelNumber>

Now save the file.

Step 6:
In the terminal windows as root type mediatomb to start the application.

Now you should be able to connect to the Mediatomb webpage and start adding content to share via DLNA. Typically this is on port 49152 or 49153. You will be able to get this infomation from the lastline of output given when you run mediatomb from the command line.

Step 7:
To play videos you may have to re-tag the MIME information to video/mpeg. You can do this in the web interface. Once you have added a video to the database click on the notepad/edit button and change the mimetype to video/mpeg. There is also an option in the config.xml file where you may be able to do this globally for all media. I have not tried this yet and will update this post once I have.

Step 8:
Instead of having to start mediatomb manually each time you reboot there is also a daemon that you can start via /etc/init.d/mediatomb. If you plan on using this in daemon mode you will need to configure it by doing this:
Start the daemon so that it will install the default config files and sqlite database

root#  /etc/init.d/mediatomb start

Then go to /etc/mediatomb/config.xml and make the changes that you made above. Once you have made these changes restart the mediatomb daemon

root# /etc/init.d/mediatomb restart

Now you can go to the web interface and start adding content.

Please let me know if you have any other experiences connecting to your Samsung TV with mediatomb or any other DLNA server. Also please leave a comment if you have found this guide useful or if you see any correction that I need to make.

Also to give credit where it is due here is where I got some of the information above Cnet Forum Post

How to: Get Adobe Air Working in Fedora 12

So you just got Fedora 12 installed on your computer and you need to Tweet about it from Tweetdeck, right?  But wait you are having some issues. You have Adobe Air installed and every time you try to install Tweetdeck you get this error:

Application crashed with an unhandled SIGSEGV
Crashlog has been dumped in /tmp/airCrashLogs/1118_2022_uRpKSj

Here is how to fix it:

linux$ su -
Password:
linux# for c in /etc/opt/Adobe/certificates/crypt/*.0; do aucm -n $(basename $c) -t true; done

Thats it, here is the FedoraForum post where this came from.

How to: Create Windows 7 USB install media from Linux

There are two ways to get the Windows 7 DVD iso to a USB drive for installation, the hard way (also its done via windows only) or there is my way, which is also the easy way. All of these insctruction are assuming that you are doing this from a Linux machine.  Although the tools that we are using are cross platform, I just have never tried it from Windows.

Step 1: Make sure that you have a big enough USB drive, they are cheap and I have been using an 8GB.  Although I 4GB might work.

Step 2: First get a hold of the Windows 7 DVD by any means (purchase, download, steal etc)

Step 3: Format the USB drive with NTFS.  FAT32 might work, I am not sure. Open a linux console and su – to root or in Ubuntu type sudo bash and then the correct password

First we need to determine which drive is your USB drive with dmesg. This will give you lots of data but if you just plugged in you USB device then the last lines is all we need:

linux# dmesg
usb 2-1: new high speed USB device using ehci_hcd and address 6
usb 2-1: New USB device found, idVendor=0951, idProduct=1607
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1: Product: DataTraveler 2.0
usb 2-1: Manufacturer: Kingston
usb 2-1: SerialNumber: 000FEAFB8E96A930C5A90096
usb 2-1: configuration #1 chosen from 1 choice
scsi9 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 6
usb-storage: waiting for device to settle before scanning
usb-storage: device scan complete
scsi 9:0:0:0: Direct-Access     Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 2
sd 9:0:0:0: [sdd] 15695872 512-byte hardware sectors: (8.03 GB/7.48 GiB)
sd 9:0:0:0: Attached scsi generic sg4 type 0
sd 9:0:0:0: [sdd] Write Protect is off
sd 9:0:0:0: [sdd] Mode Sense: 23 00 00 00
sd 9:0:0:0: [sdd] Assuming drive cache: write through
sd 9:0:0:0: [sdd] Assuming drive cache: write through
 sdd: sdd1
sd 9:0:0:0: [sdd] Attached SCSI removable disk
fuse init (API version 7.11)

As we can see my USB drive is sdd or /dev/sdd

Next we need format it via NTFS. This will ERASE all you the data on you USB drive. So make sure you have it backed up.

linux# mkfs.ntfs /dev/sdd1

This might take a while, so go get a drink.

Step 4: Next download Unetbootin.  Unetbootin is nice because for most Linux distros you don’t have to pre download the ISO image, Unetbootin will do that for you.  But in this case, because Windows 7 is not free, you have to the ISO.

Step 5: Once it is installed run it (If you need help installing it, the Unetbootin site has good instructions)

Check the Diskimage radio button and then click the browse button to select the Windows 7 ISO.  You will also have to check Show All Drives and then select the drive and partition of your USB device, in my case /dev/sdd1.  The /dev/sdd1 is relevant to my system, it may not be the same on your system.  Once you click OK the data on that partition will be removed so make sure that you are selecting the USB drive not your local hard drive.  I am not responsible for your mistakes!!!

unetbootin-win7

Once you click ok you will see a status screen showing you the files that are being copied to your USB drive.

Step 6: Once Unetbootin is finished we need to download and copy two files to your USB device.  These two files are config files responsible for helping syslinux boot to the Windows 7 installation.

The two config files are nt60.0 and syslinux.cfg. When you are copying this to your drive and are prompted to overwrite existing files click Yes.

Now you are finished.  Go and install Windows 7.  But don’t forget Linux is better, you will be back, trust me, you will be back.

HOWTO: Send SMTP commands via a bash script and the /dev/tcp device file

Scroll down to script

Today at work, the support staff needed to check and see if a customer’s email server was setup to relay mail via their database server.  Normally when asked, I direct the support staff to the send the SMTP commands via Telnet like so:

You do/type this Server responds with
Telnet to hostname on port 25 220 (then identifies itself – possibly with several lines of 220 + text)
HELO your_domain_name or whatever 250 (followed by human readable message)
MAIL FROM:you@hostname.com (ie, your email address) 250 is syntactically correct (or similar)
RCPT TO:them@someplace_else.com (email address you want to send to) 250 is syntactically correct
DATA Tells you to send data then CRLF period CRLF at end
You type your message then CRLF period CRLF (ie, type a period on a line by itself then hit ENTER) 250
QUIT Signoff message

But I figured instead of telling them the same thing every other week it was time to brush up on my bash scripting skills and learn something new in the process.

I first tried to read in the variables and then send them out to a telnet command but quickly realized that once telnet was executed in the script it would no longer accept the bash variables that I had created.  I knew from previous scripts that I could use the expect commands (more info) but expect is not usually a package that gets installed on a linux server by default and most of these servers are production database servers, which no admin would allow a random package to get installed with out testing it first.

So with expect out of the question it was time for some Google searches which let me to an article from the Linux Journal titled “More on Using Bash’s Built in /dev/tcp File (TCP/IP)“  This struck my interest, first because I didn’t know that this was possible and second because this was the same way that I had done it in the Windows/AutoIT world (I will post more about this later).  Here is the full script that I wrote.  Feel free to use this as you need or if you see a way for me to make it better please let me know.
Script

#!/bin/bash
 
# Written by: Terry Moore
# Created on Date: 2009-10-12
# Test mail relay from a Linux database server 
# Version 0.2 
# Last update 2009-10-13
 
#Body of Email
DATA="The test message has been sent"
 
#Subject of Email
SUBJECT="Mail Relay Test"
 
 
######### Header ##########
echo
echo
echo
echo "***************************************"
echo "*                                                           *"
echo "*             Mail Relay Test App                    *"
echo "*                                                           *"
echo "***************************************"
echo 
echo "Press control+c at any time to cancel"
echo "Please answer all of the following questions:"
echo
 
 
##### Get Mail Server #######
LOOP=0
while [ $LOOP -ne 1  ]
do
	echo -n "Enter Mail Server Name: " ; read MAILSERVER;
	if [ "$MAILSERVER" != '' ] ; then
		LOOP=1
	fi
done
 
 
###### GET PORT ##########
echo -n "Enter Port: [typically 25]: "; read PORT;
if [ "$PORT" = '' ] ; then
	LOOP=1
	PORT="25"
fi
 
###### GET MAIL FROM ##########
echo -n "Enter Mail From: [support@email.com]" ; read MAILFROM
if [ "$MAILFROM" = '' ] ; then
	MAILFROM="support@email.com"
	LOOP=0
fi
 
###### GET MAIL TO ##########
LOOP=0
while [ $LOOP -ne 1 ]
do
	echo -n "Enter Mail To: " ; read MAILTO
	if [ "$MAILTO" != '' ] ; then
		LOOP=1
	fi
done
 
 
#### SEND MAIL via RAW TCP #######
echo 
echo "Connecting to $MAILSERVER on Port $PORT";
echo "Please wait ... "
echo
exec 3<>/dev/tcp/$MAILSERVER/$PORT 
 
if [ $? -ne 0 ] ; then
	echo
	echo "ERROR: Cannot connect to the Mail Server";
	echo "Please check the servername and/or the port number"
	exit
fi
 
echo -en "HELO mail.email.com\r\n"  >&3 
echo -en "MAIL FROM:$MAILFROM\r\n" >&3
echo -en "RCPT TO:$MAILTO\r\n" >&3
echo -en "DATA\r\n" >&3
echo -en "Subject: $SUBJECT\r\n\r\n" >&3
echo -en "$DATA\r\n" >&3
echo -en ".\r\n" >&3
echo -en "QUIT\r\n" >&3
cat <&3
 
 
echo
echo
echo "Check the above output for errors"
echo

I know I have to do more error checking and data sanitizing but you can get the drift as to how to use bash’s builtin /dev/tcp device file to send telnet commands.

More on Using Bash’s Built-in /dev/tcp File (TCP/IP)

Maybe 2009/2010 Is The Year Of The Linux Desktop

With Linux on the desktop becoming more of a house hold choice due to low end netbooks and Linux’s ability to out preform Windows XP/7 on most of these devices.  Microsoft now feels the need to conduct training session with Best Buy employees spreading FUD and MS propaganda to sway potential netbook/notebook buyers away from Linux.  Ars Technica has gotten a hold of the slides and material that MS has shown to Best Buy employees and as any user that has been around Linux for more then two weeks can see most of their claims are just out right ridiculous. The fact that MS has specifically targeted Linux and not Apple Mac OSX shows their true fear  and the great potential Linux has to offer as an alternative to Microsoft Windows.

Read the full article as see for yourself.

The Linux Desktop

OSNews.com has an interesting article asking the question “Is the Linux Desktop Too Much Like Windows, Mac OS.”  Maybe, but is it a bad thing, I don’t think so.  In order for linux to continue to grow in popularity and to be adopted by regular day to day users there needs to be a certain level of crossover.  This crossover will allow new users to be able to start using Linux from day one and with very little frustration.  But I do think that each desktop environment needs to continue to innovate and to stand out on its own.  KDE has started to do this with KDE 4.x but at the same time continues to have a “start” button to allow users to get to their applications.  By doing this a Windows user that has never used KDE instinctively clicks on that icon to start navigating the OS and away they go.  Gnome is similar with a large button that has the word Applications on it.  Sure it maybe on a menu bar at the top of the screen but it still doesn’t get much clearer then that.