Tuesday, November 25, 2008

Awesome bubble bobble clone, bubbros

I just came across a fantastic little game, if you loved bubble bobble back in the day!. Bub Bros is a multiplayer, network clone of Bubble Bobble with updated graphics and runs on Linux. After finding a Fedora package for it, I tweaked the spec file, so it would compile on Mandriva and gave it a go. It’s easy to get working, has one of the best game server interfaces (a web interface) for setting the server and client properties, and supports multiple types of clients (java, X, pygame, py-gtk). Screen shots and (s)rpms, if you want to try it.

Client
bubbros-game

Main server page
bubbros-server

Server settings
bubbros-server-config

Sunday, September 07, 2008

Neo FreeRunner

I received my openmoko Neo FreeRunner on Friday.   It’s a neat Linux phone that is much more open than usual. I’ve logged into it as root, and are installing some updates.  I’ve had a quick poke around, and feel really at home, ssh’ed in to my phone, poking around in /proc and /sys, it’s Linux 2.6.24, and to configure the main phone application, you make dbus calls.

So, this week I’ll be learning about the Neo and possibly upgrading it to a newer release from the factory default.

Today, I also spent quite a lot of time working with my Arduino, building a circuit that controls a relay to drive a pump, based on 5 different water temperatures.   The pump heats the floor, but only when the is more hot water in the tank than we want.

Thursday, September 04, 2008

Bluetooth GPRS with Mandriva 2008.1

Well, took me a little while to writing up about how to get Bluetooth GPRS working with Mandriva 2008.1, although I did actually get it working only a couple of days after getting it working on the Eee PC with Xandros.

First thing I’ve discovered with Mandriva 2008.1, is that it does in fact have quite a nice wizard to get bluetooth dial up networking going. You go to the Mandriva control panel, choose Setup a new network interface, and select “Bluetooth dial up networking”. Then wait. In the background, it’s running:

sdptool search "DUN"

and then,

hcitool name [mac address]

However, I discovered this does not always work. I’ve been working in Vodafone recently, where there are around 15 bluetooth devices visible. sdptool search did not find my phone, although “hcitool scan” showed up my phone just fine, and sdptool browse [mac address] shows my phone has DUN.

So, I’ll be logging a bug/patch to suggest /usr/lib/libDrakX/network/connection/cellular_bluetooth.pm be changed, to use hcitool scan, then, after the use has selected their device, check that it supports DUN.

Next, the wizard prompts for my provider information. Vodafone, New Zealand, is not in the list, so I manually enter, www.vodafone.co.nz as the access point name (APN). No username or password are needed, as the billing is tied to your phone account.

I choose to start the connection, the wizard says it worked. Except it didn’t. One of the reasons for this is, that it fails to bond to my phone. However, /etc/bluetooth/rfcomm.conf is correct, and it does create the appropriate chat-ppp0 and ifcfg-ppp0 files in /etc/sysconfig/network-scripts. It does not however, enable the bluetooth service, which needs to be on for this to work.

The is two issues here. First, my phone already has a bonded connection with my bluetooth adapter, as I used the same adapter on a different laptop, so that’s easy, just delete the device from my phone.

Now, before you can use Dial up networking, you need to get the laptop to bond with the phone, and this can be much more difficult that expected.

Mandriva 2008.0 used to use a system to prompt for a pin, called bluez-pin. This package is available for Mandriva 2008, but not 2008.1. It was removed, as it’s not needed by the KDE bluetooth tools, but, the dial up networking stuff still tries to use it, to prompt for a pin, (I think), as bluez-pin provides /bin/bluepin.

However, I’ve found a work around for this. Start kbluetooth, and browse to your phone’s file transfer. Your phone will prompt you for a pin. Enter a random pin. Then, you kbluetooth will ask you for the same pin you just entered into your phone. If all goes well, your phone will then ask you to allow file transfer.

Browing bluetooth devices, launched from kbluetooth

Pairing with a phone

Now, check you have paired with your phone successfully. This is critical for getting dial up working. You should see it as paired in Paided/Trusted Deices, and in your phone, it should show the name of your laptop, and that it’s currently paired with it..

Example trusted devices.

It does not seem to have to have “Trust this device” ticked, as it can be configured to ask every time your laptop wants to use the phones internet connection.

Next, check a few command line options

[nelg@laptop ~]$ rfcomm
rfcomm0: 00:1A:75:A5:54:C8 channel 7 clean

Then try to bring up the interface, from the command line.

