Al Hoang

December 7, 2008

Getting X working again after swapping hardware on Open Solaris nv100

Filed under: fixes, gripe, solaris, unix — hoanga @ 10:18 am

After having dain bramaged myself for years with Linux usage. I had gotten spoiled into believing an OS should make it simple to do the following:

1. Shutdown computer
2. Swap around hardware components
3. Restart
4. Life is good

However any techie should tell you this is a pipe dream on Windows. Mac users probably have no clue since they never change hardware components and just buy new Macs to solve their problems. Which leaves the lucky OSS *nix variants to try stunts like this.

Being the stubborn person I am, I attempted this with OpenSolaris by swapping out my motherboard. I wanted to do this in order to take advantage of the E7400 Core 2 Duo that I bought awhile back. Things almost worked however on reboot I was given the dreaded console login screen with a useless keyboard. The following as far as I know don´t work…

1. CTRL-ALT-BACKSPACE
2. CTRL-ALT-Fn
3. CTRL-ALT-DEL

Your best bet is to ssh somehow and try to look for clues. Here is what I did…

1. Swap motherboard and stare at dark screen
2. Find out how to boot into single user mode and make sure the kernel isn’t PO-ed or something and find my IP address
3. Move away the X11 configuration that I configured (dual-display) and try rebooting
4. Reboot and find out it isn’t working
5. ssh in and realize it still isn’t working. Move the old dual display X11 config back to /etc/X11/xorg.conf
6. Try restarting gdm with svcadm restart gdm and watch it fail
7. Scritch head some more
8. Try starting X from the SSH session and whoah it works
9. Restart gdm (svcadm restart gdm) and now I get a login screen
10. Realize that I disconnected the left monitor (VGA) to help debug and want it back
11. Logout and log back in. I now have dual screens and a working Solaris install again!

References

November 29, 2008

Understanding what an L2ARC is

Filed under: geek, solaris, tech, unix — hoanga @ 10:13 am

I’ve been silently scanning some Solaris blogs and skimming some of the appropriate websites for documentation on some of the more interesting features of Solaris for awhile now. One thing that requires time to adjust to is the number of acronyms that the Solaris community has to describe their technologies. One of these is called L2ARC.

At first I thought it was some hardware device however after a bit more searching it turns out that it is part of the ZFS technology suite. L2ARC stands for second level ARC where ARC is a read cache system for ZFS that uses a system´s main memory for holding the cache. While ARC uses the hardware´s main memory, L2ARC is designed to take advantage of faster I/O media such as SSD devices to provide faster read throughput than what a typical hard drive can offer.

Brendan Gregg has an excellent overview explaining what the L2ARC is and some of the benefits it can give in accelerating random reads.

Getting KDE 4.1.0 on a Fedora 8 machine when KDE 3 is already there

Filed under: fixes, gripe, linux, stupid — hoanga @ 9:32 am

According to the Fedora FAQ one should be able to update with just this

sudo yum --enablerepo=updates-testing groupupdate "KDE (K Desktop Environment)"

However when I did, I ran into some icons from packages kdepim-3.5.9 and kdegraphics-4.1.0 conflicting with packages crystalsvg-icon-theme and libkipi. Here is a log…

  file /usr/share/icons/crystalsvg/48x48/apps/kpalmdoc.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_contacts.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_date.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_journal.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_mail.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_news.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_notes.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_summary.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_summary_green.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/kontact_todo.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/crystalsvg/64x64/actions/rss_tag.png from install of kdepim-3.5.9-10.fc9.i386 conflicts with file from package crystalsvg-icon-theme-4.0.4-1.fc9.i386
  file /usr/share/icons/hicolor/16x16/apps/kipi.png from install of kdegraphics-4.1.0-3.fc9.i386 conflicts with file from package libkipi-0.1.5-4.fc9.i386
  file /usr/share/icons/hicolor/22x22/apps/kipi.png from install of kdegraphics-4.1.0-3.fc9.i386 conflicts with file from package libkipi-0.1.5-4.fc9.i386
  file /usr/share/icons/hicolor/32x32/apps/kipi.png from install of kdegraphics-4.1.0-3.fc9.i386 conflicts with file from package libkipi-0.1.5-4.fc9.i386
  file /usr/share/icons/hicolor/48x48/apps/kipi.png from install of kdegraphics-4.1.0-3.fc9.i386 conflicts with file from package libkipi-0.1.5-4.fc9.i386

Error Summary
-------------

I tried deleting these packages manually but that led into an even deeper’s rats nest of dependency hell. So one thing I tried was

