Stargate Logo  Secured by phpPhobos

Smurphtools   
  Login  - No Account?  Create One   
Search 
Monday, 23 April 2018  -
News FeedRSS Feed
rss rdf  
  Home 
  Authentication 
 Documentation 
    Site Documentation 
    About me 
  Legal Notice 
 Applications 
    Web Links 
 RC Models 
    RC Models 
    RC Batteries 
 Modules 
    Downloads 
    Weblinks 
 Blacklists 
    Blacklist 
    Blockout 
    DNS Blacklist 
 Registered Bloggers 
  Blog de Maiwenn 
  Blog de Morgane 
  Joerg's Blog 
 FAQ  [ Topics  ]
 Routerboard RBxxxAH 
 Common Linux problem... 
 Apple Mac-mini 
 PHP Phobos 
 Stargate's Backup sc... 
 eBook Reader / PRS-5... 
 RC Models 
 Server in SolLan 
 System Stats [ Index ]
 Router
  > Gateway 
  > AP 
 Server
  > Nas 
  > Stargate 
 Client
  > RemPi 
Stargate's FAQ   [  Topics  | Groups  | Last  | Expand  | Search  | Print  | Documentation ]
Folder open  Common Linux problems [ Expand ]
  Question ?  BIOS Updates for Epia-Boards fix DMA-Issues   
  Question ?  The Vt1211 sensors-module driver does not work under kernel 2.6.13 ?   
  Question ?  How can In use a crypted Filesystem ?   
  Question ?  LILO won't boot. I get LI   
  Question ?  How can I boot from the SATA drive 2 of a Software Raid-1 System ?   
  Question ?  How can I manipulate X509 certificates ?   
  Question ?  How can I generate self signed certificates for various services ?   
  Question ?  How does SATA Raid work ? Fake or real raid ...   
  Question ?  How can I reboot the Linux system without access to the disks ?   
  Question ?  Logitech MX700 mouse configuration with XOrg   
  Question ?  How do I prepare the SUSE 10.0 source for compiling an external module ?   
  Question ?  Logitech MX700 Keyboard configuration for XOrg   
  Question ?  Thunderbird E-Mail Header extension   
  Question ?  Is there a way to easily check a valid ssl connection ?   
  Question ?  Firefox 3 beta and prefetch-next ?   
  Question ?  How can I identify UUID on harddisk partitions ?   
  Question ?  How can I do some network troubleshooting ?   
  Question ?  Are there ways to check certificate purposes ?   
  Question ?  How can I Identify a System using DMI data ?   
  Question ?  Can I resize (grow) a NTFS Partition under Linux ?   
  Question ?  How to reinstall grub from a rescue mode ?   
  Question ?  How can I mount a SMB share under linux ?   
  Question ?  Dual Pairing bluetooth keyboard under Linux and OS-X ?   
  Question ?  Is there a way to migrate playcount data from amarok to xbmc ?   
spacer line
Folder open  Answers
spacer line
Question ? BIOS Updates for Epia-Boards fix DMA-Issues   [
View DetailsView details
|
Print ViewPrint view
]

 BIOS Updates - Several people are experiencing lockups with the EPIA Boards, often these lockups are encountered during large data transfers, this is most likely a DMA problem and many have reported that it goes away when using the following BIOS update -- Note: Reports do suggest that the M series boards work well with the newest BIOS update, however users of CL and MII boards still report the lockups. These are clearly "test" BIOS and you should not apply them unless you are having the lockup problem. Also, many reports of hard freezes are due to the longhaul driver that is in the currrent kernel, before you apply one of these BIOS updates, make sure that your longhaul driver is not being controlled by a daemon. 

Entered by smurphy on Monday, 05 September 2005 @ 19:15:39  
Linux on VIA Epia Hardware - Common Linux problems, # Hits: 91230

Next  How can I flash the BIOS on the Epia 10000M mini-ITX system under Linux ? 
Next  How can I flash the BIOS on the Epia 10000M mini-ITX system under DOS ? 
Next  Lex CV860A / Epia 5000 system instability 
Next  How do I update the Bios on the Epia SP8000E Board ? 
spacer line
Question ? The Vt1211 sensors-module driver does not work under kernel 2.6.13 ?   [
View DetailsView details
|
Print ViewPrint view
]

 The 2.6.13 kernel requires an updated vt1211 driver. Using an old vt1211 driver gives a kernel "Oops" when sysfs files are accessed to monitor the hw.

A patch for 2.6.13 is available at http://hem.bredband.net/ekmlar/linux-2.6.13-vt1211.patch.txt or attached to this FAQ here.
This patch is to be applied to a plain-kernel 2.6.13.
You'll find more informations on that page...
you can alternatively also grab a copy of the plain vt1211.c file - The driver can be built manually with:

 echo "obj-m := vt1211.o" > Makefile
 make -C /path/to/your/kernel2.6/source/dir SUBDIRS=$PWD modules

The patch also works with kernel 2.6.13.2. 

Entered by smurphy on Tuesday, 20 September 2005 @ 23:52:42  
Linux on VIA Epia Hardware - Common Linux problems, # Hits: 89997

Attach   linux-2.6.13-vt1211.patch.txt  [ 34,161 bytes - text/plain ]
Attach   vt1211.c  [ 30,614 bytes - text/x-csrc ]

Next  Building the 2.6 kernel for the Epia SP8000E Board with Nemiah CPU 
spacer line
Question ? How can In use a crypted Filesystem ?   [
View DetailsView details
|
Print ViewPrint view
]

 To use a crypted Filesystem - you first need to actually create it. I came accross an article showing me how to do it using cryptsetup. Check it out under http://luks.endorphin.org. Note that this is the upcoming standard for filesystem encryption under linux
LUKS was designed according to TKS1, a template design developed in [TKS1] for secure key setup. LUKS closely reassembles the structure recommended in the TKS1 paper, but also adds meta data for cipher setup management and LUKS also supports for multipe keys/passphrases. Why LUKS?
- compatiblity via standardization,
- secure against low entropy attacks,
- support for multiple keys,
- effective passphrase revocation,
- free
For creating the Crypted Filesystem - I assume using the /dev/sda1 device (USB-Drive). Replace all instances of sda1 with the device you require.:

modprobe aes
modprobe dm-crypt
cryptsetup -c aes-cbc-essiv:sha256 -y -s 256 luksFormat /dev/sda1

WARNING!
========
This will overwrite data on /dev/sda1 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
cryptsetup luksOpen /dev/sda1 cryptfs
Enter LUKS passphrase:
key slot 0 unlocked.

mke2fs -j -m 0 /dev/mapper/cryptfs
[...Formatting informations removed...]
tune2fs -c 0 -i 0 /dev/mapper/cryptfs
mkdir /cryptfs
mount /dev/mapper/cryptfs /cryptfs

