Saturday, February 27, 2010

Hibernate

Do you think nowadays a swap partition is not needed anymore because of the GB-sized RAMs ?

Well, if you want to use the Hibernate feature you need a swap partition. There is the possibility to use a file on a disk to store the RAM for Hibernate but the quickest way is to use a swap partition.

Friday, February 12, 2010

ASUS AT3N7A-I & MythTV & Fedora 12

On my page you can find a report about the motherboard ASUS AT3N7A-I

http://linux.thaj.net63.net/prj/at3n7a-i/AT3N7A-I.html

and some tips for MythTV 0.22 + NVIDIA Driver and Fedora 12

Sunday, November 29, 2009

Fedora 12 & Maple 13

Maple worked out of the box with Fedora 10. With Fedora 12 you will get some security warings.

To get Maple working execute the script on a terminal:

MAPLE=/opt/maple13
export MAPLE
chcon -t execmem_exec_t $MAPLE/bin.IBM_INTEL_LINUX/mserver
find "$MAPLE" -name "*.so" -print0 | xargs -0 chcon -t textrel_shlib_t

I havn't tested all, but my stuff works.

Sunday, August 2, 2009

Use your mobile phone via bluetooth as modem

All commands should be run as root.

First pair your phone.
There are many HOWTOS or just look at the source at the bottom.
At this step you should get the bluetooth address for your phone, if not use

$ hcitool scan


Another way is to put the pin code into file pincodes in the directory /var/lib/bluetooth/<address of your bt adapter>
The first entry of a line is the address of your bluetooth device, the second the pin code, eg:
00:1E:3B:10:7A:88 1234


Bind the phone.
First you need to find out which channel the DUN (Dial Up Networking) uses. Usually it's channel 1. But ...

$ sdptool search dun

or to get all services ...

$ sdptool browse [bluetooth address]



Add the following to /etc/bluetooth/rfcomm.conf
rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device 00:1E:3B:10:7A:88;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment "Mobile Modem";
}


Replace the bluetooth ID after device with the mobile phone's bluetooth ID and check if the channel is the right one.
If bind is set to yes, the mobile phone is bind when rfcomm starts. Of course, if there is another rfcomm0 section, use rfcomm1 and so on ...

Bind the phone (if bind is set to yes and the bluetooth service is active, the command will be run at startup)
$ rfcomm bind rfcomm0

You can check it with
$ rfcomm

Output is something like
rfcomm0: 00:1E:3B:10:7A:88 channel 1 clean


Set up a modem connection

Now your are ready to start an internet connection via /dev/rfcomm0
The connection settings you should get from your mobile service.

Usually you need an init string something like
at+cgdcont=1,"IP","internet"


Most mobile services accept for the username and password dummy values.


http://linux.frankenberger.at/Huawei_E220_Daten.html is a good place to look for connection settings.


Ref

I tried it with a Nokia 2630 and worked great.

Good source with details HOWTO : http://davesource.com/Solutions/20070520.T-Mobile-Nokia-E65-Ubuntu-Linux.html

Sunday, May 17, 2009

Protect your data

As external hard drives get more popular, data security should get more attention.

Here is a simple How To for creating an encrypt hard drive.

First at all, you need an empty partition. For our example I will call it /dev/sda5.

Run cryptsetup to create the partition. It will ask you for the password. Be sure no data is on the partition !!

cryptsetup -c twofish-cbc-essiv:sha256 -s 256 luksFormat /dev/sda5

Well, -c choose the cipher, -s set key size (128 as default is not enough).



Now we have an encrypt partition, but without any filesystem. To create a filesystem, open the partition with

cryptsetup luksOpen /dev/sda5 encrypthd

The last parameter sets the mapping name, e.g. /dev/mapper/encrypthd



Create the filesystem with

mkfs.ext3 /dev/mapper/encrypthd



Now mount it and your done !

To close an encrypt partition, unmount it and call

cryptsetup luksClose encrypthd





To mount it at startup, edit or create the file /etc/crypttab (only root should be able to read/write)

Syntax for crypttab: target source key options

So, for our example add the line:

encrypthd /dev/sda5 none

If key file is none: it will ask you for the password at startup.



And add the line to fstab:

/dev/mapper/encrypthd /encrypthd ext3 defaults 1 2