$ sudo yum groupremove "KDE (K Desktop Environment)"
$ sudo yum --enablerepo=updates-testing groupinstall  "KDE (K Desktop Environment)"

However I still got conflcts so ran

$ sudo yum remove libkipi
$ sudo yum remove crystalsvg-icon-theme
$ sudo yum --enablerepo=updates-testing groupupdate  "KDE (K Desktop Environment)"

And finally I have got KDE 4.1.0 to install in way too many steps.

I can’t get no satisfying manpages

Filed under: gripe, solaris, stupid — hoanga @ 9:29 am

It seems that with most default UNIX-like installations outside of FreeBSD just include craptastic manpages.

This really puts a dent in RTFM. In Linux-land this has been a serious PITA for years (Yes, I know how to hunt around for the packages to install the manpages in Redhat-ish and Debian lang but it is still an irritation). It seems my forays with OpenSolaris mirror the fun of Linux. Ah well..

$  man ps
Reformatting page.  Please Wait... done

Miscellaneous                                          missing(x)

     missing - Missing Manual Page

DESCRIPTION
     Unfortunately, this OpenSolaris Developer Preview  does  not
     include  the  manual  page you are looking for.  We're sorry
     and hope to improve upon this situation in future releases.

     Online versions  of  many  manual  pages  are  available  at
     http://docs.sun.com/app/docs/coll/40.17.

SunOS 5.11            Last change: 07/10/25

November 10, 2008

Linux is a woman

Filed under: Open Source, geek, humor, linux — hoanga @ 5:06 am

I love this quote

It’s obvious that GNU/Linux is a woman. She’s high maintenance, expects
everything to be given to her for free, and no matter what goes wrong…
it’s your fault.

July 16, 2008

Multiple renaming utilities: mmv

Filed under: fixes, geek, tech, unix — hoanga @ 2:58 am

There are many multiple file rename utilities that you can dig up.

One that I am used to on Debian/Ubuntu-based distros is called rename which is one that is derived from the Perl Cookbook. However, note that this rename script does not seem to exist on other UNIX variants in a packaged format. It definitely does not seem to exist on a Fedora Core 9 box I use nor does it exist on a FreeBSD machine.

While it would not be too hard to swipe the perl script and copy it in place onto a system. I hate having to remember moving that script around and around with me from place to place so I looked around for other equivalents and found one called mmv. One nice thing is that there are packages for at least FreeBSD, FC9, and Debian/Ubuntu variants so it should be quite lazy to install compared to rename.

Below I give an example of using it to do a multiple renaming where I want to append the value 1 to the end of a bunch of filenames.

$ ls
cat_100  cat_15  cat_200  cat_50  cat_500
$ mmv cat"*" cat#1_1
$ ls
cat_100_1  cat_15_1  cat_200_1  cat_500_1  cat_50_1

July 14, 2008

On the irritation of trying to run GPG on a remote headless server

Filed under: gripe, stupid, unix — hoanga @ 12:40 am

My short, short suggestion is… don’t: This blog post explains it much better than I can although I definitely have been the victim of trying to generate a GPG key on a headless server to no avail:

While trying to generate a gpg keypair on a remote server, I discovered I lack entropy. Eventually I had to physically type on the keyboard in order to generate enough random bytes.

I guess in the meantime the best workaround is to generate a GPG key on a workstation somewhere and transfer that to the server in question. A little hokey but I guess if you truly need a GPG key that would be my suggestion.

References

July 3, 2008

svnbackup-restore.rb, svnbackup’s handy companion tool

Filed under: Open Source, fixes, ruby, tech, unix — hoanga @ 10:48 pm

Doug Hellman’s svnbackup script tool is a really handy tool for setting up automated backups for a subversion repository.

However, the non-fun time comes when one wants to restore a subversion repository that has way too many dumpfiles parts. The instructions for restoration are basically ‘roll your own’ if you want to try to automate the restore procedure. What would be nicer is if there was the converse tool that made it easier to not have to figure out how to re-order the backup files in the proper manner in order to perform the restore.

I spent a few minutes thinking about it and wrote a small Ruby script to help with this that I call svnbackup-restore.rb. Here is the (hastily written) source code. (Download here)

#!/usr/bin/ruby
# Program Name: Restore the restore
# Purpose:      Take all the svn dumpfiles generated from svnbackup
#               sort them and try loading them via svnadmin
# Usage:        1. Create the new repo path with svnadmin create
#               2. Set repo_name to the repo backup file names
#               3. Set restore_path to the new path to restore to
#               4. Run it ./svnbackup-restore.rb
# Assumptions:  svnrestore-backup.rb is in the same dir as the svn dump files