This will setup up your crypted Partition and mount it under /cryptfs.
Unmount the Partition and lock the encrypted Filesystem cleanly for security

umount /cryptfs
cryptsetup luksClose cryptfs

and you're done. If you now want to add some more passwords - use cryptsetup to do so:

cryptsetup luksAddKey /dev/sda1
Enter any LUKS passphrase:
key slot 0 unlocked.
Enter new passphrase for key slot:

This added a new passphrase. Remove it using a similar command.

cryptsetup luksDelKey /dev/sda1 1

where 1 is the slot the key was stored in. Make sure you don't erase your master Key ... Would be bad if you couldn't access the encrypted FS anymore.
As I'm lazy to remember all that - I usually write wrapper scripts I use at home for mounting these devices.
Check it out in the donwload section.

Usage:  mount_crypted.sh    
        This Program manipulates crypted partitions

         mount          Mount a crypted partition
         umount         Unmount a crypted partition
         addkey         Add a new access key to the encrypted
         delkey         remove a key from the encrypted - don't use 0
                        Filesystem/Partition. 8 Max.
         new_partition  Create a new encrypted partition
                        * Warning - this will destroy all data on it
         device         Device to work on. e.g. /dev/sda1
         enc_module     Encryption module. Usually aes, or padlock if you have
                        a padlock accellerator chip as found on recent VIA Nemiah CPU's

Examples:
        mount_crypted.sh new_partition /dev/sda1 aes
        mount_crypted.sh mount /dev/sda1 aes
        mount_crypted.sh addkey /dev/sda1
        mount_crypted.sh delkey /dev/sda1 aes 2
        mount_crypted.sh umount /dev/sda1

In case someone screws his partition - and needs a static version - check this static version of cryptsetup out. 

Entered by smurphy on Wednesday, 01 February 2006 @ 22:52:21  
Cryptography stuff - Common Linux problems, # Hits: 83454
spacer line
Question ? LILO won't boot. I get LI   [
View DetailsView details
|
Print ViewPrint view
]

 The problem lies in the Harddisk geometry the BIOS passes to the LILO loader. Unfortunatly, when booting from a normal install, you sometime get your Harddisks parameteres read in LBA, CHS or Large form, this due to the new read of the Partition tables when you changed the partition informations. If the BIOS gave in the harddisk geometry data in LBA, the system will reread the Harddisk geometry in CHS mode, thus the boot will fail.

So, to get this working right, go into the CMOS Setup of your Mainboard, and play around with the Translation Method. Mostly after this error to happen - LARGE or CHS will fix the problem. 

Entered by smurphy on Thursday, 01 September 2005 @ 21:34:55  
Linux General - Common Linux problems, # Hits: 75571
spacer line
Question ? How can I boot from the SATA drive 2 of a Software Raid-1 System ?   [
View DetailsView details
|
Print ViewPrint view
]

 As configuration starting point - here is the setup as found on my server:
/dev/sda - Primary S-ATA drive
/dev/sdb - Secondary S-ATA drive

Note that both drives are master drives - as S-ATA does not handle Primary/Secondary stuff.
Having the System up and running - the partitions look like this - assuming they are setup already:

Filesystem            Size  Used Avail Use% Mounted on
/dev/md0              380M   75M  267M  22% /
/dev/md1               76M  9.8M   63M  14% /boot
/dev/md2              2.9G  378M  2.3G  15% /home
/dev/md5               26G   11G   13G  48% /home/Share
/dev/md6              981M  132K  881M   1% /tmp
/dev/md3              2.0G  1.3G  476M  73% /usr
/dev/md4              4.4G  1.3G  2.7G  32% /var

Note that the Primary root partition is md0 and the boot partition md1. This will be important in the grub-configuration later on.
The following grub.conf file has the following features:
- Has several harddisks to boot from
- uses fallback to jump to the next harddrive in case the first one fails
- prepares the connection of a serial console, while also displaying all stuff on tty0

Assuming you have the following grub.conf file in your /boot partition - which is md1:

# Boot automatically after 30 secs.
timeout 50

# By default, boot the first entry.
default 0

serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=50 serial console

# Fallback to the second entry.
fallback 1

# Splash-Image...
# splashimage=(hd0,0)/grub/splash.xpm.gz

# For booting with disc 0 kernel
title  EpiaN (hd0,1)
kernel (hd0,1)/vmlinuz-2.6.13.2-EpiaN root=/dev/md0 
devfs=nomount acpi=ht resume=/dev/md7 splash=silent
read-only console=ttyS0,115200n8 console=tty0 initrd=(hd0,1)/initrd-2.6.13.2-EpiaN.img # For booting with disc 1 kernel title EpiaN (hd1,1) kernel (hd1,1)/vmlinuz-2.6.13.2-EpiaN root=/dev/md0
devfs=nomount acpi=ht resume=/dev/md7 splash=silent
read-only console=ttyS0,115200n8 console=tty0 initrd=(hd1,1)/initrd-2.6.13.2-EpiaN.img # Mandrake Kernel title linux-i686-up-4GB (hd0,1) kernel (hd0,1)/vmlinuz-2.6.11-6mdk-i686-up-4GB root=/dev/md0 devfs=nomount acpi=ht resume=/dev/md7
splash=silent read-only console=ttyS0,115200n8
console=tty0 initrd=(hd0,1)/initrd-i686-up-4GB.img # Mandrake Kernel title linux-i686-up-4GB (hd1,1) kernel (hd1,1)/vmlinuz-2.6.11-6mdk-i686-up-4GB root=/dev/md0 devfs=nomount acpi=ht resume=/dev/md7
splash=silent read-only console=ttyS0,115200n8
console=tty0 initrd=(hd1,1)/initrd-i686-up-4GB.img # For booting with disc 0 kernel - Failsafe title Failsafe (hd0,1) kernel (hd0,1)/vmlinuz root=/dev/md0 devfs=nomount acpi=ht
resume=/dev/md7 splash=silent failsafe read-only
console=ttyS0,115200n8 console=tty0 initrd=(hd0,1)/initrd.img # For booting with disc 1 kernel - Failsafe title Failsafe (hd1,1) kernel (hd1,1)/vmlinuz root=/dev/md0 devfs=nomount acpi=ht
resume=/dev/md7 splash=silent failsafe read-only
console=ttyS0,115200n8 console=tty0 initrd=(hd1,1)/initrd.img

you would issue the following commands to install grub on your harddisks

grub> root (hd0,1)
 Filesystem type is ext2fs, partition type 0xfd

grub> setup (hd0) 
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  16 sectors are
embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p
(hd0,1)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.

grub> root (hd1,1)
 Filesystem type is ext2fs, partition type 0xfd

