SiKing

January 26, 2010

How to fix Windows Powershell?

Filed under: windows — siking @ 2:06 pm
Tags:

PowerShell icon
I am doing some automation work – it has to run from the command line, and completely unattended. Most recently, I am doing it under Windows. The classic command.com shell has definite limitations, and the next step up is suppose to be the Windows Powershell. As awesome as this scripting shell is </sarcasm>, it unfortunately installs broken by default: you cannot run any scripts. Even though Microsoft calls this a security feature it makes the scripting shell rather useless. The procedure to unbreak it is quite hidden; not to mention written by someone who a) has a very quirky sense of humour, even for a geek, and b) has obviously never heard of Linux or bash.

I will spare you all the bits like:

Most important, you’ll also be able to say things like, “You know, you really ought to dot source that script when you run it.” If that doesn’t impress your colleagues then nothing will.

The (one-time) procedure to unbreak it is:

1. From inside of powershell you need to run:

PS> Set-ExecutionPolicy RemoteSigned

Update: On Vista (and probably later) this will not work – you will get access to modify registry denied. You can either run powershell As Administrator, or you can edit the registry manually:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]
"ExecutionPolicy"="RemoteSigned"

2. Then for your .ps1 files, you can associate a Run command:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -noexit &'%1'

Yes, it must be single-quotes! :roll:

December 26, 2009

Wireless in VMware Server 1.0.10 on Linux Mint 5

Filed under: linux, virtualization — siking @ 7:35 pm
Tags:

Over the holidays I updated my VMware Server, and I got my machines bridged to my wireless card. Yea baby! :mrgreen:

  1. Have a read through my previous HOWTO.
  2. Download VMware Server 1.0.10.
  3. Go through the install, but stop at the vmware-config.pl.
  4. Download Liken’s vmware-any-any-update-115-K2.6.24-WirelessBridge.tar.gz.
  5. Unpack Liken’s update. Replace vmmon.tar with the original from VMware Server. If you are following my instructions religiously, then you want cp /usr/local/lib/vmware/modules/source/vmmon.tar /tmp/vmware-any-any-update-116-K2.6.24-WirelessBridge/.
  6. Run the runme.pl in Liken’s update, and continue with vmware-config.pl (you have to do this as sudo, but you knew that right?).
  7. Cleanup the debris – see the note about libgcc_s.so.1 in my HOWTO.
  8. Before starting your machine, explicitly define the machine to use Custom Network Connection: /dev/vmnet2 (or whatever you bridged your wireless card to).
    Virtual Machine Settings

Credits: without the following people I would have never gotten this to work.

PS: This is my post #100! :cool:

December 18, 2009

Please make it stop!

Filed under: cyberspace, meatspace — siking @ 11:40 am
Tags:

End of the year, but no end to people’s stupidity. :roll:

We had a big storm … in Calgary … in December … that caught the city by surprise. Are you friggin’ kidding me? Snow in the middle of winter in the northern hemisphere? Please say it ain’t so! Obviously for all you bitchis out there, the price of gas and the cost of parking in downtown is still not expensive enough. Take the bus and get off the road.

So apparently newspapers are having problems selling … newspapers. Well, dear Mr. Murdoch, I will tell you why: because nobody cares for that drivel you claim to be news! When crap like Tiger sleeping with I-don’t-know-how-many-women makes top news, people just don’t care. I don’t understand why Google does not give them exactly what they want, and delist them into oblivion? First off, those idiots had a technical solution to their so called problem all along, but they have to make a big whoop out of it. Second, they are just blaming their outdated and dying business model on someone else. I’m sorry Mr. Murdoch, but you’ll have to get in line. The *AA’s were here first.

The EU has finally beat the giant MS into submission, or has it? You know what: who cares? Nothing will change! This benefits MS, and it is only busy-work for the EU – their primary activity. As far as MS is concerned, “there is only one thing in the world worse than being talked about, and that is not being talked about.”[Oscar Wilde] As for the bureaucrats in the EU, if they were serious about competition in the marketplace, they would sink the taxpayer’s money into alternative operating systems (there is more than The one alternative) and applications, rather than frivolous litigation.

Bah! Humbug!

November 12, 2009

Hey everybody: I’m famous!

Filed under: cyberspace — siking @ 11:01 am

October 8, 2009

Installing Eclipse on Linux Mint (Ubuntu)

Filed under: linux — siking @ 9:21 pm
Tags:

