2008-07-08

Right-click on a Macbook

My girlfriend's hard drive on her Macbook recently crashed, so a new hard drive and installation of Fedora later, we were refaced with "How to right-click?" I have forgotten the name of the application we were using last time, but we had it set up to substitute the Enter key (near the space bar) with a mouse's right click. Searching around for the optimal solution revealed that the kernel by default might have facilities built in to support this redirection of input. Indeed, and this is how we do it:

# cd /proc/sys/dev/mac_hid
# echo 1 > mouse_button_emulation
# echo 96 > mouse_button3_keycode

I tried using dumpkeys to find out which keycode belonged to that Enter. It turned out to be KP_Enter for the keypad which mapped to 96 for us. Yay.

To make the change more permanent, we're setting the following in /etc/sysctl.conf:

dev.mac_hid.mouse_button_emulation = 1
dev.mac_hid.mouse_button3_keycode  = 96

Credit for this knowledge goes to Mactel-Linux.org.

Oh, and sysadminblog advised us to set

Option "MaxTapTime" "0"

in the synaptics section in /etc/X11/xorg.conf to disable the trackpad click. However, in her Fedora 9 install, there was no synaptics section. Adding a bare one with the entry stopped the trackpad from clicking, but it also made it unbearably slow. Now the entry for the input device looks like:

Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "auto-dev"
        Option          "HorizEdgeScroll"       "0"
        Option          "MaxTapTime"            "0"
        Option          "MinSpeed"              "0.4"
        Option          "MaxSpeed"              "1"
        Option          "AccelFactor"           "0.02"
EndSection

Labels: , ,

2008-06-07

Chrome, Aural, Technical

Hello.

Missing Spectrum

Incomplete color choices on web pages are a bane to the existence of dark coloured themes in GNOME and, at least formerly, on Windows. In particular, Blogger's post area explicitly specifies a background of white, which is disastrous when the system's font colour for editable areas is a light colour in a dark theme. You can try to mandate the colours in Firefox, but then some pages will look weird. My ideal solution is to define custom style rules.

In this case, I've installed the Firefox extension EditCSS by Pascal Guimier to modify the stylesheet and remove the white background rule. I used the DOM Inspector to locate the rule, finding out what the id was used to set the style ("#richeditorframe, #RichEdit textarea") copied the style from EditCSS into an editor that could do search :), removed the background declaration, pasted the edited CSS back into it, and voila! A usable editor once more.

Musical

I'm listening to Frou Frou's "Holding Out For A Hero" right now :)

I purchased a K.T. Tunstall's "Eye to the Telescope" the other day. Wat excellence. I still must pursue Rilo Kiley and Regina Spektor. I had been introduced to the latter some time ago, but it wasn't until the credits of Prince Caspian that I understood that I must possess this sound.

Projects

I have a slew of projects I want to work on. A blogger client in Vala, a simple DB-using tool in Vala, a simple cron editor in Vala. As you can see, I am excited about Vala. I don't imagine that I'll find the time to do any of them, though!

Linux and how I restored my file system