grub> setup (hd1) 
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd1)"...  16 sectors are
embedded.
succeeded
 Running "install /boot/grub/stage1 (hd1) (hd1)1+16 p
(hd1,1)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.

That's it. You're done. Please keep in mind - that the command "root (hdx,x)" determins where the /boot partition is to be found. In the grub.conf file - we're using the "hd0(0.1)/vmlinuz" to actually tell grub to get the kernel files etc. from that partition - which is not mounted - thus directly from "/".
Note the order of the bootable kernels. You'll notice that "title EpiaN (hd0,1)" comes first, then "title EpiaN (hd1,1)". Using the "fallback 1" statement make grub fall back to the second entry - in case the first one is not found - making the system kind of automatically boot the alternate raid-1 drive - in case drive 0 is dead. 

Entered by smurphy on Monday, 26 September 2005 @ 20:04:21  
Linux General - Common Linux problems, # Hits: 74968

Attach   grub.conf.txt  [ 1,875 bytes - text/plain ]

Next  How to reinstall grub from a rescue mode ? 
spacer line
Question ? How can I manipulate X509 certificates ?   [
View DetailsView details
|
Print ViewPrint view
]

 Display the contents of a certificate:
#openssl x509 -in cert.pem -noout -text

Display the certificate serial number:
#openssl x509 -in cert.pem -noout -serial

Display the certificate subject name:
#openssl x509 -in cert.pem -noout -subject

Display the certificate subject name in RFC2253 form:
#openssl x509 -in cert.pem -noout -subject -nameopt RFC2253

Display the certificate subject name in oneline form on a terminal supporting UTF8:
#openssl x509 -in cert.pem -noout -subject -nameopt oneline,-escmsb

Display the certificate MD5 fingerprint:
#openssl x509 -in cert.pem -noout -fingerprint

Display the certificate SHA1 fingerprint:
#openssl x509 -sha1 -in cert.pem -noout -fingerprint

Convert a certificate from PEM to DER format:
#openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER

Convert a certificate to a certificate request:
#openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem

Convert a certificate request into a self signed certificate using extensions for a CA:
#openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca -signkey key.pem -out cacert.pem

Sign a certificate request using the CA certificate above and add user certificate extensions:
#openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr -CA cacert.pem -CAkey key.pem -CAcreateserial

Set a certificate to be trusted for SSL client use and change set its alias to ``Steve's Class 1 CA''
#openssl x509 -in cert.pem -addtrust clientAuth -setalias "Steve's Class 1 CA" -out trust.pem

To convert a certificate from PEM to DER:
#openssl x509 -in input.crt -inform PEM -out output.crt -outform DER

To convert a certificate from DER to PEM: #openssl x509 -in input.crt -inform DER -out output.crt -outform PEM

To convert a key from PEM to DER:
#openssl rsa -in input.key -inform PEM -out output.key -outform DER

To convert a key from DER to PEM:
#openssl rsa -in input.key -inform DER -out output.key -outform PEM  

Entered by smurphy on Monday, 26 March 2007 @ 21:00:18  
Cryptography stuff - Common Linux problems, # Hits: 74732
spacer line
Question ? How can I generate self signed certificates for various services ?   [
View DetailsView details
|
Print ViewPrint view
]

 First - make sure you have the openssl package installed and have created a local Certification authority.
When talking about fqdn - the Full Qualified Domain Naeme is meant. This - to ensure you find your certificates after - and link them to the right service/site.
After that - create a private key with:

openssl genrsa -aes128 512/1024 > fqdn.key
Generating RSA private key, 512 bit long modulus
......................++++++++++++
....++++++++++++
e is 65537 (0x10001)

This will ask you for a password. If for any reason you don't want a password to be entered every time you want to use the certificate - skip the -aes128 part.
Once the Key created - you need to create a certification request

openssl req -new -key fqdn.key > fqdn.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:New York
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Internet Widgits Pty Ltd
Organizational Unit Name (eg, section) []:Demo Certificate Creation
Common Name (eg, YOUR name) []:www.newyork.com
Email Address []:postmaster@newyork.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Make sure the Common Name matches the Full Qualified Domain name of the Service you want to use the certificate for.
Once the request created - you need to let your local CA sign the certificate using:

openssl ca -policy policy_anything -out fqdn.crt -infiles fqdn.csr
[... Loads of stuff removed ...]
Certificate is to be certified until Dec 29 09:29:23 2006 GMT (365 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y

Now you're done.
If you're looking to create a pem-file - here is a little help for it - used b.e. to create a Key for Cyrus-Imap.

dd if=/dev/urandom of=random.rnd count=1
openssl req -new -x509 -days 365 -nodes -out fqdn.pem -keyout fqdn.pem
openssl gendh -rand random.rnd 512 >> fqdn.pem
openssl x509 -subject -dates -fingerprint -noout -in fqdn.pem

This will generate you a fine certificate for use with cyrus. 

Entered by smurphy on Wednesday, 01 February 2006 @ 22:53:06  
Cryptography stuff - Common Linux problems, # Hits: 74508
spacer line
Question ? How does SATA Raid work ? Fake or real raid ...   [
View DetailsView details
|
Print ViewPrint view
]

 The short version first:

  • Status of your current setup Yuppers, if you would switch from your current RAID setup to Software RAID, you would have to delete the RAID set in the controller-BIOS (results in complete data loss)
  • MDK tools for RAID setup I don't know what RAID setup utilites come with MDK these days, but you can take it as granted that the kernel comes with SW-RAID support. As it goes for the relation between drives/partitions, logical volumes and all that ... (lean back, relax, this is going to be lengthy

What you have found on the MDK forum is about what I was talking about in my first post ("LVM"/"Software RAID").
In fact, "onboard hardware RAID" - as postulated by the motherboard manufacturers - is in no way a hardware solution. It's a marketing buzz-word, and indeed: you'd probably be better off with a genuine linux software-RAID solution.
The linux SW-RAID-technique is what you might know from Windows as "Dynamic Volumes". Compared to the heapo-onboard solutions SW-RAID has some major advantages. The most interesting one is that you can use partitions for your RAID-volumes instead of whole drives. Time for some rotten ASCII-art, I say :)

Check a detailed explanation here  

Entered by smurphy on Friday, 02 September 2005 @ 00:58:31  
Linux General - Common Linux problems, # Hits: 74500
spacer line
Question ? How can I reboot the Linux system without access to the disks ?   [
View DetailsView details
|
Print ViewPrint view
]

 Most of the time - you can still access the proc-file system, and access the sysreq-trigger file issue the command:

echo b > /proc/sysrq-trigger

and, using b as command, it will reboot your System.
Check the attached file for a complete description
Here the commands you could use.

'r'     - Turns off keyboard raw mode and sets it to XLATE.

'k'     - Secure Access Key (SAK) Kills all programs on the current virtual
          console. NOTE: See important comments below in SAK section.