Even thought Eclipse is available in the standard Ubuntu repos, it is not as easy or straightforward to install as other packages. Here is what I did to install the latest Eclipse + Pydev + Subclipse on my Mint 5 :mrgreen: (Ubuntu 8.04 equivalent).

Step 1: Install and update Eclipse

  1. sudo apt-get install eclipse-pydev, or you can just install the package eclipse-pydev from Synaptic. Pydev has Eclipse (and a bunch of other stuff) as a dependency, so you will get both. Subclipse is not available in the repos; no idea why; we will handle that separately below.
  2. Eclipse has it’s own package manager, which is not exactly compatible (in form or function) with APT (note that Synaptic is just a graphical front end for APT). Once the install completes lock the eclipse and eclipse-pydev packages: in Synaptic select the package and then select Package > Lock Version. This will ensure that Synaptic knows it is installed (in case it is a dependency for something else), but it should never mess with trying to update it.
    Eclipse pinned
  3. Start up Eclipse as a normal user, and enter your default working directory. This step will ensure that all the work files that Eclipse needs will be created, and they will be created with the correct permissions and in correct places.
  4. Next you want to update Eclipse. What Eclipse does not do for you, and you just simply have to know, is that you need to do this with root privileges – majority of Eclipse lives in /usr/lib/eclipse. If you skipped the previous step (creating all the work files), then the work files are going to be created with wrong privileges, and subsequently nothing is going to work right; even after I chowned all the ownership on ~/workspace I still had problems. Start Eclipse from a terminal with sudo eclipse. When it asks you where you want to keep your workspace, this time it does not really matter what you tell it – I normally tell it in /tmp.
  5. To update Eclipse, select Help > Software Updates > Find and Install, and follow Scenario 1 from the Eclipse wiki.

Step 2. Update Pydev

  1. Still as root in Eclipse, again select Help > Software Updates > Find and Install. This time select the second option “Search for new features to install”. Pydev was sold and re-licensed, and I suspect the new owners are not interested in keeping Pydev in the repos. So the new version is actually a new product.
  2. I was presented with three sites to search. I did not find anything I was interested in on Callisto Discovery Site. Pydev Extensions is what you want. The Eclipse Project Updates did find things, but I think they buggered up my install, so from now I just avoid them.
    install sites
  3. When presented with the available updates, select Pydev. The Pydev Extensions are a paid feature, and I am not using Mylyn.
    updates
  4. Another restart. If you check, you will notice that the Pydev Extension site has been removed. This means that from now on, to update Pydev, you can go through “Search for updates of the currently installed features” and not the “Search for new features to install” route.