# CHANGE PARAMETERS HERE
repo_name = 'myrepo'
restore_path = '/path/to/myrepo'

# Print out debugging?
DEBUG = true

# DON'T CHANGE BELOW

# Filename format is 'dumpfile---.bzip2'
svn_dumpfiles = Dir["dumpfile-#{repo_name}*.bzip2"]
sorted_files = svn_dumpfiles.sort do |a, b|
  left_rev = a.split(’-')[2].to_i
  right_rev = b.split(’-')[2].to_i
  left_rev  right_rev
end
sorted_files.each do |dump_part|
  results = `bzcat #{dump_part} | svnadmin load #{restore_path}; echo $?`
  puts results if DEBUG
  res = results.split.last.to_i
  if res != 0
    puts “Error on trying to load up #{dump_part}!”
    exit 1
  end
end

May 15, 2008

Yapc Asia 2008 Day 1 Notes

Filed under: Open Source, geek, programming, unix — hoanga @ 10:02 am

Okay first day at YAPC…

Missed most of the opening speeches and Larry Wall’s Keynote.. d’oh. Then again trying to handle the incoming rush of attendees was quite the experience. I’d say jumbled is a good word for how we handled it but at least it got handled. It’s pretty hard handling the Japanese Incoming Rush that seems such a common phenomenon in Japan.

Perl as a Second Language Notes

Sat in on the Perl as a Second Language Talk. Here are some of my messy notes

  • There is one than one way to say it
  • Some languages pay more attention to certain details than others (Lots of ways to say cousin in Chinese vs Japanese and English)
  • Showed some examples of Hello World in other languages
    • The Ruby example hung! D’oh! No that isn’t because Ruby is slow….
    • Showed the ever popular Y-Combinator example in Scheme then showed a Perl version
  • One beneficial thing about expresstivity languages is the ability to skip saying the obvious
  • What makes Perl different?
    • Perl does not have OOP built-in (Yes… I know)
    • Shows an example using autobox
    • Perl can be a good language for learning OOP (because you can learn to make your own OO system)
    • Dan defines an Object to be data that knows what to do (I welcome our self-aware Object overlords)
    • Perl objects are references! (D’oh, I need to understand what a reference is… I’ll just assume pointer…)
    • Shows an example of objects with the Mom class and Daughter class
    • our @ISA defines parent-child class relationship in Perl
  • Implementing is…
    • References - for storing data
    • bless - teach data how to find it? (Sorta spaces out here)
  • More than one way to implement OO (no kidding, look at CLOS)
  • “1″ + “1″ is not “11″ because Perl is a context-oriented language
  • However 1 . 1 IS 2 (Operators tell you a lot about what to do I guess)
  • perl -MO=Deparse is handy…
  • DWIM - Context is important for this (Somehow I don’t think I’ll ever get a computer to DWIM)

The other talks

After that… somehow I missed most of the others.. oh yeah I was busy trying to volunteer but I did manage to catch

‎mizzy’s - ‎Easy system administration programming with a framework - フレームワークでシステム管理プログラミングをもっと簡単に‎

Easy system administration programming with a framework

  • It’s called Punc (Perl Unified Network Controller)
  • I learned about CodeRepos which seems to be a popular SourceForge-like area for Japanese (Perl) hackers…
  • Punc looks like a clone of puppet except it uses JSON instead of XML-RPC for the data format to transfer
  • Looks like it’s still bleeding edge software (checkout from trunk and play with it)
  • Uses a Facter clone called PFacter (Are these two interchangeable? That would be realllly nice… otherwise you suck for making yet another clone that does the same thing but can’t be interchangeable…)
  • Dude where’s your test cases?
  • I somehow missed the reasons for writing Punc (Although because I can seems like a good enough reason for many….)
  • I guess if you REALLY want Perl for a Config Management system and don’t mind getting your hands dirty with sending patches this might work but I’m not wedded to any particular language but I am wedded to a more mature implementation
  • I’m sticking with Puppet

Afterwards came Lightning Talks which were really good. Here’s my blurry recollection of them (wish I took notes…)

  • One presenter seemed to have gotten close to written a Perl OS (Perl Machine)… whoah…
  • One presenter showed an interesting aggregator named Plagger (or was that Fastladder) that supposedly could aggregate anything on the web (supported authenticated sites yaaay) including one IRC commentors suggestion that it could be a perfect tool to aggregator pr0n pics
  • TT-something template looked nifty… wish Ruby had that
  • Text::MicroMason looked also nifty since it seemed like an ERB-clone so that’s less learning
  • Vroom::Vroom is quite impressive (VIM as your presentation tool)
  • Developing Amazon’s Dynamo in POE and Erlang showed some interesting contrasts between how the messaging would work if implemented in POE versus Erlang

Lightning Talks are probably one of my favorite events in a conference since 5 minutes really forces you to get to the point. There was also the dinner party which is what I guess you could expect from large amounts of geeks with large amounts of food and booze. Okay last day coming up! I need sleep…

May 13, 2008

Why does RTFM with GNU manpages just suck

Filed under: gripe, stupid, unix — hoanga @ 9:00 am

After looking at a seriously useful tip for cleaning out a clogged postfix queue I puzzled over the -r option in xargs. I’m not an xargs master but I figure if I need it I can always RTFM.

Well man xargs on my Ubuntu box provides the typical GNU fair and I spend the next way too long time period looking for where the -r option is. (The full option is –no-run-if-empty).

Sadly, I ended up finding it faster with a Google search on this web page that has some find-fu and xargs then looking again at the GNU manpage and finally find the option buried just before the EXAMPLES section.

I guess I should be happy this time around, there are some GNU manpages that don’t even HAVE documentation (at least compared to the *BSD brethren). Grrrrrr

April 30, 2008

One way to clean out a gazillion files in a directory without causing the server to hang on IO

Filed under: fixes, stupid, tech, unix — hoanga @ 5:37 am

Had a case where I had some rails app that was using files for its session store and had been running like that for months. While it was a careless (and dumb) thing to run it that way, we had to do something about it since it was eating up close to 85% of the system partition. The dumb way to try to do this is below:

nice find /tmp/ -name 'ruby_sess.*' | xargs -n 100 rm -fv

However, the problem is that this causes insanity on IO which is NOT good for a running service. (Luckily this service was merely important instead of critical) So, I present to you my quick and dirty script that will clean up all those nefarious ruby sessions files that have run amok for months.

while true; do
    nice find /tmp/ -name 'ruby_sess.*' | head -n 20 | xargs rm -fv; sleep 10
done

April 8, 2008

Long Live Linux

Filed under: humor, linux, tech, unix — hoanga @ 6:06 am

Because the packaging certainly isn’t…

March 10, 2008

Graphing mysql slave delay for munin

Filed under: Open Source, tech, unix — hoanga @ 9:42 am

I’ve been wanting something to visualize mysql slave delay. Looks like LordElph has gone ahead and wrote something already to do it. Cool beans.

Rereading a disk partition table in Linux without rebooting

Filed under: fixes, linux — hoanga @ 9:25 am

Ran into a problem with trying to partition up a disk on a running system. The idea is I wanted to create a new partition on a disk with partitions already mounted and use it without rebooting.

Here’s what you’ll mostly likely run into…

# sudo fdisk /dev/sda
... Steps for adding disk  elided ...

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

ahoang@jp-db-3:~$ sudo mke2fs -m 0 -j /dev/sda3
mke2fs 1.40.2 (12-Jul-2007)
Could not stat /dev/sda3 --- No such file or directory

The device apparently does not exist; did you specify it correctly?

# ls -la /dev/sda*
/dev/sda   /dev/sda1  /dev/sda2

The simplest thing to do is just reboot and Linux will redetect everything on restart. However, sometimes you just can’t reboot. After Googling around it seems that partprobe does the job handily. Luckily this tool is already on an Ubuntu system so no need to apt-get install but it’s only a few keystrokes away.

Here’s the rest of the log once I ran partprobe and was humming along…

# sudo partprobe
# ls /dev/sda*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda3
# sudo mke2fs -m 0 -j /dev/sda3
mke2fs 1.40.2 (12-Jul-2007)
... Creating a file system output elided ...

February 20, 2008

Getting screwed by an upgrade (libtidy in Ubuntu 8.04 not ready for real work)

Filed under: linux, stupid — hoanga @ 9:39 am

On my workstation at work I’ve been running Ubuntu 8.04 to test out something I’ll post on later. However, one thing that was driving me nuts was that tidy was blowing up with a very unhelpful message like so:

/usr/lib/ruby/1.8/tidy/tidybuf.rb:39: [BUG] Segmentation fault

At first I thought it was some incompatibility with the gem installed version of tidy however after a bit more searching it seems tied with a specific bug in Debian that is logged here. Basically, the recent version of libtidy has some sort of instability that will blow up on certain types of HTML input. Kind of not useful I say…

Looks like this has been fixed in Debian unstable so this might be a perfect candidate to have merged into Ubuntu since this really sucks inheriting a package bug.

Read the Bug Report

Powered by WordPress

Protected by AkismetBlog with WordPress