'b'     - Will immediately reboot the system without syncing or unmounting
          your disks.

'o'     - Will shut your system off (if configured and supported).

's'     - Will attempt to sync all mounted filesystems.

'u'     - Will attempt to remount all mounted filesystems read-only.

'p'     - Will dump the current registers and flags to your console.

't'     - Will dump a list of current tasks and their information to your
          console.

'm'     - Will dump current memory info to your console.

'v'	- Dumps Voyager SMP processor info to your console.

'0'-'9' - Sets the console log level, controlling which kernel messages
          will be printed to your console. ('0', for example would make
          it so that only emergency messages like PANICs or OOPSes would
          make it to your console.)

'f'	- Will call oom_kill to kill a memory hog process

'e'     - Send a SIGTERM to all processes, except for init.

'i'     - Send a SIGKILL to all processes, except for init.

'l'     - Send a SIGKILL to all processes, INCLUDING init. (Your system
          will be non-functional after this.)

'h'     - Will display help ( actually any other key than those listed
          above will display help. but 'h' is easy to remember :-)

 

Entered by smurphy on Wednesday, 31 August 2005 @ 21:33:20  
Linux General - Common Linux problems, # Hits: 74424

Attach   sysrq.txt  [ 10,208 bytes - text/plain ]
spacer line
Question ? Logitech MX700 mouse configuration with XOrg   [
View DetailsView details
|
Print ViewPrint view
]

 Support for complicated wheel/button mice has come along nicely in Xorg. Gone are the days of using ImPS/2 or ExplorerPS2 protocols (both Microsoft) to talk to the mouse, we can now use the correct HID event device.
These instructions are for an MX700 mouse that is part of the MX Duo/Cordless Desktop MX bundle. See the note below about the difference between this and a standalone MX700 There are two places that configuration needs to be performed, firstly in the main Xorg config file, then in per-user xmodmap config files. We will start with the Xorg config file
As root, load /etc/X11/xorg.conf into your favorite text editor and look for the mouse section. You want it to look more like this:

Section "InputDevice"
  Identifier "Configured Mouse"
  Driver "mouse"
  option "CorePointer"
  option "Name" "Logitech MX700 cordless mouse"
  option "Device" "/dev/input/mice"
  option "Protocol" "ExplorerPS/2"
  option "ZAxisMapping" "4 5"
  option "Buttons" "7"
  option "ButtonMapping" "1 2 3 6 7"
  option "Resolution" "800"
  option "Emulate3Buttons" "no"
EndSection

Note Finding the right USB device
The options "Dev Name" and "Dev Phys" are specific to the MX Duo/Cordless Desktop MX's dual receiver. If you have a standalone MX700 you can remove the "Dev Phys" option entirely and change the "Dev Name" option to the name of your mouse, as reported by cat /proc/bus/usb/input/devices Looking at the mouse you might ask why I have configured 10 buttons when it clearly only has 8. The answer is that scroll-up and scroll-down both count as buttons, so it is 10. Three button emulation is disabled because this mouse has 3 main buttons and the 800dpi resolution option is probably ignored, but in theory should be possible.

The second file we must edit is a per-user configuration file. In each user's home directory, create a file called .Xmodmap with the following in it:

pointer = 1 2 3 6 7 8 9 10 4 5

This should ensure that the scrolling buttons are correctly configured when X is loaded, however, if scrolling does not work you may need to run xmodmap ~/.Xmodmap (or place that command in an X startup script).
Restart X and you should have working scrolling and mouse button mapping tools should be able to use the extra buttons. 

Entered by smurphy on Sunday, 07 January 2007 @ 22:37:12  
Linux General - Common Linux problems, # Hits: 74413

Next  Logitech MX700 Keyboard configuration for XOrg 
spacer line
Question ? How do I prepare the SUSE 10.0 source for compiling an external module ?   [
View DetailsView details
|
Print ViewPrint view
]

 After installing the kernel-source rpm - perform the following steps:

# cd /usr/src/linux
# make mrproper
# make cloneconfig
# make modules_prepare

after that - you can compile an external module 

Entered by smurphy on Sunday, 16 April 2006 @ 23:52:09  
Linux General - Common Linux problems, # Hits: 74319
spacer line
Question ? Logitech MX700 Keyboard configuration for XOrg   [
View DetailsView details
|
Print ViewPrint view
]

 All of the configuration for the keyboard is performed within the main Xorg config file. As root, load /etc/X11/xorg.conf into your favorite text editor and look for the keyboard section. You want it to look more like this:

Section "InputDevice"
   Identifier      "Logitech Elite Keyboard"
   Driver          "keyboard"
   Option          "CoreKeyboard"
   Option          "XkbRules"      "xorg"
   Option          "XkbModel"      "logiinkseusb"
   Option          "XkbLayout"     "us"
   Option          "XkbVariant"    "intl"
EndSection

The logiinkseusb is not strictly the exact map for this keyboard, but it is awfully close and it is included in Xorg, so there is no need to start editing complicated xkb files. You will want to change the XkbLayout option to the correct country code for your keyboard.
Restart X and you should be able to map all the buttons on your keyboard with the correct names, using something like Gnome's Keyboard Shortcuts preferences item
Kindly taken from the following Howto 

Entered by smurphy on Sunday, 07 January 2007 @ 22:36:17  
Linux General - Common Linux problems, # Hits: 74193

Next  Logitech MX700 mouse configuration with XOrg 
spacer line
Question ? Thunderbird E-Mail Header extension   [
View DetailsView details
|
Print ViewPrint view
]

 To have a standard E-Mail Header view with scrollbar while using Thunderbird to read E-Mails - get the Header Scroll Extension and add the following to the default configuration of thunderbird:
Edit - Advanced - General - Config Editor
and add the following Integer Value:
mail.headerScroll.maxheight
with a value of 100. Will make mail reading way easyer.  

Entered by smurphy on Sunday, 15 October 2006 @ 22:29:01  
Linux General - Common Linux problems, # Hits: 74139
spacer line
Question ? Is there a way to easily check a valid ssl connection ?   [
View DetailsView details
|
Print ViewPrint view
]

 The easyest way would be to go on it with a web-browser.
However - openssl provides a very nice tool for handling exactly this. Check out the options of:
openssl s_client -connect [IP Address]:PORT