[nelg@laptop ~]$ /sbin/ifup ppp0

This can take a few seconds. All going well, your phone should ask you if you wish to allow your laptop to use it’s internet connection, then the connection should be established.

[nelg@laptop ~]$ /sbin/ifconfig ppp0
ppp0      Link encap:Point-to-Point Protocol
          inet addr:121.90.73.67  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1

You can close the connection from net_applet, but you can’t start it from the applet.

Notes:

  • Phone’s are stupid. Sometimes, turning it off, taking the battery out, then starting it agian helps
  • It’s sometimes hard to restart the bluetooth service, as it does not want to unload modules. rfcomm release rfcomm0, rmmod hidp, rmmod l2cap and rmmod hidp
  • Don’t run the mandriva wizard more than once, or you will end up with rfcomm1,.. etc etc.
  • Deleting the contents of /var/lib/bluetooth/ can make bluetooth forget stuff if you need it to forget stuff.
  • if /sbin/ifup ppp0 fails, with an error like “Device ppp0: The serial port could not be (opened|locked)”, then try again.  I think that the is some slowness in the phone being ready to do DUN, which can cause this.

Thursday, August 28, 2008

Getting X-wrt working on a Linksys WRT54GL

To install X-wrt, it requires OpenWrt to be installed first. I installed OpenWrt white russian, as it seems that X-wrt is still under development for Kamikaze. I followed instructions on their site, downloading the correct firmware and uploading it to my router. Much to my surprise, it didn’t loose any of the settings I had set in my router, including it’s IP address.

Then, to get X-wrt working, was a bit more of a challenge. The recommended way to install it does not work, as it says to go to an auto install page on the X-wrt website, which seems to no longer exist.

So, I tried the command line way, which is supposed to be:

ipkg install http://ftp.berlios.de/pub/xwrt/webif_latest_stable.ipk

However, this will fail, as it depends on some packages not in the available software list.

The solution to this is to add the following to /etc/ipkg.conf

src xwrt ftp://ftp.berlios.de/pub/xwrt/packages

Then run ipkg update. After doing this, the first command to install X-wrt worked ok for me.

X-wrt seems to have more features than the default linksys firmware, and a much easier way to administer it, so I am so far, fairly happy with it.

Tuesday, August 12, 2008

Today my bluetooth adapter turned up today, after ordering it from trademe. With much anticipation, I plugged in into my Mandriva 2008.1 laptop, and after installing the bluetooth tools and kbluetooth, could see other computers and

phones, and connected to my phone by obex and downloaded the photo’s from it. However, what I purchased it for was to use the internet over my phone, via GPRS. I first tried this on my Eee PC, as that’s the first computer I wanted to use it with. I friend at work had got it going a few days ago, so I figured it can’t be too hard.. although it did take him quite some time.

Tonight must have been my lucky night, because I ended up fixing my sisters Eee PC, and while I was looking around, bumped into a script from 3eportal for the Eee PC that automatically configure it for GPRS. It consisted of a deb, which didn’t work. But, it worked enough, that I could make it work. It put an icon on the desktop, and ran a config script. The script had some issues, as it didn’t actually work in places, but I could see what it was trying to do. What it did was startup bluetooth, find my phone, ask me for a passkey for pairing, then configure /etc/bluetooth/hcid.conf and /etc/bluetooth/rfcomm.conf. It then asked for an APN and configured a GPRS dialup script that came with it. It asked me to pair my phone with the laptop, and tried to add the services to be started, in the Eee PC’s /usr/sbin/services.sh script.

The item it added on the menu was a simple toggle icon, that would run pon 3egprs or, if it was running, would run poff 3egprs. It also added the config script to the menu, which is not that brilliant, because if you run the config script again, it makes the same changes twice to some files, which will cause breakage. If I get time, I’ll submit a patch for it.

After getting this all configured, it worked! I was pretty surprised, but it just started working very well. The tricky bit was getting my phone to bond with the laptop, which I found was just me not driving the phone correctly.

Tomorrows task. Make it work with Mandriva.. which should be easy now I know what files to edit. Does anyone know of an automatic script to configure GPRS over bluetooth with Mandriva? Maybe I should port this deb to an RPM.

UPDATE: I've found the Mandriva way, via drakconnect, and it works.. with some effort.. next post will cover what I found. Thanks for the comments.

Monday, August 11, 2008

Mandriva 2009 Beta 2 - KDE 4.1 thoughts and comments

