Archive

Archive for June, 2010

Accessing Windows 7 Shares from Ubuntu is a Pain

June 28th, 2010 16 comments

This blog post is about my experiences. If you hit this page from a search engine looking to fix this issue click here to skip to the solution.

Recently, I’ve been reorganizing my computers based on their usage. My old HTPC, has resumed its duties as my primary desktop/server, my Mac Mini has been attached to the my desktop through Synergy, my server was given to my brother for personal use, and his old computer – a nettop – is now being used as our new HTPC.

After a painful decision making process – a topic for another time, and another post – I decided that this nettop, named Apollo after the Greek god of many things including “music, poetry, and the arts” [as close as I could get to entertainment],  should run Ubuntu 10.4 with XBMC as the media center app. After testing it’s media playback capabilities from a local file, I was rather impressed. I set out to add a SMB share from within XBMC, and was prompted to add a username and password.

I wasn’t really expecting this, because Leviathan – my desktop/sever running Windows 7 – has public sharing turned on, as well as a guest account. I entered in my credentials, and was asked yet again for a username and password. After trying multiple times, I decided to quit XBMC and see if I could get Ubuntu to connect to the share. Here too, I was prompted for a username and password, again and again.

Next I headed to the terminal to run smbclient. This didn’t work either, as I was shown a message saying smbclient failed with “SUCCESS – 0″. I guess success shouldn’t be zero, so my next move was to attempt mounting the network share using CIFS. Again, I was met with repeated defeat.

Begrudgingly I took to the internet with my problem, only to find that there were many people unable to connect to their Windows 7 from Ubuntu. The suggestions ranged from registry hacks to group policy administration, none of which worked. One repeated suggestion however, was to un-install the Windows Live Sign-in Assistant. However, as a user of the Windows Live Essentials (Wave 4) Beta that was recently released – I had no such program. I did however have a similar application called the Windows Live Messenger Companion, which I chose to uninstall – again, to no avail.

However, I soon reasoned that perhaps whatever was blocking people using the Windows Live Sign-in Assistant was now being used within the actual Windows Live Messenger client or the other Windows Live Essentials apps that I’d recently installed. I started by uninstalling everything but Windows Live Messenger – because I really, really like the beta version. Alas, this did not help. Next I uninstalled the actual Windows Live Messenger client and voila – I was able to connect with no prompting for passwords at all. Because that makes -any- sense.

As a matter of interest, I installed the regular WLM non-beta client and made sure that the Windows Live Sign-in Assistant was installed, and tried to connect again. Not surprisingly, I was no longer able to connect to my Windows 7 shares. After un-installing the Windows Live Sign-in Assistant my shares were back up and I was mostly happy. Except that I couldn’t use the new Windows Live Messenger beta.

I can’t be sure if the other tinkering I did also helped clear up my problems, but as a recap here are the steps I recommend to access your Windows 7 shares from Ubuntu:

1) If you have the Windows Live Essentials (Wave 4) beta installed, you’ll have to uninstall all of the applications that come with this. For now, you can install the current version of Windows Live Messenger and the other Windows Live Essentials.

2) If you have Windows Live Messenger installed, or ANY of the Windows Live Essentials programs installed check to see if you have the Windows Live Sign-in Assistant installed. If so, uninstall it.

3) Hopefully, now you can enjoy your Windows 7 shares in Ubuntu

Important Note:

Beta software has this nasty habit of leaving beta status sooner or later. If this issue is not resolved when the newest version of Windows Live Messenger is officially released, you may not be able to use the Window Live Messenger client if you need your Windows 7 shares from Ubuntu. I would suggest using an application like Pidgin as your instant messenger, as it can also connect to the Windows Live Messenger service. Other options include Digsby, Miranda, and Trillian.

Originally posted on my personal website here.

lua + nginx + FastCGI on Debian

June 22nd, 2010 2 comments

(This was originally posted here on my personal blog.)

I’ve recently been doing some testing in lua, and have been comparing the results to the EdgeLink Consulting CMS that we’ve designed in PHP. So far this solution is able to serve substantially more requests per second than our current CMS. However, we haven’t really spent much time optimizing the CMS. The goal is to have a working copy first before any optimizations are done. We’ve also been working on some eCommerce modules for the platform.

With all that being said, I’d like to post a quick tutorial on how I got this setup. It was quite the task. Although there was a tutorial I found to do the same task, it was a little bit confusing. My tutorial will have a lot of the same steps, with some minor adjustments. This tutorial is written at an intermediate level. Some trivial steps have been omitted.

NOTE: This has been tested with Debian 5.0.4 (Stable)

  1. Install nginx

    apt-get install nginx

    We’ll have to do some modifications later on to add the FastCGI handler. For simplicity we will keep the web path to “/var/www/nginx-default” and listen on port 8081 in case you have another webserver running on port 80.

  2. Install lua 5.1 (and WSAPI libraries)

    apt-get install lua5.1 liblua5.1-wsapi-fcgi-0 liblua5.1-coxpcall0 liblua5.1-filesystem0

    apt-get install liblua5.1-wsapi-doc

    Can’t do much testing without this. Note: The second line is not necessary if you are running Debian testing, and get the liblua5.1-wsapi-fcgi-1instead.

    EDIT: You’ll notice that I added in liblua5.1-filesystem0. Steve pointed out that there is a bug in liblua5.1-wsapi-fcgi-0. It doesn’t include it as a dependency. He reported this as a bug here, and it was fixed in liblua5.1-wsapi-fcgi-1.

  3. Install spawn-fcgiIf you’re running Debian testing you may be able to get spawn-fcgi through the distribution, however, I just downloaded it and compiled from source.

    wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz
    tar -xzvf spawn-fcgi-1.6.3.tar.gz
    cd spawn-fcgi-1.6.3.tar.gz
    ./configure
    make
    make install

  4. Create a FastCGI Socket

    spawn-fcgi -F 4 -u www-data -s /var/run/nginx-fcgi.sock -P /var/run/nginx-fcgi.pid — /usr/bin/wsapi.fcgi

    For the sake of simplicity, we will just spawn it manually for now. If you’re feeling crafty you can add the above line to the start condition in/etc/init.d/nginx, and the line below to the stop condition. You can add both of them to restart.

    cat /var/run/nginx-fcgi.pid | xargs -n 1 kill

  5. Create a lua file in /var/www/nginx-default/In this tutorial, use hello.lua. You can change this to whatever, you want but just make sure you make the modification in the nginx configuration below as well.
  6. Edit /etc/nginx/sites-available/defaultNow let’s add the code that will point nginx to the correct file. For simplicity, we will simply point it to hello.lua. You can change this to anything, or simply modify the code to accept any *.lua file, as seen in the tutorial listed above. Here is the top of my default file:

    listen   8081 default;
    server_name  localhost;
    access_log  /var/log/nginx/localhost.access.log;

    location / {
    fastcgi_pass    unix:/var/run/nginx-fcgi.sock;
    fastcgi_param   SCRIPT_FILENAME “/var/www/nginx-default/hello.lua”;
    fastcgi_param   PATH_INFO       $request_uri;
    fastcgi_param   QUERY_STRING    $query_string;
    fastcgi_param   REQUEST_METHOD  $request_method;
    fastcgi_param   CONTENT_TYPE    $content_type;
    fastcgi_param   CONTENT_LENGTH  $content_length;
    }

  7. Restart nginx

    /etc/init.d/nginx restart

  8. Visit http://localhost:8081/Congratulations! You should now see hello.lua.

If you have any problems, post in the comments. Stay tuned for more related posts.