$ openssl s_client -connect www.microsoft.com:443
CONNECTED(00000003)
depth=2 /CN=Microsoft Internet Authority
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=washington/L=Redmond/O=Microsoft/OU=mscom/CN=www.microsoft.com
   i:/DC=com/DC=microsoft/DC=corp/DC=redmond/CN=Microsoft Secure Server Authority
 1 s:/DC=com/DC=microsoft/DC=corp/DC=redmond/CN=Microsoft Secure Server Authority
   i:/CN=Microsoft Internet Authority
 2 s:/CN=Microsoft Internet Authority
   i:/C=US/O=GTE Corporation/OU=GTE CyberTrust Solutions, Inc./CN=GTE CyberTrust Global Root
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIGJjCCBQ6gAwIBAgIKPuTDHAAEAACvkDANBgkqhkiG9w0BAQUFADCBizETMBEG
CgmSJomT8ixkARkWA2NvbTEZMBcGCgmSJomT8ixkARkWCW1pY3Jvc29mdDEUMBIG
CgmSJomT8ixkARkWBGNvcnAxFzAVBgoJkiaJk/IsZAEZFgdyZWRtb25kMSowKAYD
VQQDEyFNaWNyb3NvZnQgU2VjdXJlIFNlcnZlciBBdXRob3JpdHkwHhcNMDgwMjEy
MTgyNTE4WhcNMDkwMjExMTgyNTE4WjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMK
d2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDESMBAGA1UEChMJTWljcm9zb2Z0
MQ4wDAYDVQQLEwVtc2NvbTEaMBgGA1UEAxMRd3d3Lm1pY3Jvc29mdC5jb20wgZ8w
DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALbG21smSr8rN+qJ5al2ml5BaPlBnyuK
gN6KOS8TGTde496kil72zBF70sgRhQCERNNAiH0XaNWbDSqXcoxySOQhhW4PJ9P3
OfSNQMBbG+8tVFsyk12cZZSQGK7iE6Wy1mAvsbZ0K1iCvg5DceSDRgc7sggKcVi5
ZyS4wRwIlgI1AgMBAAGjggMkMIIDIDALBgNVHQ8EBAMCBaAwHQYDVR0lBBYwFAYI
KwYBBQUHAwIGCCsGAQUFBwMBMHgGCSqGSIb3DQEJDwRrMGkwDgYIKoZIhvcNAwIC
AgCAMA4GCCqGSIb3DQMEAgIAgDALBglghkgBZQMEASowCwYJYIZIAWUDBAEtMAsG
CWCGSAFlAwQBAjALBglghkgBZQMEAQUwBwYFKw4DAgcwCgYIKoZIhvcNAwcwHQYD
VR0OBBYEFIfqPJz0gndqvXIFZOP8H0+b2XKBMB8GA1UdIwQYMBaAFJmPpfcegW/6
ecLwFj+yVLEIaEdVMIIBCgYDVR0fBIIBATCB/jCB+6CB+KCB9YZYaHR0cDovL21z
Y3JsLm1pY3Jvc29mdC5jb20vcGtpL21zY29ycC9jcmwvTWljcm9zb2Z0JTIwU2Vj
dXJlJTIwU2VydmVyJTIwQXV0aG9yaXR5KDQpLmNybIZWaHR0cDovL2NybC5taWNy
b3NvZnQuY29tL3BraS9tc2NvcnAvY3JsL01pY3Jvc29mdCUyMFNlY3VyZSUyMFNl
cnZlciUyMEF1dGhvcml0eSg0KS5jcmyGQWh0dHA6Ly9jb3JwcGtpL2NybC9NaWNy
b3NvZnQlMjBTZWN1cmUlMjBTZXJ2ZXIlMjBBdXRob3JpdHkoNCkuY3JsMIG/Bggr
BgEFBQcBAQSBsjCBrzBeBggrBgEFBQcwAoZSaHR0cDovL3d3dy5taWNyb3NvZnQu
Y29tL3BraS9tc2NvcnAvTWljcm9zb2Z0JTIwU2VjdXJlJTIwU2VydmVyJTIwQXV0
aG9yaXR5KDQpLmNydDBNBggrBgEFBQcwAoZBaHR0cDovL2NvcnBwa2kvYWlhL01p
Y3Jvc29mdCUyMFNlY3VyZSUyMFNlcnZlciUyMEF1dGhvcml0eSg0KS5jcnQwPwYJ
KwYBBAGCNxUHBDIwMAYoKwYBBAGCNxUIg8+JTa3yAoWhnwyC+sp9geH7dIFPg8Lt
hQiOqdKFYwIBZAIBBTAnBgkrBgEEAYI3FQoEGjAYMAoGCCsGAQUFBwMCMAoGCCsG
AQUFBwMBMA0GCSqGSIb3DQEBBQUAA4IBAQAztULGfaAxeoGZbbViAVMtaPkMHaoN
wGzhw4ePcWqSvDKnl9yLpbAsl7T+w4bbeJotXCl89Ri+G4Mbfo3wzcDfStM66qcR
zGnEpiESh7cUZhUrxo+Iu+Ptn3pR/ub3uv8/WwF+KK6UUP+uhVMyxPT2LaGWgBSd
9/8qtngpMAbQVKnm4D8uQrcOa4Yqnjk6F2nNFCqd1Fl6yk5vxcfHD0YEcUNnC9SL
yBRmzNKsCh0d6rFaeLDBvkVjPZ7HQkWoJ/JdBBCLRvpE+1CGKVEmj69wK+n5uZ/Z
O46yGLxJwx62Vxdqno2D57R52VRx2c3ec5t5M2HUy6+K5W73BO0+hGKh
-----END CERTIFICATE-----
subject=/C=US/ST=washington/L=Redmond/O=Microsoft/OU=mscom/CN=www.microsoft.com
issuer=/DC=com/DC=microsoft/DC=corp/DC=redmond/CN=Microsoft Secure Server Authority
---
No client certificate CA names sent
---
SSL handshake has read 4078 bytes and written 316 bytes
---
New, TLSv1/SSLv3, Cipher is AES128-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : AES128-SHA
    Session-ID: 860400006196E94CAEE25E39784C3F1BC2906EDEF26C047F91CB4C6FAB7CC313
    Session-ID-ctx:
    Master-Key: FE88DF3710EE1DBE6A69F841178D9612C7FD24F3B693CBED4FAD0B3866E88DE728F90D8228DB2A3A909A80FA5CDE7F54
    Key-Arg   : None
    Start Time: 1206022615
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---

After that - you can get the data as wanted, b.e. GET / HTTP/1.0 with 2xENTER.

here are also options like -no_tls1 and -no_ssl2 that let you specify which version of SSL/TLS that you want to connect with. The -showcerts and -debug options are also very nice - especially if some issue exist with the certificate.  

Entered by smurphy on Thursday, 20 March 2008 @ 15:18:12  
Cryptography stuff - Common Linux problems, # Hits: 73654
spacer line
Question ? Firefox 3 beta and prefetch-next ?   [
View DetailsView details
|
Print ViewPrint view
]

 The Firefox release 3 has an issue many do not see as a security issue. It actually downloads into the cache the first entry in a Google search it finds.