Step 3. Install Subclipse

  1. Subclipse is a new feature, so still as root in Eclipse go to “Search for new features to install”.
  2. This time you have to add a New Remote Site. You get the necessary information from the Subclipse site.
  3. After that continue through the wizard. From the presented choices, I only selected Subclipse, minus the Revision Graph which I could not get some dependencies for.
    subclipse updates
  4. You need that JavaHL stuff, and contrary to the way things look above, you did not just install it. :( sudo apt-get install libsvn-javahl
  5. Now it gets complicated! Start up Eclipse, and see if it cluedin and figured out what you just did. From the menus select Window > Preferences, and in the popup window select Team > SVN. Under the SVN Interface, you need to see a version of some kind. If you see “Not Available”, Eclipse did not figure it out.
    Eclipse preferences
  6. If it is not right, first check you got the correct version of everything. There is a Subversion server – Subclipse version compatibility, and then Subclipse – JavaHL version compatibility. So, as an example, I am trying to connect to SourceForge which supports Subversion v1.5. So I will need Subclipse at least v1.4, which needs JavaHL v1.5. I am using Mint5 – Ubuntu Hardy – and according to this, I will need to grab JavaHL from their backports repository. If you are running Intrepid – Mint 6 – or later, you should be fine. Including additional repos in your system I will leave as an exercise to the reader.
  7. If after all of that it is still not working :eek: , you will need to edit your eclipse.ini. I did not have to do this, and I suspect that newer versions of Mint will be the same.

Last word

To remove this mess from your system:

$ sudo bash
# apt-get purge eclipse
# apt-get autoremove
# rm -rf /usr/lib/eclipse

Maybe I’m just spoiled, but all this should not be this difficult!

Update 09/10/26: So apparently I forgot an important step. After doing all these updates you have to rm -rf ~/.eclipse to reset everything on your account. Also, Pydev has been restructured (again), and re-released as version 1.5. Unfortunately, they forgot to notify the update manager, and you have to do it manually – note the ‘Quick Install’ cutesie note on the right hand side.

Did I mention that is beyond-stupid complicated?

The next destination?

Filed under: places — siking @ 8:54 am

It’s October, which means I have been in one place for like 10 months now – woohoo! At the beginning of the year, the kids have been asking that we stay put for a while. Now two have been hinting that they are getting restless. “What was your favourite place, daddy?” “I liked Ireland.”

I came across a story about a place called Florianopolis. Coincidence? I think not… :grin:

September 29, 2009

Big loss for Linux today

Filed under: linux — siking @ 6:33 pm
Tags:

Approximately 2 and half years ago I became a serious proponent, dare I say evangelist, of Linux. As of today that is no longer the case.

Without going into all the boring and filthy details, I had some minor problems running a new 64bit kernel, on somewhat new-ish hardware that almost supports 64bits, with some older software. I tried to downgrade – clean reinstall – to something which I had previously confirmed on another machine works perfectly fine. After the install I had serious problems even connecting to the local network – plain DHCP. This is normally an immediate KO criteria for me, and I don’t even bother trying to figure out anything else. This time I did give it a second chance, only to run into more serious problems. :mad: Well, I’ll just reinstall back what I had at the beginning of the day and live with the small issues, right? Last time, the install took me under 60 minutes. After the second install I could not get anything to work again! How is it possible to use the exact same install media, on the exact same machine, and get two completely different results? After a day of pondering this dilemma – downtime for my employer – I am installing that other system first thing tomorrow morning. :sad:

Here are some myths, that I personally have proven wrong:

Linux is cheaper. You know what? Nobody in the corporate world cares! I have yet to meet anyone anywhere who actually gives a hoot to save money for their employer in this area. Licensing costs for proprietary software, in the corporate world, are somebody else’s problem somewhere else and the software is effectively free to us here.

Linux is technically superior. That may be, but only if you are a geek that reads source code all day. One of my colleagues, whom I respect very much, runs Windows on his desktop, has a MacBook sitting on the desk next to him, wears OpenBSD T-shirts, and runs several different Linuxes in the back room. He is quite fluent in all these OSes. When someone asks him which OS he prefers, his answer is always: “whichever gets the job done the fastest.” The “job” that he is faced with on a daily basis: some marketing drone hassling him to “just get my laptop to work!” Bottom line: All operating systems will have problems. It just so happens that for Windows the problems are assumed by the (l)users, and there is always somebody around who knows how to “just get it to work.” However, if you run into a problem with your Linux machine, everyone just gives you that you-asked-for-it look and a shrug.

I am not expecting to see Linux on the corporate desktop any time soon. :cry:

August 24, 2009

pwned by Windows

Filed under: automation, windows — siking @ 3:50 pm
Tags:

I am starting to put together a new piece of a continuous integration framework (the self-test part, of course). This one has to be done on a Windows platform, specifically it has to run on XP and Vista, a first for me.

I am used to having everything that I could possibly need at my fingertips on a base install of Linux. I can’t remember EVER having to go and hunt for some tool that I would need to get something like this done that was not already installed.

I first decided to see how far I could go with a base Windows install; that is, the minimum amount of tools that are not part of the original install. This means that I tried to resort to pure .bat scripting. :cry:

Syncing different Windows machines

As is often the case, this has to run on multiple machines. I am just too lazy (and error prone) to go and make one small change on every single machine every time I update something. I want the framework to be self-updating! In order to achieve that, I had to install SVN on all he machines. My first rule broken, and I did not even get started. I did not even try to work around this one: some sick munched up network test if a drive is mounted properly, copy over network if the machine is not down, verify the copied files, decide which one is considered the master, …

Getting the day of week on Windows

I want different tests to run on different days of the week – this is strictly a management decision, there was no technical reason to do this. No big deal. In pure .bat scripting this is quite difficult to get, but not impossible … or is it?

The only command that I could find that gives you the day of week is date /T. It dumps out something in the format: “day date”, where “day” is a three-letter code for the day of week, like “Mon”, “Tue”, etc; and “date” is the current date. Now how to parse that? After like an hour of Googling and browsing the specs, I ended up with:

for /F "tokens=1" %%d in ("%date%") do set day=%%d

Nice, huh? They even have a different way of naming the variables inside the loop, depending if you are doing it from the command line or from a script! :shock: To tell you the honest truth, I am not really certain how this actually works. However, the first time I ran it on one of my test machines, %day% ended up being something like “18/08/09″. I’m thinking WTF? Tried it on another machine and got “Tue”. After some more trial and error, I discovered that the output of the date command varies depending on what locale you have set in your preferences. What sick sadistic MF over at Redmond thought this would be a good idea?

Scheduling things in Windows

Of course not everything everywhere is the same. Some parts of the tests need to change between different machines. From the Linux world, I normally did this through environment variables. Bill’s posse decided to outdo Linux by introducing three types of environment variables, only two of which are properly documented! After some trial and error I found a combination that worked … until I tried to run my tests as a Scheduled task. The facts that the tools for scheduling a task 1) are found in completely different location between XP and Vista, 2) have completely redesigned interface, and not for better, and 3) have their file formats that you export/import totally incompatible between the two, no longer dissuaded me. It makes work that much more interesting. But the fact that different variables are passed to the scheduled tasks in different versions of the OS, is another example of Windows’ big middle finger for the programming world.