So, I lost my partition table, but knew that the file system I covet was still fine underneath. Yay. So, the solution was this:

  • boot the computer (perhaps from the OS that broke the partition table for the coveted partition, or from a USB key or Live CD.
  • download gpart (man page)
  • $ gpart -vvvf /dev/sda > logfile
  • find the partition (I guessed based on side and faint idea of its partition position) in the output that you want to save. Get the sector start and the # of sectors for it.
  • Either use this information to fix your partition table (Google for that- if the new partition layout that gpart recommends at the end of its output seems desirable, gpart could write that for you.), or, do what I did and copy it to a remote media:
    $ dd if=/dev/sda of=/mnt/sdb1/sda2.bak bs=512 skip=<sector start> count=<number of sectors>
    . It might be advisable to copy over, say, the first 32MB of it and try mounting that to see if a valid ext3 superblock exists at those numbers (described a bit more below). If it doesn't, the values might be wrong.
  • (if you don't want it to take over a day, you might consider converting the sector start and # of sectors into your FS's block numbers (and don't forget to change bs as well!). I went much faster for me then :) (in my case, my block size was 4096-bytes and the sectors were 512-bytes, so I divided the start and # values by 8 :) - hope that at least the start sector starts at a whole block :D (would it not?)
  • Once you have have copied the coveted partition into a nice pretty file safely on some remote media, you will probably want to try to mount it!
    $ mount -t auto -o loop /mnt/sdb1/sda2.bak /mnt/sdb1/sda2.dir
    (if you did a test mount of the start of your partition, you might want to remember to unmount it or to try a different dir ;)
  • I then copied all the contents of that partition out to yet another external media, my backup HD. I did this with rsync so I could preserve things, so the command was like
    $ rsync -va --progress /mnt/sdb1/sda2.dir /mnt/sdc1/sda2.root
    This will late be restored to the computer in question when I get things configured a new.

After getting the sector values from gpart, I actually dd'd over the first 32MB (very small) of the alleged partition onto my remote media, and then I tried to mount that (

$ mount -t auto -o loop /mnt/sdb1/sda2.test /mnt/sdb1/sda2.dir
) to see if it indeed contained a valid ext3 superblock :D The first time I did all this, it didn't quite work, because I dd'd over /dev/sda1 rather than /dev/sda (so the values were off by sadness :$) Once I got the right portion over and tried to mount it with success, I did get error messages, because inodes could, of course, not be found, as I had only copied over a relatively small portion of the actual filesystem. The errors were not reproduced after I copied the entire thing over :)

And this is how I restored my tentatively lost but not overwritten partition replete with complete filesystem :D Originally, I thought that this might be a case for ext3grep by Carlo Wood which does wonders for helping undelete files on ext3 partitions. However, that was not the case, but I still recommend the tool if you think you'd find it necessary.

Details on how to ruin your partition by installing Fedora 9 via net install to follow in a later post. (To summarise again, my coveted partition was in the later 18GB of a 40GB HD, and the Fedora 9 net install came promptless (as I failed to anticipate), installing a fresh Fedora and replacing the partition table :D. I am quite lucky not to have had any of my coveted data in the earlier blocks of my HD where the Fedora installation would have overwritten it. :|)

Labels: , , , , , , , , ,

2008-06-06

C-A-L-L Calling me, calling me now!

Wow, what an action packed adventure. Work is going very well. Progress is a very nice language but it makes real the many complaints about proprietary platforms I have heard in the past. I am also dabbling quite a bit in JavaScript for something internal. It's a more pleasing language than I used to think, and I haven't ever disliked it.

Something sad computery was that my attempt to install Fedora via net install failed, in that the installation went perfectly REPLACING MY EXISTING PARTITION LAYOUT. Thanks to gpart and dd, I have rescued my original Ubuntu partition- I think. I am very fortunate that I did not have it at the start of the disk. (Rather, than tragic honour went to an already corrupted Windows installation.) I will write some details about how to manage the net install and then how to rescue partitions later.

Amusingly, I got an e-mail notifying me of the availability of an old domain of mine, except as .com rather than .net. I am fairly certain that it was available previous to this e-mail, and has now been purchased by hucksters hoping they can sell it to me at a profit. Hahaha.

I have a new BC number, and will apparently hug(?). More later!

Oh, one last thing- I spent the day imagining other people's perspectives, something I should do more often; it brought my surroundings all the more to life.

Labels: , , ,

2008-05-11

BackTrack3 lilo bootloader issues and a solution

A friend of a friend recently tried to install BackTrack 3 from a LiveCD. It's based on Slackware Linux, apparently. He ran into some issues I helped him solve, and I thought I would reproduce the problem and solution here in hopes that it might help someone else.

He had run the LiveCD, run through the Install as he thought he should, but was hoping for a dual-boot. This was apparently causing him issues (that perhaps a sole BT3 installation would avoid?

After running the installer, and having the distribution installed to his new Linux partition (in this case, /dev/sda4; /dev/sda1 was Windows, and 2 and 3 were for swap and something else), he encountered the following when trying to install a bootloader using lilo.

bt etc # lilo
Fatal: creat /boot/map~: Read-only file system

The issue here seems to have been that his mounted root file system is on the LiveCD. This makes it non-readable, and also means it's not the file system he wants to be installing the boot loader in.

solution 1:

lilo -r /mnt/sda4

This makes lilo use /mnt/sda4 as its root directory (yay, chroot). This is important, because /mnt/sda4 is mounted to /dev/sda4 where his actual on-disk BT3 installation is.

Unfortunately, there's another problem.

bt etc # lilo -r /mnt/sda4
Warning: LBA32 addressing assumed 
Fatal: raid_setup: stat("aufs")

We were find with the LBA32 addressing being assumed, but how did RAID concern his laptop? And why another union FS? Apparently his "boot=" line in his lilo.conf referred to aufs, so he changed it to refer to /dev/sda instead. That didn't help:

bt etc # lilo -r /mnt/sda4
Warning: LBA32 addressing assumed 
Fatal: raid_setup: stat("/dev/sda")

Eventually, it occurred to me that dev/ inside /mnt/sda4/ wouldn't be populated with anything, now that it's dynamically populated (I think). However, /dev/ in the LiveCD environment was. After some googling, this was done:

# mount --bind /dev /mnt/sda4/dev
# mount -t proc proc /mnt/sda4/proc

I'm not sure about the necessity of mounting the proc, but we definitely needed to dev to be populated on sda4. After doing this, `lilo -r /mnt/sda4` was successful. Yay.

summary

If you're having issues installing a bootloader for your dual-boot BackTrack3 installation, and are getting either of the following two errors, try the following command sequence (replacing sda4 with your target partition).

error 1
Fatal: creat /boot/map~: Read-only file system
error 2
Fatal: raid_setup: stat("aufs")
Fatal: raid_setup: stat("/dev/sda")
solution
# mount --bind /dev /mnt/sda4/dev
# mount -t proc proc /mnt/sda4/proc
# lilo -r /mnt/sda4

And you might have to set the line "boot=/dev/sda" in lilo.conf.

If this helps anyone, please let me know. If you seem to have the same problem and this doesn't help, then really please let me know. I don't want useless instructions remaining useless forever.

Labels: , , ,

2008-02-24

Ubuntu Unwired

So, quite a few posts of mine are meant to be instructive to my future self, recording how I manage something so that I won't have to stumble through it again. Letting these be public here might allow the odd other person to benefit from my experience.

So, a Netgear MA111 wireless USB adapter. I wanted to get one working with my Acer Travelmate, Skedge. Sadly, the MA111 only supports WEP. So does my travelmate, but Linux doesn't seem to support its hot-swapping between Wireless and Wired. I have to set that at boot while the BIOS is in control, so I'd have to reboot to change the setting. Fortunately, the main environment I want to use this wirelessly in is on campus, and that doesn't employ WEP or WPA. (Crazy kids.) They only require authentication before your packets will be routed. Yay.

Anyway, the point of this post is to record what small change I had to made to have this work in Ubuntu. This forum thread discusses a few different methods, including "download the source and build it yourself". I'm getting bored with doing that, so instead I went to packages.ubuntu.com and searched for the module I needed, prism2_usb.ko. Results. I then apt-get'd the one for my kernel (i386), let it install, and yay, workingness.

I'm not sure how relevant this is, but I did also install linux-wlanctl-ng through apt-get and ran the following two commands from the forum thread.

$ sudo modprobe prism2_usb prism2_doreset=1
$ sudo wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable

Labels: , , , ,

2008-02-23

Norn-Linux Revival

TetriNET is fun. I have got my girlfriend to play it with me. The Creatures game Docking Station has successfully installed. gtk+.i386 (gtk+ 1.2) needed to be installed. For posterity, here are some instructions.

  • Go to Creatures' website
  • Download Docking Station Linux client (>)
  • make it executable: chmod +x dockingstation.run
  • Install gtk+ 1.2 for the sake of imageconvert. (Did you get the following error?)
    Converting images to local format                                               
    ./imageconvert: error while loading shared libraries: libgtk-1.2.so.0: cannot open shared object file: No such file or directory
    If you're on a 64 bit computer, realise that this is a 32-bit programme and will want the 32 bit gtk+ 1.2. On Fedora 8, I installed gtk+.i386, and in Ubuntu I installed libgtk1.2.
  • run the installer as root: sudo ./dockingstation.run. If you already tried to run it once and have to run it again, and you see the following:
    File /usr/local/bin/dockingstation is already a symbolic
    link to a different place.  The installer is trying
    to make a link to /usr/local/games/dockingstation/dstation-install.
    Then just remove the old symbolic link: sudo rm /usr/local/bin/dockingstation
  • To actually run it, I was advised to type dockingstation nocheck, but the usage of dirname in the dockingstation script fails. That is, you might get the following error:
    dirname: missing operand
    Try `dirname --help' for more information.
    dockingstation is just a symbolic link in /usr/local/bin/ linking to /usr/local/games/dockingstation/dstation-install. I can successfully run /usr/local/games/dockingstation/dstation-install nocheck instead. To save myself the trouble of retyping it, I can replace /usr/local/bin/dockingstation (a symbolic link) with an actual executable file/script including the following:
    #!/bin/sh
    /usr/local/games/dockingstation/dstation-install nocheck
  • Yay, now it works. My norns can now party hardily. Hardily indeed.

Labels: , , , ,

2008-02-19

Google cannot be my champion

Google is eventually migrating away from XMPP for the Android platform's Google Talk service. I'm not going to argue that it shouldn't, or that XMPP is superior to a binary protocol. But I'll discuss the appearance and what bothers me about it.

I enjoy Linux and GNOME and open source because it holds the promise for the ideal future platform for me. Open Source provides me the with the greatest flexibility and capability. For me to enjoy my work, I need Open Source to thrive. I have a rough, "big picture" for the future of the Open Source desktop, and I hope I get to contribute to it.

The appearance of Google's move is that they're migrating away from an open standard for message communication toward a proprietary, binary protocol. Toward the type of protocol that they and the open source community argue against. Of course, they could make their protocol well-documented and provide a good library with a good API for third-party clients. I do not yet understand whether they'll use the binary protocol for Android and provide a gateway between itself and the current XMPP network, or whether all Google Talk services will migrate.

While Google is currently very friendly toward the Open Source movement and open standards, they cannot be trusted absolutely to be so forever. I need to look toward alternatives and not find myself bound to Google. Fortunately, I can pull my blogs via their ATOM API; my e-mail via IMAP and POP3; my calendar via iCal; I don't think I can download my Google Reader data, but it's not a huge loss. I am very grateful for the services that they provide and the access to my data that they allow. I wonder if they would take issue with the term "my data"? However, I am very interested in the rise of Open Services. There are a few out there right now. Ones that are built on Open Source software, employ open standards, and leave data ownership with the user. I need to investigate them more. However, I will at the present remain the subject of convenience, and pretty Googlish interfaces :D

Labels: , , , , , , , ,

2008-02-12

Can open termcap database file :)

So, after some struggling, I've decided that, for this assignment, it would probably be more productive for me to try and compile and install emacs as a user in my lab account rather than endure with vi. Compilation went much more smoothly than it had with synergy the other day, except that, afterward, when I tried to run it, I would get the following error:

emacs: "Cannot open termcap database file"

And the process would exit. That wasn't nice. I tried googling the matter, and couldn't find any solution in the first few pages. Well, there were solutions, just not ones I could use. A lot of them recommended installing libncurses or a compatibility library, neither of which I have the rights to do. It eventually dawned on me to read the the termcap manual, discovered the environment variable TERMCAP and, after a `locate`, found an example TERMCAP database file on my system for xterm. Copy, set variable, run emacs. Success!

I hope this helps someone at some point. I should really post this as a reply to others with the same issue. "If it can't find the database, tell it where one is!" Ah well, maybe during the weekend :)

Labels: , , , ,

2008-02-11

On a side note, this does make me happy that I kept the / and /home partitions separate. If it's not the hard drive and I have to re-install an OS at some point, at least that will be simple.

The automatic fsck on boot encountered errors it didn't know how to deal with, so it aborted, dropped me to a recovery shell (thanks Fedora) and asked me to manually do it. So I did. Perhaps the problems here are just from random, anomalous freezes (still going back to open radeon driver) and file system inconsistency due to hard rebooting. Ah well.

I've just lost my panel applets again. A large chunk of launchers, that is. Ah well. It feels ominous. I am otherwise presently rsync'ing my home directory onto my external drive. I obey the methodology outlined by Mike Rubel. It's pretty nice and pleasant to think about. I should replicate it somewhere in case that page ever goes down :)

Essentially, he advocates a methods including the one I use (and trailing slashes are important):

mv backup.3 backup.tmp
mv backup.2 backup.3
mv backup.1 backup.2
mv backup.0 backup.1
rsync -a --delete --link-dest=../backup.1 someSourceDirectory/ backup.0/

Once I have a better storage solution, I think I will go through my computer and 'archive' stuff. That is, I will remove data I rarely use to external storage. While it might impair access to my information, the idea will be that it wasn't anything I was really using, anyway, and that I'll have a cleaner home directory. Also, perhaps I should have a networked file system solution, where I (and I alone) could access my data over the Internets. I wish I knew more about web security in that regard. I have a very patch-work knowledge from a variety of experience. (I am grateful for that one co-op job.)

I suppose I should retire for the night now. I'll note one grievance I have with Blogger, though: I really dislike how it presumes I want implicit <br />s everytime I use a newline in my text, even though for actual publishing I have the option disabled. Tee hee!

Labels: , , , , , , ,