The only possibility howe ver to disable this - is to go through the about:config and search for:

network.prefetch-next

and set it's value to false.

NOTE: The browser does not ask you to do it. It just does it ... 

Entered by smurphy on Tuesday, 27 May 2008 @ 09:03:42  
Ubuntu (Kubuntu,Ubuntu,Xubuntu) - Common Linux problems, # Hits: 72775
spacer line
Question ? How can I identify UUID on harddisk partitions ?   [
View DetailsView details
|
Print ViewPrint view
]

 In case you are repartitioning a drive - the UUID's (Universally Unique Identifier) get changed. This is more and more important as many devices today support hot-plugging or are external. You have several ways to identify the partitions. 2 of these are here. A simple way is the following:

$  ls -l /dev/disk/by-uuid/
 458b1af6-46e4-4980-8dab-ceaa2083459a -> ../../sda3
 6c80c066-08ad-4c22-9366-fe10ff8350e2 -> ../../sda2
 d18ad271-6831-4b83-980f-fe919ff65fd1 -> ../../sda1

will list you all UUID linked to the proper old known devices.
A call as Root of blkid will provide you the UUID of your harddisk.

$ sudo blkid
[sudo] password for jmertin:
/dev/sda1: LABEL="ROOT" UUID="d18ad271-6831-4b83-980f-fe919ff65fd1" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda2: TYPE="swap" UUID="6c80c066-08ad-4c22-9366-fe10ff8350e2"
/dev/sda3: UUID="458b1af6-46e4-4980-8dab-ceaa2083459a" SEC_TYPE="ext2" TYPE="ext3"

 

