Ups and downs with samba

Using Windows as development environment for Ruby applications is not very good idea. So I have moved to setup with FreeBSD on VMWare and access via samba to files. Far away from perfect but better than before.

When I have changed VMWare player to VMWare server I made decision to create new virtual machine, since with server I can create new machines (player could not). Old one was created for other tasks, and partitioning was not well suited to current tasks.

(c) Joe Geranio

So I have created new virtual machine installed new FreeBSD 7.0 and as first task I wanted to configure samba to serve files to my Windows host. Dead simple setup. Installation was smooth, I have configured it, created user and…

net use \\\local_ruby * /USER:ruby
Enter password for \\\local_ruby:
System error 1326 has occurred. 
Logon failure: unknown user name or bad password.

I started debugging and fast got frustrated – since it is dead simple setup. I’m not heavy samba user, so logs were not very helpful. At this moment my opinion about this could be summarized with samba sucks. But then came solution.

After raising log level to maximum level I have noticed this sequence:

[2008/07/09 12:38:38, 3] auth/auth.c:check_ntlm_password(221)
  check_ntlm_password:  Checking password for unmapped user [WRNB]\[ruby]@[WRNB] with the new password interface
[2008/07/09 12:38:38, 3] auth/auth.c:check_ntlm_password(224)
  check_ntlm_password:  mapped user is: []\[ruby]@[WRNB]
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(233)
  check_ntlm_password: auth_context challenge created by NTLMSSP callback (NTLM2)
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(235)
  challenge is:
[2008/07/09 12:38:38, 5] lib/util.c:dump_data(2264)
  [000] C7 C0 65 DD B0 91 86 EF                           ..e.....
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(261)
  check_ntlm_password: guest had nothing to say
[2008/07/09 12:38:38, 8] lib/util.c:is_myname(2076)
  is_myname("") returns 0
[2008/07/09 12:38:38, 6] auth/auth_sam.c:check_samstrict_security(414)
  check_samstrict_security:  is not one of my local names (ROLE_STANDALONE)
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(261)
  check_ntlm_password: sam had nothing to say
[2008/07/09 12:38:38, 2] auth/auth.c:check_ntlm_password(319)
  check_ntlm_password:  Authentication for user [ruby] -> [ruby] FAILED with error  NT_STATUS_NO_SUCH_USER
[2008/07/09 12:38:38, 5] auth/auth_util.c:free_user_info(2056)
  attempting to free (and zero) a user_info structure
[2008/07/09 12:38:38, 10] auth/auth_util.c:free_user_info(2060)
  structure was created for ruby
[2008/07/09 12:38:38, 3] smbd/error.c:error_packet_set(106)
  error packet at smbd/sesssetup.c(105) cmd=115 (SMBsesssetupX) NT_STATUS_LOGON_FAILURE

I started to dig in C code to understand what those messages, and in auth_sam.c I have discovered real reason. Did I said that it was very fresh FreeBSD install? Well I did not set it’s hostname! And this was reason that whole thing was failing. For me log entry does not say what is going on…

So, samba does not suck :) and open source rules. I could not imagine what would I do if it had bite me with some closed software. As other lesson learned from that is – know at least basics of C and C++ to be able to understand what is going on in code…

C is like Latin :) almost dead language but You need to know it to be taken for educated programmer ;))

Web application that has changed my life

Soon it will be two years since I was exposed to web application, which had probably most impact on me since AJAX was born. I have checked old time entries and it was August 2006 when I found SlimTimer. You ask – time tracking application had most impact on my life? Yes, exactly.

(c) Brenda Anderson

I was working in Hewlett-Packard Poland as network engineer at this time. My career was related to network stuff since 2000, more or less when I moved to Warsaw. But at this point I knew I don’t want to stay in this field. Why? Well… there were two paths if I would be interested to stay in networking – first move to presales support area or became more team manager than technical person. Working earlier as presales and seeing corporate world from inside through last few years I didn’t like any of those.

I wanted to try my luck in US – I was (and I am still) curious how it would be to work there. I was trying to get H1B visa, and one of my attempts I have described in my first post on this blog.

Let’s skip H1B visa topic which is quite interesting since I finally got one, valid up to 2009. But I’m still here in Poland – visa came for me two months to late, my personal situation had changed and I had to leave idea moving to US (at least for some time ;) ). The important lesson from those efforts was my inner belief that I want to return to software development as my occupation (I was doing some C/C++ coding in mid 90). I was thinking about refreshing my C/C++ skills, but there was other thing which have changed my thoughts. Around April or March 2006 I was exposed to Rails and by end of July I was thinking about taking jump into web development world.

But I was not convinced I should do it. I was doing well in my job, despite fact that Dilbert-like situations were on daily basis. I had some feelings there is something not right, but I didn’t allow myself to become aware what really is wrong.

Then on some afternoon I have created account on SlimTimer. I decided I will use this tool to know how much time I spend on particular tasks (this is example of dilbertesque – at this time I had fill time sheets in 3 or 4 places, often giving different values :)) to keep accounting trolls happy). I just needed time tracking solution to know what I’m really doing…

I just re-run report from SlimTimer for first two weeks I was using it. When I look at it now, I remember feeling I had then as it was just yesterday. I was shocked, how much time I waste. Oh boy, I was not aware that I was spending so little time on things which really make me happy in my work. And how huge time sucking hole was impulsive web browsing.

Disproportion between things I was considering fun and definitely not-fun was drive for me to make change – in late August 2006 I was determined to make change with my career. And with such drive almost anything is possible :) In autumn there was opportunity to become contractor on project, which required good mix networking and programing skills. Next few months I have used to prepare to make final step – start freelancing full time. And from September 2007 I’m full time freelancer with focus on Ruby on Rails. And I still use SlimTimer as my time tracking tool.

So, for me SlimTimer became life-changing application. Hard to believe? Maybe, but I would like to know if You have some similar experiences with web applications? SlimTimer or rather conclusion from it’s report was turning point in my career. After two years I can see this very clearly – looking back it is very easy to connect dots…

And how about You?

When timeout hit You with Amazon SQS on FreeBSD/VMWare

I become fan of Amazon’s SQS and ActiveMessaging plugin recently. Great technology, make separating user interface and time consuming operations super easy. I will write about my experiences more, but now simple tip if You are running development environment on FreeBSD inside VMWare.

Often when doing publish to some queue I got timeout, which results in exception raised and following entry in Rails log:

Timed out trying to send the message 
#<OpenStruct body="YOUR_MESSAGE", 
to destination YOUR_QUEUE_NAME via broker default

It is very annoying and it is related to problems with time on FreeBSD/VMWare. Despite of disabled APIC (hint.apic.0.disabled=1 in /boot/loader.conf) time is very unstable. So as for quick workaround whenever I work I do run in background following shell script:

while ( true ) do ntpdate IP_OF_LOCAL_TIME_SERVER; sleep 2; done

If someone knows how to fix this issue with time on FreeBSD and VMWare please let some hint in comments.

I have changed VMWare Player to VMWare server, which offers much more options, and from my non benchmarked observations it seems it has now more stable time. If You can call stable situation that during 2 sec loop in earlier example time differs from real one about 1 sec ;)