There was a time once that I used to run a liberated version of Windows on my machine. Today, they could not pay me enough to install that piece of dung on my machine. I wouldn’t want it even for free!

Next: PowerShell. :roll:

August 11, 2009

Happenings?

Filed under: noki, tech, windows — siking @ 1:19 pm
Tags:

Not much actually. :neutral:

So my Noki is now officially outdated. :sad: Man, €500 and 19 months later, and stuff is no good anymore. :shock: Am I the only one who thinks that a device I pay that much money for should last me at least a decade? Yea, naïve, I know. :cry:

Update 09/08/21: Now I know why. Nokia N900 running full Linux. Yea baby!

I am so over 64bit operating systems, regardless of the vendor. I suspect the biggest problem that is killing the whole thing are peripheral vendors. Apparently 64bit support was available in CPUs from 2003, and OS supported it from 2001 – both on the desktop. However, five years after the fact, support from (closed source) hardware vendors is flaky at best! Here is just one example of a miserable issue I recently ran headlong into.

Here is a good one. The other day, while I am installing something – something that I have been installing the same way at work for the past 6 months – out of nowhere pops up the following:

Site Server 3

This is a 10-year old product :!: And I get this popup only when I am installing over the network. Anyone know where the heck this comes from :?:

June 9, 2009

Converting graphics fast

Filed under: iotal, linux — siking @ 9:16 pm

Every once in a while I have to covert/shrink/modify a picture. First off I suck at graphics (one of my sons is WAY better at it), but, like this time, I had to convert something from .svg to .jpeg and shrink it too. The package that you need to do this is imagemagic, and the command is: 'convert <orginal.svg> -resize 150 <target.jpeg>'. There is a huge number of switches that this thing takes. Check it out!

June 8, 2009

Installing VMware Server on Linux Mint (Ubuntu)

Filed under: linux, virtualization — siking @ 8:52 pm
Tags:

Installing VMware Server is not your typical point-and-click procedure. However, it is quite easy even for those who are a little squeamish with the command line.

Here I will be talking about installing VMware Server version 1.0.9 on Linux Mint 5 – I don’t do the latest’n'greatest anymore. Linux Mint is fully compatible with Ubuntu 8.04, so I would expect this procedure to be very similar, if not identical, for most derivatives and close versions.