I recently downloaded the Mandriva 2009.0 beta 2 KDE 4.1 live cd.

I kept of list of things I found as I had a look around it.  I only focused on the desktop.

  • Cacert.org certificate not installed on live CD :(
  • Konquror missing
  • Seems to have a beta Nvidia driver. Worked fine.
  • 3D performance was mixed, with it not feeling as smooth as compiz fusion with KDE 3.5 does.
  • Same old compiz oddities, like resizing a window when wobbly windows turned on is slow / does not redraw as it’s being resized.
  • Firefox and Firefox 3 both on live CD, except, on menu, one shows as “Mozilla firefox” and one as “Firefox web browser”. It would be better to have the version number to tell the difference
  • KDE4 compositing working. I selected compiz on startup, but it seems to be ignored.
  • Firefox theme ugly. This really looks bad with KDE4 looking so good. I suggest that Mandriva consider installing the “kde4″ firefox theme by default, this fits the look and feel of KDE better.
  • The La ora theme not on live CD, this is a pity, as the default KDE window theme, is ok, but not that nice. It can be made a lot nicer, by turning off the “Show stripes next to title”. although maybe this is just me complaining. Getting the title bar colours to be anything other than fairly boring seems to be a bit of a trick, but possible with some playing around.
  • System settings not on the menu, only available from “Favorites” on the menu.
  • No power management applet on in KDE
  • Excellent wifi support, Wifi LED started to work, plus without any configuration, wifi just worked when I accessed the network center.
  • Dolphin not my preferred tool.. So I’ll be sticking with Konqurer, however, I notice that dolphin can display icons like I prefer, what used to be called multicolumn in konqurer.
  • Run command interface is nice: Noteworthy shortcuts. Ctrl - F12 to show dashboard, and Ctrl - Esc to show system activity. Also of course, the alt-f2 which is greatly improved krunner.
  • sftp kio slave works well. Excellent
  • man kio slave displayes manuals, but tried to open in firefox.
  • fish kio slave crashed dolphin, but worked on second attempt..
  • “Up” icon missing in dolphin
  • Ogg not associated with amarok.
  • Both the “Programs” and “Applications” kioslave’s do not show applications at second level.
  • Desktop plasmoid “picture frame” does not support kio slaves. :(

Now, enough of the bullets, and a visual tour.

Window shading was disabled on live cd, in favor of the classic windows behavior of maximizing the window. I think shading is nicer.
The new kicker start bar is interesting, but I am concerned that many users won’t figure out how to resize it. It can be resized wider by dragging the green and blue sliders, once the edit button for the toolbar has been opened. It can also be made taller, by dragging, but at the top of the edit tool bar, rather than the expected, top of the toolbar.
Single click opens folders and files by default I really find this hard, and kept opening stuff by accident. So, personally think the default should be double click. For a start, didn’t even realize that was the cause of the weirdness.
The System Settings for KDE are only available by looking under favorites, This is pretty strange, as I would expect them to be under tools.
The is a nice range of colours available for KDE 4.1, including some quite nice darker colour schemes. I found these quite nice, although do think that attention needs to be kept when picking colours and looks for applications like firefox to look alright as well.
For those that rather like Konquror, like myself.. it can be installed, even with the live CD, which is really quite cool, being able to install stuff into ram. Konquror is no longer the same beast that it was. It appears to use the same display components as dolphin for file layout. So, some of the trusty views I use are not available any more. So, installing Konquror, is konquror, but not really the same. It also still can render HTML, which is nice. I would actually use Konquror as my main browser, if it supported firefox plugins. Without the plugins, it’s not really the browser firefox is.
In Dolphin, the new file manager, to get the text beside the icons, i.e. multicolumn view, the grid layout can be changed to “Left to Right”. this suddenly makes it look like multilcolumn view in kde 3.5. Not critical, but nice.
Another thing I noticed, being that I run at 1920×1200, is that the icon preview size is too small, even on it’s largest setting. This is a little bit of a pity, as I am sure that it could be made to go even larger.
Here, dolphin is showing “Places” on the left, which include my partitions, plus a tab of “Folders”. Now, what I noticed with this is that these are panels that can be turned off and on. However, if the user clicks the X, to turn them off, they are almost gone for good, unless you hunt for them in the menu. I think these should have an icon on the tool bar to get them back. Of the right is the “Information” panel, which has a nice new feature, where you can write notes about files. This is all cool, until you copy the file over the network to another computer, and the note does not seem to come too.

“Up” icon missing in dolphin.  I added this back in, as it’s one of the most useful things.

KDE4.1 includes a bunch of the desktop effects that Compiz is famous for. These seem a little bit unfinished at the moment. Many of them lack much options at all, and some of them don’t seem to work at all. Others work, but don’t make it clear how to get them to work unless you hunt around for the special key. However, it is nice integration into KDE. Also of note, probably mostly for Mandriva to sort out, is that Compiz fusion is also available, however, does not seem to do anything at all when you use ccsm to change it’s settings, the KDE4.1 options seem to be the ones that the window manager is looking at.
Folderview, which is a neat feature of KDE4.1, which can display a folder on the desktop in a nice looking window is great. except, I would like to see better support for displaying previews of files, and when the possible option of opening a directory within folder view, rather than opening dolphin. Wouldn’t it be neat if you open the documents folder, if it stays open for say 30 seconds, and then, if the is no activity, goes back to the folder above.

Also on show in this screenshot is the ability to put application start links on the desktop at any size, which will be good for some people,

The default firefox theme looks awful with KDE4.1 smooth graphics and nice greys. A quick search on the theme’s site for firefox found this them, which is designed for kde4. I think Mandriva should look at including this, or something like this as the default theme to make Mandriva 2009 look stunning.

Another comment about firefox2 and fiefox3. If they are both of the menu, name them with a version number. Ideally, just have Firefox 3.

Monday, August 04, 2008

Word press plugin: blogger.com publisher released

I wrote over the last couple of days, a word press plugin to publish items to blogger.com. I’ve release this now, version 0.1, available at http://www.linuxsolutions.co.nz/gdatablogger/

It’s still 0.1 because

  • No validation of inputs in admin menu
  • No error handling
  • No nice GUI to pick tags and categories

But, it now actually does everything I want it to do, so I’ve scratched my itch, and will only build these features if I get feedback from the community that they want them., or I find myself with spare time.

Hauppauge WinTV-HVR900 on Mandriva Linux 2008.1

On the second attempt to get my HVR900 working with Mandriva 2008.1, I’ve had success, and can now watch Freeview HD*, terrestrial on my laptop.

I have had success after some help from Steven Ellis, who knows a lot about these things, and has done a lot of the hard work of getting Freeview HD, for Linux in NZ working. The steps for Mandriva 2008.1 is actually a lot easier than the instructions for Ubuntu, as it didn’t require anything very fancy to be done with the kernel, I was able to compile the HVR900 drivers (em28xx-new) against the Mandriva laptop kernel, after downloading kernel-source-2.6.24.5-2mnb-1-1mnb1 rpm and creating a symlink in /lib/modules/2.6.24.5-laptop-2mnb to the source.

The only tricky bit was extracting the correct firmware, which required me to install a different kernel source, purely to get a perl script out of it, as it was not in the default Mandriva kernel source, although will be in future versions by the looks of things.

Steps taken

  1. Install latest tmb source: urpmi kernel-tmb-source-latest-2.6.24.7-4mdv2008.1. This includes /usr/src/2.6.24.7-tmb-4mdv/Documentation/video4linux/extract_xc3028.pl which is needed.
  2. Extract the firmware, following instructions from: http://www.linuxtv.org/wiki/index.php/Xceive_XC3028/XC2028
    1. wget http://www.steventoth.net/linux/xc5000/HVR-12×0-14×0-17×0_1_25_25271_WHQL.zip
    2. unzip -j HVR-12×0-14×0-17×0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys
    3. perl /usr/src/2.6.24.7-tmb-4mdv/Documentation/video4linux/extract_xc3028.pl
    4. cp xc3028-v27.fw /lib/firmware
  3. Download kernel source: urpmi kernel-source-latest-2.6.24.5-2mnb1
  4. Create a link: /lib/modules/2.6.24.5-laptop-2mnb/source -> /usr/src/linux-2.6.24.5-2mnb/
  5. Download driver source: hg clone http://mcentral.de/hg/~mrec/em28xx-new (urpmi mercurial first)
  6. Compile with ./build.sh in em28xx-new. Add yourself to the video group.
  7. Download and compile mplayer svn: (http://www.mythtv.co.nz/mythtv/digital-tv/dtt-debugging/ step 1). I recommend installing it in /usr/local/bin, so you can continue to use your normal mplayer.
  8. download NZ channels file, http://www.mythtv.co.nz/mythtv/digital-tv/dtt-debugging/dtt/channels.conf
  9. Edit channels file.  TV ONE in this file is no longer right.  It needs the audio to be changed from 401 to 300.  (second to last field).
  10. find good reception = watch TV.
  11. add some nice icons to launch mplayer.

The mplayer command I use to play tv is:

/usr/local/bin/mplayer -lavdopts fast:threads=2 -vf pp=fd -mc 2 -framedrop  -fs dvb://"TV ONE"

Screenshots.. (showing off!)

TV one, paused for screenshot

TV one, with compiz desktop rotation

Startup Icons

Notes

1080i still does not work well, sometimes not opening at all before mplayer crashes, sometimes opening and playing for a few seconds before crashing or looking bad. I am hoping that if I stick with mplayer svn, soon this issue will be fixed.

Recording with mplayer is quite easy.. I use the following command.

/usr/local/bin/mplayer -dumpstream -dumpfile tv1.ts dvb://"TV ONE"

Threading

I’ve noticed that even when I tell mplayer to use threads, I seem to only get load on 1 CPU at a time, it keeps jumping between cpu’s, but never do I get both CPU’s at 100%, only about 50%. I think maybe mplayer is not running on multiple threads, even with the -lavdopts fast:threads=2 option. I’ve tried -lavdopts fast:threads=4 and it seems a little better, but still does not really use both cpu’s 100%

Resources

http://www.mythtv.co.nz/mythtv/digital-tv/dtt-debugging/ - excellent information on getting this going

http://www.mythtv.co.nz/mythtv/digital-tv/ - good NZ specific information

http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-900 - HVR-900 information

Thanks to Steven Ellis for his excellent documentation.

Hardware details

I have been testing this on a dual core dell inspiron 9400 laptop with a GeForce Go 7900 GS, 256MB video card, nvidia driver version 169.12. The operating system is Mandriva 2008.1 64 bit, with Compiz fusion and KDE running.

The HVR900 I have shows up as:

Bus 001 Device 003: ID 2040:6502 Hauppauge
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               2.00
bDeviceClass            0 (Defined at Interface level)
bDeviceSubClass         0
bDeviceProtocol         0
bMaxPacketSize0        64
idVendor           0x2040 Hauppauge
idProduct          0x6502
bcdDevice            1.10
iManufacturer           0
iProduct                1 WinTV HVR-900

– CUT –

Dmesg:

usb 1-6: new high speed USB device using ehci_hcd and address 3
usb 1-6: configuration #1 chosen from 1 choice
Linux video capture interface: v2.00
em28xx v4l2 driver version 0.0.1 loaded
em28xx new video device (2040:6502): interface 0, class 255
em28xx: device is attached to a USB 2.0 bus
em28xx #0: Alternate settings: 8
em28xx #0: Alternate setting 0, max size= 0
em28xx #0: Alternate setting 1, max size= 0
em28xx #0: Alternate setting 2, max size= 1448
em28xx #0: Alternate setting 3, max size= 2048
em28xx #0: Alternate setting 4, max size= 2304
em28xx #0: Alternate setting 5, max size= 2580
em28xx #0: Alternate setting 6, max size= 2892
em28xx #0: Alternate setting 7, max size= 3072
attach_inform: tvp5150 detected.
tvp5150 4-005c: tvp5150am1 detected.
successfully attached tuner
em28xx #0: V4L2 VBI device registered as /dev/vbi0
em28xx #0: V4L2 device registered as /dev/video0
input: em2880/em2870 remote control as /class/input/input9
em28xx-input.c: remote control handler attached
em28xx #0: Found Hauppauge WinTV HVR (B2C0)
usbcore: registered new interface driver em28xx
em28xx-audio.c: probing for em28x1 non standard usbaudio
em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
Em28xx: Initialized (Em28xx Audio Extension) extension
tvp5150 4-005c: tvp5150am1 detected.

* 576i and 720p work, 1080i still has issues.

Sunday, August 03, 2008

Testing admin for wp plugin

Just building the admin section for my word press plugin. It loads and stores values in the word press options tables.

Only thing left to do is to make it GPL, and make the tag/category selection nicer.

Saturday, August 02, 2008

Wordpress replication plugin

I have been creating a plugin for word press, that can publish certain posts to eblogger, using the gdata api. It now supports setting the published date, title, and content, formatted in HTML.

I’ve been quite pleased with it, and will be releasing it under GPL, fairly soon. I just need to build the page for changing it’s settings, which is quite simple, as it only needs the users username, password and blog id, plus a list of the categories and tags to publish.

A future feature, could loop over old posts and post them also, if they meet the criteria, but I don’t really feel it’s worth spending much time on yet.

Oh, and some of the times on older posts will be wrong, Had to setup a timezone offset, so that it got it right.

Friday, August 01, 2008

Creating a wordpress plugin

I am just starting to create a new word press plugin that publishes posts to eblogger using the gdata api.

It’s quite easy so far, and I have to say, word press is pretty nice to develop with..

And I’ve just implemented updates, as well as posting new posts.

Wednesday, July 30, 2008

Going to start using this blog, as a publish target for my word press. I'll use wordpress to publish to this blog, for public viewing of certain categories. For example, my linux stuff. Based on this: URL for single entry is: http://nelggboy.blogspot.com/feeds/posts/default/78656544 API Doc: http://code.google.com/apis/blogger/ Wordpress plugin doc: http://codex.wordpress.org/Plugin_API/Action_Reference http://codex.wordpress.org/Writing_a_Plugin

Howto configure a 3M mouse with scrolling in Linux

Add this to your xorg.conf file.

Section "InputDevice"
# Configuration for 3M mouse, with scrolling
    Identifier "Mouse2"
    Driver "mouse"
    Option "Device" "/dev/input/mouse2"
    Option "EmulateWheel"        "on"
    Option "EmulateWheelButton"  "2"
    Option "EmulateWheelInertia" "20"
    Option "YAxisMapping"        "4 5"
    Option "XAxisMapping"        "6 7"
    Option "EmulateWheelTimeout" "150"
EndSection

Note, make sure other mouse section refers to your other mouse, not the general mouse. This can be tested by doing cat /dev/input/mouse1, mouse2, etc and moving a mouse, to see which mouse is which.

Tuesday, July 22, 2008

Changing storage under lvm

I’ve got an lvm volume group that I want to changing from using raid0, to using raid1.

The volume group is made up for a few raid0 volumes. To change the storage, I do the following:

pvmove the data off at least one of the physical volumes.

[root@wizards nelg]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/md1   system lvm2 a-    44.92G   8.32G
  /dev/md2   system lvm2 a-    46.87G  19.87G
  /dev/md3   other  lvm2 --    93.75G  93.75G
  /dev/md4   other  lvm2 --    93.75G  93.75G
  /dev/md5   other  lvm2 a-    93.75G   1.73G
  /dev/md6   other  lvm2 a-    92.62G      0
  /dev/md7   data   lvm2 a-   306.41G  52.67G
  /dev/md8   data   lvm2 a-   306.41G  62.67G
  /dev/md9   data   lvm2 a-   318.68G 133.21G
[root@wizards nelg]#

vgreduce the volume,

then remove it:

lvm> vgreduce other /dev/md3
  Removed "/dev/md3" from volume group "other"
lvm> pvremove /dev/md3
  Labels on physical volume "/dev/md3" successfully wiped
lvm> pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/md1   system lvm2 a-    44.92G   8.32G
  /dev/md2   system lvm2 a-    46.87G  19.87G
  /dev/md3          lvm2 --    93.75G  93.75G
  /dev/md4   other  lvm2 --    93.75G  93.75G
  /dev/md5   other  lvm2 a-    93.75G   1.73G
  /dev/md6   other  lvm2 a-    92.62G      0
  /dev/md7   data   lvm2 a-   306.41G  52.67G
  /dev/md8   data   lvm2 a-   306.41G  62.67G
  /dev/md9   data   lvm2 a-   318.68G 133.21G
lvm>

The device looks like this currently in mdadm

mdadm -D /dev/md3
/dev/md3:
        Version : 00.90.03
  Creation Time : Sun Jan  8 23:02:59 2006
     Raid Level : raid0
     Array Size : 98301440 (93.75 GiB 100.66 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 3
    Persistence : Superblock is persistent

    Update Time : Mon Jul  7 20:46:54 2008
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

     Chunk Size : 64K

           UUID : 2b3493e2:0a59d252:d9ed1514:2cb69c87
         Events : 0.3

    Number   Major   Minor   RaidDevice State
       0       3        7        0      active sync   /dev/hda7
       1       3       71        1      active sync   /dev/hdb7

Stop the device

[root@wizards nelg]# mdadm -S /dev/md3
mdadm: stopped /dev/md3

This means the pvs shows:

[root@wizards nelg]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/md1   system lvm2 a-    44.92G   8.32G
  /dev/md2   system lvm2 a-    46.87G  19.87G
  /dev/md4   other  lvm2 --    93.75G  93.75G
  /dev/md5   other  lvm2 a-    93.75G   1.73G
  /dev/md6   other  lvm2 a-    92.62G      0
  /dev/md7   data   lvm2 a-   306.41G  52.67G
  /dev/md8   data   lvm2 a-   306.41G  62.67G
  /dev/md9   data   lvm2 a-   318.68G 133.21G

Now, all that is remaining is to change the device, update /dev/mdadm.conf and rebuild initrd to reflect the change.

So. Double check that devices are not in a current array:

grep hda7 /proc/mdstat
grep hdb7 /proc/mdstat

Build the new device

mdadm --create /dev/md3 -l 1 -n 2 /dev/hda7 /dev/hdb7

This will warn, as per below

[root@wizards nelg]# mdadm --create /dev/md3 -l 1 -n 2 /dev/hda7 /dev/hdb7
mdadm: /dev/hda7 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Sun Jan  8 23:02:59 2006
mdadm: /dev/hdb7 appears to be part of a raid array:
    level=raid0 devices=2 ctime=Sun Jan  8 23:02:59 2006
Continue creating array?  y
mdadm: array /dev/md3 started.

This now has a new device, as per below.

[root@wizards nelg]# mdadm -D /dev/md3
/dev/md3:
        Version : 00.90.03
  Creation Time : Tue Jul 22 20:49:22 2008
     Raid Level : raid1
     Array Size : 49150720 (46.87 GiB 50.33 GB)
  Used Dev Size : 49150720 (46.87 GiB 50.33 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 3
    Persistence : Superblock is persistent

    Update Time : Tue Jul 22 20:49:22 2008
          State : clean, resyncing
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

 Rebuild Status : 3% complete

           UUID : 60f87451:d385361e:c4cdb003:fcc220ea
         Events : 0.1

    Number   Major   Minor   RaidDevice State
       0       3        7        0      active sync   /dev/hda7
       1       3       71        1      active sync   /dev/hdb7
[root@wizards nelg]#

Notice that the devices are being synced.

/proc/mdstat shows:

md3 : active raid1 hdb7[1] hda7[0]
      49150720 blocks [2/2] [UU]
      [==>..................]  resync = 13.3% (6540864/49150720) finish=23.3min speed=30358K/sec

Now, I take the UUID: 60f87451:d385361e:c4cdb003:fcc220ea and update /etc/mdadm.conf to reflect this.

I.e.

-ARRAY /dev/md3 UUID=2b3493e2:0a59d252:d9ed1514:2cb69c87 auto=yes
+ARRAY /dev/md3 UUID=60f87451:d385361e:c4cdb003:fcc220ea auto=yes

Next is to update initrd.

The is two choices. Build a new initrd, or just change this one.

As I like to be able to boot my system, I’ll do both, so I have a spare if one does not work.

Approach 1

[root@wizards boot]# mkdir tt2
[root@wizards boot]# cd tt2
[root@wizards tt2]# cat ../initrd-2.6.24.5-server-2mnb.img | gzip -d -c | cpio -i
12546 blocks
[root@wizards tt2] ls etc
blkid/  ld.so.cache  ld.so.conf  ld.so.conf.d/  lvm/  mdadm.conf  suspend.conf
[root@wizards tt2]# pwd
/boot/tt2

So, as you can see, the is an mdadm.conf in the initrd file.

cp /etc/mdadm.conf /boot/tt2/etc/

the, put the initrd back together.

find . | cpio -H newc --quiet -o | gzip -9 > ../initrd-2.6.24.5-server-2mnb-new.img

Note, I made this a new name, as I don’t like to overwrite my existing initrd, just in case. So, I’ll just change my symlink to use this one.

Approach 2

 mkinitrd /boot/initrd-2.6.24.5-server-2mnb-new1.img $(uname -r)

Both approaches should work. I’ll comment further if one does not.

Now, last but not least, is to make use of our new device.

In my case, create a new volume group for my virtual machines, after adding this device to lvm.

lvm> pvcreate /dev/md3
  Physical volume "/dev/md3" successfully created
lvm> vgcreate virtualmachines /dev/md3
  Volume group "virtualmachines" successfully created
lvm> vgs
  VG              #PV #LV #SN Attr   VSize   VFree
  data              3   3   0 wz--n- 931.51G 248.54G
  other             3   1   0 wz--n- 280.12G  95.48G
  system            2   6   0 wz--n-  91.79G  28.19G
  virtualmachines   1   0   0 wz--n-  46.87G  46.87G
lvm> lvcreate -n ms -L 5G virtualmachines
  Logical volume "ms" created
lvm> lvdisplay /dev/mapper/virtualmachines-ms
  --- Logical volume ---
  LV Name                /dev/virtualmachines/ms
  VG Name                virtualmachines
  LV UUID                GGV1PY-mi9Q-yqBz-3bFE-U3Fa-bpS9-pou7fX
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                5.00 GB
  Current LE             1280
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:10

lvm>

now, just format it.

[root@wizards boot]# mkfs.xfs /dev/virtualmachines/ms
meta-data=/dev/virtualmachines/ms isize=256    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@wizards boot]#

and mount
[root@wizards /]# df -h /virtualmachines/ms/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/virtualmachines-ms
                      5.0G  4.2M  5.0G   1% /virtualmachines/ms
[root@wizards /]#

Sunday, July 20, 2008

How to find out which boot loader is installed.

dd if=/dev/hda of=/tmp/bootsec.img bs=512 count=1
file /tmp/bootsec.img
grep LILO /tmp/bootsec.img
grep GRUB /tmp/bootsec.img

Monday, July 07, 2008

mdadm buggy

Well, just had a rather nasty experience.

After rebooting my computer, because I put a new fan in it, as it started up, I saw it fail to start /dev/md4 and /dev/md5 raid0 devices. This then resulted in not being able to start any volumes within my other volume group. Nasty!. So, of course /storage could not be mounted.

So, TO WORK…

After some careful investigation, /proc/mdstat showed that /dev/md4 only had once device, (hda8), and not hdb8. It showed md4 as inactive.
and dmesg shows:

md: array md4 already has disks!
md: array md5 already has disks!

Very strange. Becuase it show have shown sometime like this:

md4: setting max_sectors to 128, segment boundary to 32767
raid0: looking at hda8
raid0: comparing hda8(49150720) with hda8(49150720)
raid0: END
raid0: ==> UNIQUE
raid0: 1 zones
raid0: looking at hdb8
raid0: comparing hdb8(49150720) with hda8(49150720)
raid0: EQUAL
raid0: FINAL 1 zones
raid0: done.
raid0 : md_size is 98301440 blocks.
raid0 : conf->hash_spacing is 98301440 blocks.
raid0 : nb_zone is 1.
raid0 : Allocating 8 bytes for hash.

lvs showed that it could not find all the physical volumes to start the “other” volume group.

So, I stopped the device:
mdadm -S /dev/md4
Then reassembled it, using:
mdadm -A /dev/md4 /dev/hda8 /dev/hdb8

This then started fine, and showed it as clean.

So, an
lvchange -a /dev/other/storage
had me back in business.

Sunday, June 22, 2008

Kicker Icons in Mandriva

If your like me, and run kicker, in Mandriva, you might have noticed that the icons in kicker don’t look so sharp. This seems to be because kicker always uses the 32 pixel icons, even if you have kicker at a size larger than 32 pixels. I’ve found a way to fool it into using larger ones.

Create a directory, ~/.kde/share/icons/crystalsvg/32×32/apps/ then copy in nicer, 64×64 or 128×128 icons from your /usr/share/icons/ directory. (use find in konqueror to find them)

Wednesday, March 19, 2008

From Mandriva 2008.1 (cooker), on EEE pc

Yup, installed Mandriva 2008.1 cooker (rc nearly 2) on my eee pc, and it mostly works, although I do have a few emails to send to cooker about problems, like the default selection of packages on CD1 for i586.

Compiz works ok, yet to find out how to allow windows to be moved upwards, as they tend to be too big for the screen.

Tuesday, March 18, 2008

how rpm delta's should work

Server consists of: rsync, cpio. - it should only have copies of the latest rpms on it. It does not need the other ones to create diffs, as that is done on the client. When server gets a request, it extracts the rpm, if not already extracted, into a temporary store. Then sets up an rsync server for the client. It also has a file with the md5sum’s of all the files, the pre and post scripts, and rpm info.

Client:

  • compares rpm file database of md5sums against copy on server.
  • copies files that are different into tempory spot
  • rsyncs the modified files from the server to the client.
  • gets the new pre and post scripts, updated md5sum list and info
  • builds itself a new rpm based on the contents of the old one, plus the changed files.
  • uninstalls the old rpm and installs the new one.

This should save significant bandwidth, be easy to implement, and use existing technology.