Entered by smurphy on Monday, 19 May 2008 @ 22:53:47  
Configuration - Common Linux problems, # Hits: 72707
spacer line
Question ? How can I do some network troubleshooting ?   [
View DetailsView details
|
Print ViewPrint view
]

 

  • TCPDump

    tcpdump -i [Network-Device] host [IP-Address]
    

    In case you want to filter more specifically, b.e. filter on host and protocol, use this

    tcpdump -i [Network-Device] -x 'ip host [hostname] and port http'
    

  • Ethereal
    Note that newer versions are called wireshark for the GUI Based tool, the CLI based tool is called tshark - replace were appropriate

    tethereal -i [Network-Device]
    

    If you want to limit on a specific IP-Address, b.e. your workstation IP, use the following

    tethereal -i [Network-Device]  -R ip.addr==[IP-Address]
    

    and if you have the webserver running on a different port as 80 - tell ethereal what tcp-port to interprete as http traffic with the following

    tethereal -i [Network-Device]  -d tcp.port==[Port-Nr],http -R ip.addr==[IP-Address]
    

    Another easy way to filter is:

    tethereal -i [Network-Device] host [host-IP] and port [Port-Nr.]
    

    If you want to dump the output to a file - append: -w output.dump to these strings - and you'll have all data dumped to these files - you can later read/open with ethereal for analisys.

  • IPtraf - provides you an easy way to identify non clean traffic. This means, even if tethereal and tcpdump show you some data, iptraf will not show you a packet count increase in case the data is valid, e.g. a wrong setup VLAN (Unidirectional traffic, missing parts of the tcp/ip traffic messages etc.

  • In case you have https-traffic to monitor - you can use ssldump to have a look at the traffic. this troubleshooting method is also very keen in case you see loads of ssl-decode errors. Try out the following:

    ssldump -ni eth1 -d -k [pem-key] host [host-ip]
    

  • A very keen solution is to also tunnel the traffic from your workstation into an internal machine - to have a specific IP-Address to filter through the advanced recorder. This can be reached by using ssh in tunnel mode from your local machine (note that you'll need a local cli-based ssh solution on the workstation you are working from:

    ssh -L [client-IP]:[client-Port]:[remote-IP]:[remote-port]
    

    once done - connect to the application by using http://localhost[client-port]

 

Entered by smurphy on Tuesday, 21 October 2008 @ 09:43:36  
Linux General - Common Linux problems, # Hits: 71744
spacer line
Question ? Are there ways to check certificate purposes ?   [
View DetailsView details
|
Print ViewPrint view
]

 There are indeed using openssl:

openssl x509 -in cacert.pem -noout -purpose -subject

will return you an entire bunch of capabilities your certificate works with.


openssl x509 -in cert.pem -noout -purpose -subject
Certificate purposes:
SSL client : Yes
SSL client CA : Yes
SSL server : Yes
SSL server CA : Yes
Netscape SSL server : Yes
Netscape SSL server CA : Yes
S/MIME signing : Yes
S/MIME signing CA : Yes
S/MIME encryption : Yes
S/MIME encryption CA : Yes
CRL signing : Yes
CRL signing CA : Yes
Any Purpose : Yes
Any Purpose CA : Yes
OCSP helper : Yes
OCSP helper CA : Yes
subject= /C=DE/ST=Bayern/L=City/O=OrganizationOU=Home/CN=xxxxxxx.xxxxxxx.xxx/emailAddress=xxxxxxx@xxxxxxxxx.xxx

 

Entered by smurphy on Friday, 14 November 2008 @ 16:15:21  
Cryptography stuff - Common Linux problems, # Hits: 71629
spacer line
Question ? How can I Identify a System using DMI data ?   [
View DetailsView details
|
Print ViewPrint view
]

 Use the dmidecode programm. Without arguments, it will dump loads of data. To limit it - try this:

~$ sudo dmidecode -s system-manufacturer
LENOVO
~$ sudo dmidecode -s system-product-name
64585KG
~$ sudo dmidecode -s system-version
ThinkPad T61p

 

Entered by smurphy on Monday, 19 January 2009 @ 20:48:46  
Configuration - Common Linux problems, # Hits: 70329
spacer line
Question ? Can I resize (grow) a NTFS Partition under Linux ?   [
View DetailsView details
|
Print ViewPrint view
]

 It's quite easy to do so. You just require fdisk and ntfsresize (Check your software repositories to have both installed. fdisk usually is).

With fdisk -l /dev/sda you can make a backup of start/end points of your actual setup. As long as you don't format the partitions - all is safe. Example output would be

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20482843+   7  HPFS/NTFS
/dev/sda2            2551        7415    39078112+  af  Unknown
/dev/sda3            7416       10000    20764012+  83  Linux
/dev/sda4           10001       24321   115033432+   5  Extended
/dev/sda5           10001       10262     2104452   82  Linux swap / Solaris
/dev/sda6           10263       13041    22322286   83  Linux
/dev/sda7           13042       19121    48837568+  83  Linux
/dev/sda8           19122       24321    41768968+  83  Linux

In this case - delete partition 2 - and replace the end boundary of partition 1:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550      39078112+ 7  HPFS/NTFS

After that - just run ntfsresize with:

ntfsresize /dev/sda1

It will automatically adapt the ntfs journal and size informations to the new size and schedule a filesystem check for the next Windows XP Start.
Windows - after starting up - will want to restart as it has discovered new hardware (the bigger disk). After that restart - you're done.  

Entered by smurphy on Thursday, 19 March 2009 @ 10:23:06  
Configuration - Common Linux problems, # Hits: 70210
spacer line
Question ? How to reinstall grub from a rescue mode ?   [
View DetailsView details
|
Print ViewPrint view
]

 Boot into a ubuntu "try" mode or whatever linux system that provides you the possibility to manipulate the harddisk.
You first need to prepare the environment

root@ubuntu:~# mkdir /sda
root@ubuntu:~# mount /dev/sda3 /sda    # this is the / of the existing system
root@ubuntu:~# mount -o bind /dev /sda/dev
root@ubuntu:~# mount -o bind /proc /sda/proc
root@ubuntu:~# chroot /sda /bin/bash
[root@ubuntu /]# mount /dev/sda1 /boot

Then - Install GRUB

[root@ubuntu /]# grub

    GNU GRUB  version 0.95  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]

grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded.
succeeded
 Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.conf"
 \ ... succeeded
Done.

grub>quit
[root@ubuntu /]#

After that - undo whatever you have done in reverse order

[root@ubuntu /]# umount /boot
[root@ubuntu /]# exit
root@ubuntu:~# umount /sda/proc
root@ubuntu:~# umount /sda/dev
root@ubuntu:~# umount /dev/sda3

If you reboot - you should see a grub prompt as usual. 

Entered by smurphy on Friday, 15 October 2010 @ 11:25:36  
Linux General - Common Linux problems, # Hits: 64660

Next  How can I boot from the SATA drive 2 of a Software Raid-1 System ? 
spacer line
Question ? How can I mount a SMB share under linux ?   [
View DetailsView details
|
Print ViewPrint view
]

 Sometimes, on old systems, we need to mount a samba-share.
Create a file: /etc/cifs.pwd with

~#touch /etc/cifs.pwd
~#chmod 600 /etc/cifs.pwd

And add in that file the login/password file. Content Format is very simple - as follow:

username=smbuser
password=smbpassword

Password/username is in cleartext !

After that - you can mount the share as root with:

~#mount -t smbfs -o credentials=/etc/cifs.pwd  //REMHOSTIP/remotedir /localdir

In this example, /remotedir is the remote Directory/Share and /localdir is the local Directory you mount it in on your local file system. This localdir needs to exist on you local machine.

Example:
Assume the Samba Host is: 192.168.101.56
Remote Share is: /smbtmp
Local mount Directory is: /mnt/smbtmp

We would have:

~#mount -t smbfs -o credentials=/etc/cifs.pwd //192.168.101.56/smbtmp /smb/smbtmp

To make it easy - you add the data to the /etc/fstab file.

//192.168.101.56/smbtmp /mnt/smbtmp smbfs credentials=/etc/cifs.pwd

With this, a simple: "~#mount /mnt/smbtmp" is be enough to mount the samba share.  

Entered by smurphy on Tuesday, 16 November 2010 @ 11:08:52  
Linux General - Common Linux problems, # Hits: 64338
spacer line
Question ? Dual Pairing bluetooth keyboard under Linux and OS-X ?   [
View DetailsView details
|
Print ViewPrint view
]

 as I do have a mac-mini in tripple boot configuration, I wondered how to get my bluetooth keyboard to work using all operating systems at the same time. For windows, many howto's have been written out there (google). For linux though, emptines is what you get. So - it took me a long time to understand how it works and find a way to get it to work. In fact, the entire trick consists in reading the plist file on the mac-side, and decode it so that the linux side can read it too.

We will first need to find the blued.plist file on the Mac OS-X filesystem you have previously mounted under linux. Get it from
[MountPoint-OS-X-System]/private/var/root/Library/Preferences/blued.plist. Download the attached file plutil.pl into the same directory, and execute it under linux OS.

~# ./plutil.pl blued.plist 
plutil.pl v1.5

Old: blued.plist, from: binary, to: text
Found .plist
TryName: blued.text.plist
TryName: blued.text.plist
BinaryToXML:
Offsets are 1 bytes
Object Refs are 1 bytes
There are 9 objects in the file
The top object is at 0
The Offset Table is at offset 126

Int Lengths = 10
Misc Lengths = 37
String Lengths = 63
Unique Strings = 4
oVal=37755725973e42848271a0bf2743e00d
buf=
N3VXJZc+QoSCcaC/J0PgDQ==
oVal=b8767b7d6422049a32ce75b4ab6c4e33
buf=
uHZ7fWQiBJoyznW0q2xOMw==

In the same directory you will find now a file blued.text.plist. It has all required information we need for further processing.
All you need to do now is to identiy the keyboard.
I did find (code modified):

 (key)58-b0-35-81-28-6e(/key)
                (dict)
                        (key)00-1f-20-05-0a-2c(/key)
                        (data)
                        N3VXJZc+QoSCcaC/J0PgDQ==
                        (/data)
                        (key)00-1f-20-07-38-e4(/key)
                        (data)
                        uHZ7fWQiBJoyznW0q2xOMw==
                        (/data)
                (/dict)


For that, hit the Connect button on the keyboard and make sure it's in discoverable mode.

~$ hcitool scan
Scanning ...
        00:1F:20:05:0A:2C    Logitech MX5500 Keyboard

that's it. Look up the keyboard MAC Address (here 00:1F:20:05:0A:2C) in the bluez.text.plist file, and use the assigned (data) value to convert.
Convert it with:

~# echo -n "N3VXJZc+QoSCcaC/J0PgDQ==" | base64 -d | hexdump -C
00000000  37 75 57 25 97 3e 42 84  82 71 a0 bf 27 43 e0 0d  |7uW%.>B..q..'C..|
00000010

and you're done.
All you have to do now is to put that HEX Value into the linkkeys file. On an ubuntu 11.10 it is /var/lib/bluetooth/58:B0:35:81:28:6E/linkkeys. Just replace the value after the correct identifier:

00:1F:20:07:38:E4 B8767B7D6422049A32CE75B4AB6C4E33 0 4
00:1F:20:05:0A:2C 37755725973E42848271A0BF2743E00D 0 8

you're done.
NOTE that you see it also in the Oval output of the plutil.pl, however you still don't know which device it belongs to.

BTW - in case you need to access the keyboard in a kind of emergency, just putting the keyboard in discoverable mode and hit:

~$ sudo hidd --connect 00:1F:20:05:0A:2C

you can access it without key. 

Entered by smurphy on Friday, 23 December 2011 @ 10:31:24  
Linux on Apple Hardware - Common Linux problems, # Hits: 58096

Attach   plutil.pl  [ 23,196 bytes - application/x-perl ]
spacer line
Question ? Is there a way to migrate playcount data from amarok to xbmc ?   [
View DetailsView details
|
Print ViewPrint view
]

 It is indeed possible to do this. However - the following will be required:

  • XBMC must use the MySQL database setup
  • Amarok must use the same Mysql DB xbmc is using
  • the xbmc user has SELECT rights to the amarokdb.
  • On the amarokdb - we have to crate a new view
  • You are using the same media repository on both sides, means both amarok and xbmc will read the mp3 tags out of the same files.

If these requirements are met - migrating the data over from Amarok to xbmc is possible.

Note - the following examples are working on Amarok 2.7.0 and xbmc 12 (Frodo).
Modifications to be done on the XBMC DB. Here MyMusic32.

# View showing the real data
CREATE ALGORITHM=UNDEFINED VIEW `XTAPCount` AS select `song`.`idSong` AS 
`Xid`,`song`.`strTitle` AS `XSTitle`,`album`.`strArtists` AS 
`XARTName`,`album`.`strAlbum` AS `XALBName`,`song`.`iTimesPlayed` AS 
`XPlaycount` from (`song` join `album`) where (`song`.`idAlbum` = 
`album`.`idAlbum`);

We will need an intermediate table to store the local and remote playcounts.

CREATE TABLE IF NOT EXISTS `XTAPCount_last` (
  `LXid` int(11) NOT NULL,
  `LXSTitle` varchar(512) NOT NULL,
  `LXARTName` varchar(512) NOT NULL,
  `LXALBName` varchar(512) NOT NULL,
  `LXPlaycount` int(11) NOT NULL,
  `LXpcdiff` int(11) NOT NULL,
  PRIMARY KEY (`LXid`),
  KEY `LXSTitle` (`LXSTitle`(333)),
  KEY `LXARTName` (`LXARTName`(333)),
  KEY `LXALBName` (`LXALBName`(333))
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table to keep the playcount differences.';

The next view will actually show the differences in playcounts.

# View to show the differences in playcounts.
CREATE OR REPLACE 
ALGORITHM = UNDEFINED
VIEW `XTAPCount_last_diff` AS 
SELECT Xid, XSTitle, XARTName, XALBName, XPlaycount, LXPlaycount, (
XPlaycount - LXPlaycount
) AS XDiff
FROM XTAPCount_last, XTAPCount
WHERE Xid = LXid
AND (
XPlaycount NOT LXPlaycount
);

Let's insert the data for the first time. We take the values as they are

insert INTO XTAPCount_last(LXid, LXSTitle, LXARTName, LXALBName, LXPlaycount )
 SELECT Xid,XSTitle,XARTName,XALBName,XPlaycount from XTAPCount;

Update the LXPlaycount (This is the initial run).

UPDATE XTAPCount_last SET LXpcdiff=LXPlaycount;

Let's prepare the same for the Amarok side.

# View showing the real data
CREATE ALGORITHM=UNDEFINED VIEW `ATAPCount` AS select distinct `tracks`.`id` 
AS `Aid`,`tracks`.`title` AS `ASTitle`,`artists`.`name` AS 
`AARTName`,`albums`.`name` AS `AALBName`,`statistics`.`playcount` AS 
`APlaycount` from (((`tracks` join `statistics`) join `artists`) join `albums`) 
where ((`tracks`.`id` = `statistics`.`id`) and (`artists`.`id` = 
`tracks`.`artist`) and (`tracks`.`album` = `albums`.`id`)) order by 
`statistics`.`playcount` desc;

Intermediate Table - where we will store local and remote (here) XBMC Playcount.

CREATE TABLE IF NOT EXISTS `ATAPCount_last` (
  `LAid` int(11) NOT NULL,
  `LASTitle` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Song Title',
  `LAARTName` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Artist name',
  `LAABName` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Artist Name',
  `LAPlaycount` int(11) NOT NULL COMMENT 'Playcount',
  `LApcdiff` int(11) NOT NULL COMMENT 'Playcount difference to last time',
  PRIMARY KEY (`LAid`),
  KEY `LASTitle` (`LASTitle`(333)),
  KEY `LAARTName` (`LAARTName`(333)),
  KEY `LAABName` (`LAABName`(333))
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table containing last play state.';

LAst but not least, the View to show the differences in playcounts.

CREATE OR REPLACE 
ALGORITHM = UNDEFINED
VIEW `ATAPCount_last_diff` AS 
SELECT Aid, ASTitle, AARTName, AALBName, APlaycount, LAPlaycount, (
APlaycount - LAPlaycount
) AS ADiff
FROM ATAPCount_last, ATAPCount
WHERE Aid = LAid
AND (
APlaycount  LAPlaycount
);

Make the Initial data dump

INSERT INTO ATAPCount_last(LAid, LASTitle, LAARTName, LAABName, LAplaycount ) 
SELECT Aid,ASTitle,AARTName,AALBName,APlaycount from ATAPCount;

And put the playcount into the temporary Field LApcdiff (Amarok DB only here).

UPDATE ATAPCount_last SET LApcdiff=LAPlaycount;

Now comes the Sync Process. Depending on the number of lines you have in there, it may take some time. With 12K Songs - it takes around 12 Minutes for my DB's to sync.
Sync the Data Amarok -> XBMC

UPDATE MyMusic32.XTAPCount,ATAPCount_last_diff SET 
MyMusic32.XTAPCount.XPlaycount=(MyMusic32.XTAPCount.XPlaycount + 
ATAPCount_last_diff.ADiff) WHERE ASTitle=XSTitle AND AARTName=XARTName AND 
AALBName=XALBName and ADIff > 0;

Once this is done - set the current state with:

UPDATE ATAPCount_last,ATAPCount set LAPlaycount=Aplaycount WHERE LAid=Aid;

Put the playcount into the temporary Field LApcdiff (Amarok DB only here).

UPDATE ATAPCount_last SET LApcdiff=LAPlaycount;

Sync the Data XBMC -> Amarok

UPDATE amarokdb.ATAPCount, XATAPCount_last_diff SET 
amarokdb.ATAPCount.APlaycount=(amarokdb.ATAPCount.APlaycount + 
XATAPCount_last_diff.XDiff) WHERE ASTitle=XSTitle AND AARTName=XARTName AND 
AALBName=XALBName and XDiff > 0;

You're done. 

Entered by smurphy on Sunday, 10 March 2013 @ 16:35:17  
Nothing Specific - Common Linux problems, # Hits: 41454
 
Problems to  admin(-AT-)solsys(-DOT-)org  - best viewed @ 1920bpp
This site is powered by phpPhobos v2.0b432
© J. Mertin smurphy(-AT-)solsys(-DOT-)org 
Icons - Copyright Breeze artists GPL 2+