VMware are very good at hiding all the useful stuff on their website! :roll: Here are all the pieces you are going to have to download:

  • VMware Server will require you to build kernel modules. You will need kernel header files for that. On Mint/Ubuntu you already have them at /lib/modules/$(uname -r)/build/include. The installer, further below, will be able to figure it out automatically, assuming you have all the defaults for your system.
  • To build stuff, you will need tools. I just grabbed the build-essential package and that had everything.
  • The VMware install guide is linked here – you want the Admin Guide, starting somewhere around page 36. I once accidentally found a much more succinct Install Guide on their page, but I can’t find it again. :( Below is only the relevant distill; however, I would still recommend that you have at least a browse through theirs in case you run into problems. There is also a detailed guide here, which may be of some use if you run into problems.
  • VMware is pushing the newer 2.0 version; older version are here – you want to get the “VMware Server for Linux. TAR Binary.” Right on that same page, notice the register for your free serial number(s) link. The server is free, but they will need an e-mail address where they can push more stuff on you.

First you will need to unpack the TAR Binary. You will only need this once, so you might as well do it in /tmp – which gets automatically emptied each time you reboot. Open up a terminal:

cd /tmp
tar xvf ~/Downloads/VMware-server-1.0.9-156507.tar.gz

And continue with the install:

cd vmware-server-distrib
sudo ./vmware-install.pl

I took defaults for everything except the following:

In which directory do you want to install the binary files?
[/usr/bin] /usr/local/bin

On Ubuntu, or any system that has a package manager, it is good idea to keep stuff you install manually somewhere else. The Linux file system has a place specifically for this purpose, and that place is /usr/local.

If you screw the install up, you can run sudo /usr/local/bin/vmware-uninstall.pl so that it cleans up, and then start again.

Next is the configuration. The installer will prompt you, or you can just run explicitly sudo /usr/local/bin/vmware-config.pl. Any time afterwards you want to change something, you will need to rerun this program. For Linux Mint 6 (Ubunt 8.10) or perhaps later, you might need this patch before you configure the VMware – suggestion is to run the configuration program, if it fails install the patch, if it passes just move on. Again, I took defaults except:

You can safely ignore the complaints about the extensions on the Icons, as well as the wrong version of the gcc compiler.

For networking, make sure you bridge all interfaces (ethernet and wireless). I did not use NAT.

In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines] /home/vmware/machines

The way I have my disk partitions set up, I had to override where the machine images will be kept. The images will be big, make sure the place you tell it has enough space.

If everything worked fine, you should get a new menu entry Applications > System Tools > VMware Server Console. The first time you try to run it, it will not work. :( If you run vmware from the command line, you will get:

/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)

According to the Gentoo team, this file is useless. Once you delete that, the VMware console should come up normally.

Update 09/06/18:

I just tried to do the above on Ubuntu 8.10 64bit. I did need the patch as mentioned above, and I did not get the error about libgcc_s.so.1 when starting vmware. However, I did run into an issue starting up my virtual machine. At first you get a blank error (as in: “The process exited with an error: End of error message.”), but if you turn on debugging in the advanced options you can see the actual error:

Version mismatch with vmmon module: expecting 138.0, got 137.0.
You have an incorrect version of the `vmmon' kernel module.
Try reinstalling VMware Server.

And they’re not kidding. The fix is that you have to configure vmware twice! :shock:

Then there was a second surprise: my arrow keys (along with a bunch of others) did not work inside vmware. There is an explanation as well as a solution, at the VMware Knowledge Base.

Every once in a while the keyboard will stop responding to mapped keys – things like Crtl-Alt-LArrow to switch desktops – you can run setxkbmap to fix it.

Update 09/06/24:

For some other reasons, I updated my box to Ubuntu 9.04 AMD64. When recompiling vmware I hit some SSL key errors.

Update 09/07/22: Bottom line: If you are going to go with VMware 1.x do not go over Ubuntu 8.04 (Mint 5). After several months of running it on 9.04×64, I feel it is quite unstable! Also, if you do want to virtualize 64bit operating systems, make sure your BIOS supports this thing … upfont. :evil:

May 27, 2009

Biological computer virus

Filed under: cyberspace, meatspace — siking @ 7:43 am
Tags:

Every once in a while I have a day when lots of unexplainable and unreproducible things just happen to computers all around me. Yesterday was one of those days.

It started out trying to get VMware to acknowledge my wireless network. No good, but this never worked for me, so nothing new so far. Next, when trying to connect to work, I found that VPN networks was gone from the network manager – OpenVPN was still installed, just not showing up in the GUI. Then the kicker: I noticed that OpenOffice.org Quickstarter was gone from the notification area, so I go to launch it from the menu. It just disappeared from my computer; like not just the Quickstarter, but like the whole thing! :shock: It was even reported as not installed in Synaptic. After reinstalling it, Quickstarter still would not come up. I have come to expect things like my RSS feeds on the partnerpage.google.com not working, but yesterday they were redirected to a completely different feed. Well I chose this day to install my son’s new computer – how do you think that went? Well, you would be wrong! I burned the .iso onto a CD and had the computer confirm that the burn was successful. When I took the CD over to the new computer it told me that the CD is blank. :shock: I got smart – just gave up, turned off everything, and went to bed with a book.

This morning at work I find, of course, that all tests from previous day failed. :sad:

Next Page »

Blog at WordPress.com.