Monday, June 27, 2011

Macintosh Fork Failure

Random failures on my macbook air today. Oh I see, fork failures. The default maxproc setting is ridiculously low (512).

Let's double that:

% sudo sysctl -w kern.maxproc=1024
kern.maxproc: 532 -> 1024
% sudo sysctl -w kern.maxprocperuid=1024
kern.maxprocperuid: 512 -> 1024
Now let's check the ulimits, now that only my shells are affected.
% ulimit -a
-t: cpu time (seconds)         unlimited
-f: file size (blocks)         unlimited
-d: data seg size (kbytes)     unlimited
-s: stack size (kbytes)        8192
-c: core file size (blocks)    0
-v: address space (kb)         unlimited
-l: locked-in-memory size (kb) unlimited
-u: processes                  266
-n: file descriptors           2560
% ulimit -a 512
Now, why am I still getting fork errors when opening a new terminal? What process has this 266 locked in?

Friday, June 17, 2011

my first yapc

I'm looking forward to my trip to Asheville, NC for YAPC::na. June 26-30. Yet Another Perl Conference, North America.

I was supposed to go last year while I was at Rubicon Project, but my trip got canceled (some mix of busy, crunch time, and politics).

I haven't been to a focused perl conference since the short lived "O'Reilly University" circa 2000 in nyc. MJD was the bomb! It'll be interesting to compare with our <shameless_plugs> excellently run LA pm</shameless_plug> and all the other LA tech meet-ups.

what do I need to do to prep? Rest my brain and liver, I suppose.

Grub prompt after upgrade to ubuntu 11-04

I got bit by this when I upgraded "mini", my 11" acer to ubuntu 11.04. Rebooting left me at a grub prompt. The exercise has left me with an improved feel for the grub2 interface and boot prompt -- it's actually pretty slick with the TAB completion. Improved in-grub help would have been nifty, instead I found myself doing research on my phone.

Using information from aaron kelleys blog[1] and information available from tab completion I performed the following steps which led to a successful boot. After the root command, filename tab completion looks at that drive.

Boot from grub prompt:

root (hd0.5)
linux /vmlinuz root=/dev/sda ro
initrd /initrd.img
boot

Alternative, equivalent boot from grub prompt:

linux (hd0,5)/vmlinuz root=/dev/sda ro
initrd (hd0,5)/initrd.img
boot
After booting, these steps updated grub on the MBR for my root drive:
sudo grub-install /dev/sda
sudo update-grub

For a taste of the flip side, I restarted into windows for windows update. Looks like it's been 6 months since I booted windows7, so 300Meg to download. Question: Will it be finished or pwned when I get home tonight?

links:

  1. http://aaron-kelley.net/blog/2011/04/grub-prompt-after-upgrade-to-ubuntu-11-04/

Saturday, June 4, 2011

migrate Subversion repository/dump to Git & Github, with tags and branches

A simple and complete method for migrating from subersion to git, bringing over past tags and branches.

I migrated a work repository from Subversion to Git last week. It went surprisingly smoothly. There were a more steps than I expected after reading various, selected, sources.

My repository was in "standard layout" containing only a single tree/project. I was sent a dump of the repository created with svndump. If you have direct access to your svn repository, skip step one. Similarly you can skip the github steps or replace them with your own "primary git server."

Note, if you don't want to maintain the svn tags and branches, then there is a simple single step solution using git-svn. This works if you don't have tags and branches to keep, or you just want a personal git checkout of a remote svn repository.
git svn clone --no-metadata --stdlayout --A users.txt http://svn/repo/here/ new_checkout_name/

Overview:

  1. import svn dump into svn repository
  2. create mapping file of svn committer to email address
  3. create empty git repository
  4. cd to git repository
  5. import from svn repo to git repo
  6. pull branch and tag information from svn to git
  7. create github repository
  8. add remote repository
  9. push all tags and branches to github repository.
Steps:
  1. import svn dump into svn repository from dump file svn_repo.dump
    % svnadmin create svnrepo
    % svnadmin load svnrepo < svn_repo.dump
  2. create mapping file of svn committer to email address
    Create a file called authors.txt and fill it with line separated “svn-name = git-name ” pairs.
    #example:
    % cat authors.txt
    user_a = Alpha <alpha@example.com%gt;
    user_b = B Dawg <bdawg@github.example.com%gt;
  3. create empty git repository
    % mkdir gitrepo
    % git init gitrepo
  4. import from svn repo to git repo
    #   git svn clone file:///pathto/svnrepo /pathto/gitrepo –no-metadata -A authors.txt --stdlayout
    svn repo path must be an absolute path when using file://
    % git svn clone file://$(pwd)/svnrepo gitrepo/ --no-metadata -A authors.txt --stdlayout
  5. cd to the git repository
    % cd gitrepo
  6. pull branch and tag information from svn to git
    tags and branches are both viewed as remote branches, tags are prefixed with "tag/".
    For each branch you want to migrate, make a local branch.
    For each tag, make a local tag.
    % git svn fetch                          # fetch remote branches and tags from svn
    % git branch -r                          # view remote branches
    % git branch local_branch remote_branch  # for each branch to migrate
    % git tag local_tag tags/remote_tag      # for each tag to migrate
    % git branch                             # check work by viewing local branches and ...
    % git tag -l                             # ... local tags 
  7. create github repository
    ( github repo ui, create yourrepo )
  8. add remote repository
    % git remote add origin git@github.com:yourname/yourrepo
  9. push all tags and branches to github repository.
    % git push origin --tags   # push all tags
    % git push origin --all    # push all branches 

Crashed Kindle

Wow, I crashed my kindle3-3G today. I tried to use the "back page" button after jumping forward a chapter and it wedged. The screen froze, and didn't change when I power cycled. A soft-reset (hold on-switch for "15" seconds) caused the screen to clear (all black then all clear). I could only tell if it was on by checking the light in my case.

The reboot key-combo is "shift-alt-r". After a couple of soft-resets I tried a reboot and it worked! woo!

Of course, I had to verify. I navigated to the same page and hit back again. Now it's back to being wedged.

No, it isn't the case causing crashes in my case, it's my own converted-from-chm-emailed-to-my-kindle ebook.

Edit: update, she's working again now that I'm done writing this post. Perhaps it was just really really busy finding that page?