If you are really paranoid, you also have to encrypt your swap. On an unclear system shutdown (blackout, ...) the password for the encrypt partition can be still on the swap partition.


Gentoo has a good documentation (cipher, more details, ...):

http://de.gentoo-wiki.com/wiki/DM-Crypt
http://en.gentoo-wiki.com/wiki/DM-Crypt (a little be outdated)


Saturday, April 11, 2009

Some Kernel Parameters

A long list can be found at: http://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt


forcefsck to check the filesystem or run (link)
touch /forcefsck
reboot


single (single mode) or n where n is the runlevel to enter

ro mount root file system read only on boot, so fsck can do its job.

Probelms with Fedora 10 on a Gericom Blockbuster 2

A Gericom ??? You ask me, if I'm sick ?
Well, someone bought it and just for standing around it's too bad.

I installed Fedora 10 on an external hard drive and with my PC and another notebook (it's a maxdata) it works without any problems. Well, how to boot Fedora change from PC to PC. Some can read the MBR on the external hard drive and load GRUB, other need GRUB on the internal hard drive to boot from the external drive.

Back to Gericom:
The BIOS have an option to boot from removable devices, but when I plug in my 1TB external drive, the BIOS hangs up. With smaller USB drives it works. BIOS update doesn't help.

So I searched for a boot manager, which is able to boot from usb. I found PLoP Boot Manager at http://www.plop.at/en/bootmanager.html, which does the job.

The next problem:
Booting Fedora worked, X started, but suddenly no keyboard or mouse worked anymore. But the system was running. I know that because when I pressed the power off button, the shutdown dialog appeared. What the hell is going on ?

The make a long story short: After some tests, I figured out that the service irqbalance was the trouble maker. When the service is disabled, the system runs.

Start up with runlevel 2 (here is irqbalance disabled), run chkconfig --levels 345 irqbalance off to disable the service at the runlevels 3, 4 and 5.

Monday, April 6, 2009

Disable the f*cking PIN code

I just installed Fedora 10 and wo. Everything worked at startup: X.org, sound, network. I didn't have to configure something.

Then I plugged in my Huawei E220 UMTS moden and opened the NetworkManager to enter my username and password.

I tried to connect. NetworkManager asked me for the PIN code. I entered the right one and clicked OK. Nothing happend except the logging in the syslog "Searching for network ...". After some minutes the NetworkManager give up.

Rebooted, enter PIN code in the config dialog. Same problem. Rebooted, maybe currently no network, so I tried it with Ubuntu, no problems.

Why does the thing not work with Fedora ? With Ubuntu there is no problem.

After some time I disabled the PIN code and it worked.

NetworkManager is also unable to handle a SIM card with a PIN code correctly.

My tip: Disabling the f*cking PIN code helps to aviod some troubles ...

Wednesday, September 3, 2008

Experience with mencoder

mencoder encodes videos, I use it to encode my DVB recordings. When you run mencoder without any tunning, you will waste useful space. Here is my experience with mencoder:

Removes all black borders
Really !! You can use the filter cropdetect to find the values for the crop filter or use the filter rectangle:
$ mplayer -vf cropdetect video.avi
$ mplayer -vf rectangle=716:428:: video.avi

Avoid odd numbers
as a general advise.

Height and Width
must be a multiple of 16. The video codec encodes the video with 16x16 blocks and if the size isn't a multiple of 16, you will waste space. The filter cropdetect returns values that are a multiple of 16, but also crops the video sometimes to much.

Scale
can help to solve this problem. And sometimes it's better to have a smaller height and width. First just crop only the black borders, then scale the video height and width to a multiple of 16.

For example:
$ mplayer -vf crop=716:428::,scale=640:-10

The new width is 640 and height 352.
The parameter -10 tells the scale filter to calculate the height using the width and to round the height to the closest multiple of 16.

Use filter hqdn3d=2:1:2
Use filter harddup
See man page why

Two Pass Mode
The  first pass analyzing the whole video and writes a statistics file. The second pass reads the statistics file and bases ratecontrol decisions on it. The output file from the first pass can be deleted or send directly to /dev/null

File Size
Should the movie fit on a CD, then you have of calculate the bitrate of your movie:
Bitrate = (Target_Size_in_MB - Audio_Size_in_MB - AVI_overhead_MB) * 1024 * 1024 / Length_in_secs * 8 / 1000
Use the video codec xvid and it will do it for you, you just need to set the video file size in KB (See example).
How to calculate it ? When you use the Two Pass Mode, write down the audio size after the first pass has finished.
Video_Size_MB = Target_Size_in_MB - Audio_Size_in_MB - AVI_overhead_MB
Video_Size_KB = (Target_Size_in_MB - Audio_Size_in_MB - AVI_overhead_MB) * 1024

AVI Overhead
When you use AVI as your container, some MBs will be wasted for the AVI header and index.
For a 350MB file ~ 5MB
For 700MB ~ 8MB

Example

First Pass
$ mencoder -ovc xvid -xvidencopts pass=1:autoaspect:threads=2 -vf crop=715:428::,scale=640:-10,hqdn3d=2:1:2,harddup -oac mp3lame -lameopts aq=3:preset=standard video.mpg -o /dev/null

Second Pass
$ mencoder -ovc xvid -xvidencopts pass=2:bitrate=-595968:autoaspect:threads=2 -vf crop=715:428::,scale=640:-10,hqdn3d=2:1:2,harddup -oac mp3lame -lameopts aq=3:preset=standard video.mpg -o video.avi


Is the value for the bitrate option negativ, it sets the video size in kilobytes [700 (CD) - 110 (audio size) - 8 (AVI overhead) = 580 * 1024 = 595968kb].
The threads option is only useful if you have more than one CPU else remove it.

DVB Streams

If you record a DVB streams you will notice sooner or later, that they aren't small.
For two hours 5 GB space, isn't that small and won't fit on a CD.

To encode a video, first you have to demux with ProjectX (http://sourceforge.net/projects/project-x) and remux with mplex (package mjpegtools) the stream to fix possible transmission errors. If you don't to that, you will maybe get a video where the audio and video is out of synchronization. It is also possible to export the subtitles from the Teletext.

$ java -jar ProjectX.jar myVideo.mpg

After running the program, you will find for every video and audio track an own file. To see all available options from ProjectX, run it without any parameters.

Then remux the video and audio together with mplex:

$ mplex -f 8 -o newVideo.mpg myVideo.m2v myVideo.mp2

When mplex returns without any errors, all files are no longer needed except newVideo.mpg.

Now cut out the advertisement, for example with dvbcut or avidemux and encode the video the get a smaller file size.

Saturday, August 16, 2008

My Linux Stuff

I have set up a new web page where i place all the Linux Stuff which has no place at this blog like long scripts and so on ...

http://linux.thaj.net63.net/

Wednesday, July 30, 2008

Horrible MP3 sound ?

When i played MP3 files, they sound horrible and had a bad quality.

I don't know why, but if I set the PCM control to 80% or lower (thanks
to a hint from a forum), i will get the quality before I switched to
Linux.

Crazy, isn't it ?

Sunday, July 6, 2008

What happend with "Have a lot of fun ..."

Do you remember ? After a successful login on a tty, the text "Have a lot of fun ..." was displayed on the screen in the old days.

But nowadays ?

Friday, July 4, 2008

MythTV - a dream become true ...

MythTV is next generation of watching TV aside from Video on Demand. With MythTV you can pause, rewind, forward and more what you are watching. And that's all possible because MythTV records everything you are watching. It's your personal digital video recorder. For this you need a fast PC and a lot of free space on your hard disk. I have 2,0 GHz and somethings the video jitter. Watching HDTV is impossible.


Installation

Installing the program with ./configure && make && make install took a while til i had installed all need libraries and header files. The program files are installed into /usr/local which is not a default location on Fedora and so you start MythTV, it won't find the libraries.

Solution 1: Run ./configure --prefix=/usr
Solution 2: Create a new file named mythtv.conf in /etc/ld.so.conf.d and put in it where the libraries are, usually /usr/local/lib, run ldconf to apply the changes.

And do your eyes a favor: Install the additional themes package.


Tip 1: MySQL

MythTV uses MySQL to store its configuration and data. If you run mythbackend and mythfrondend on one PC, MySQL can run with a small configuration to save memory and disk space. Disable innodb (see skip-innodb), MythTV doesn't used it and with the default configuration it uses 10MB of your hard disk.

[mysqld]
#port = 3306
#datadir=/home/jorg/.mythtv/db
#socket=/home/jorg/.mythtv/db/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K

server-id = 1

skip-bdb
skip-innodb

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

After a restart of the mysql server you can remove the innodb files from your mysql data directory to free up the disk.


mythtv-setup

Configure MythTV the first time with mythtv-setup is hard, if you do not know what you are doing:

2. Capture Cards
Here you define your TV card.
3. Video Sources
Here you define where MythTV can find the program information for the EPG.
With DVB-S the "Transmitted guide only" is a good choice.
4. Input connections
Here you say Capture Card x can find his program information at video source y.

Scan for channels: That's a torture. Every time you do a Full Scan (Tuned) you have to reenter all the data. And with this type only a few data(?) channels are found. But i got the transponder list. And with a Full Scan of Existing Transports i got my channels. The first times i run it, i had the feeling the program hang up because no screen update for a long time and error messages in the log file. Go and get a cup of tea, the scan took longer than the dvbscan, about 10-20 minutes.

The next step is to download the channel logos, only if you like. I think, this tool is buggy. When you choose a logo for a channel from a list of choices, the logo get downloaded, but the channel is not updated, so you have to enter the filename by hand. If the program choose automatic a logo because there is only one, the channel will get updated. For the filename you have to enter the full path, e.g. /home/bob/.mythtv/channels/logo.jpg


Tip 2: Edit channels

If you are to lazy, like me, to install MythWeb there is another smart way to edit the channel list:
Export the channels into channels.csv:
$ mysql -u mythtv -p mythconverg -e "SELECT * FROM channel" > channels.csv
And you get a tabulator separated file, import it with e.g. OpenOffice.org Calc. Edit the channels, save and import it back:
$ sed -e "s/\"NULL\"/NULL/g" channels.csv > channel.csv
$ mysqlimport -u mythtv -p mythconverg --columns=`sed -n -e "y/\t/,/" -e "s/\"//g" -e P -e q channel.csv` --ignore-lines=1 --local --delete --fields-optionally-enclosed-by=\" channel.csv
You need the parameter --columns for the case, you changed the order of the columns.

The commands explained:

sed -e "s/\"NULL\"/NULL/g" channels.csv > channel.csv
Replace "NULL" with NULL, save into channel.csv
sed -n -e "y/\t/,/" -e "s/\"//g" -e P -e q channel.csv
Returns the first line which contains the column names, replace the tabulator with "," , replace the field separator " with nothing.



Tip 3: EPG

Be patient. The EPG needs its time. And it only collects the EIT information when the LiveTV is not running. Well, if you don't trust the program, run only the backend with

$ mythbackend -v eit

and do nothing, wait one minute (default setting, to change run mythtv-setup, go to General, Page EIT)


If you followed the install instruction correctly, you will be ready for the next generation of watching TV.
Have a lot of fun ...

Tuesday, July 1, 2008

CyberLink Remote Control

The CyberLink IR receiver is recognized as two simple USB keyboard (I don't know why two) and one mouse.

Kernel Log:
kernel: input: TopSeed Tech Corp. USB IR Combo Device  as /class/input/input3
kernel: input,hidraw0: USB HID v1.00 Keyboard [TopSeed Tech Corp. USB IR Combo Device ] on usb-0000:00:02.1-3
kernel: input: TopSeed Tech Corp. USB IR Combo Device as /class/input/input4
kernel: input,hiddev96,hidraw1: USB HID v1.00 Mouse [TopSeed Tech Corp. USB IR Combo Device ] on usb-0000:00:02.1-3

With the default, not really useful (for me) keycodes are assigned.
For example the the red button has the keycode KEY_F15 (389), green KEY_F17 (391), yellow KEY_MEDIA (226), blue KEY_VIDEO (393). (The funny thing is: xev doesn't report these keys.)

Remapping with keycodes and scancodes doesn't work because USB keyboards have no scancodes. A good explanation you can find on http://lkml.org/lkml/2006/6/9/307.

I was looking for a simple way to remap the keys to other keys. I looked quick over http://lineak.sourceforge.net/ and maybe that will do it also. But i wrote my own program to change the keys.

With this program you set your own keycodes. The default mapping is for MythTv. The change the mapping, just edit keys.h and recompile the package.

The source code of the program is available under
http://twe.awardspace.com/cyberlink/