Showing posts with label ide. Show all posts
Showing posts with label ide. Show all posts

Friday, March 20, 2015

Quick notes on using git (gitolite) + NetBeans + ssh keys

Most of my posts (hopefully) talk about something that might be useful/helpful to others. Others are to help me not repeat a mistake. This is one of the latter ones; don't expect it to be very impressive. Really. Just look the other way, or at least have the decency of waiting until to laugh at my expense. Deal?

If you remember, I setup a git server using gitolite and docker not long ago. And then I found out one of the future users wanted to access it using NetBeans in Windows. As I have never used that IDE before, I looked in its website and found some info on how to make it talk to github. Well that sounded promising. First place I got stuck was creating the ssh key pair. You see, I know how to use ssh-keygen in Linux/Unix/OSX, but did not know how to do that in Windows. I could install cygwin and do it command line, and that would be great for me but not as nice for a typical Windows user. And, I would be installing a lot of crap this user did not need.

Searching around the net, I found a quick article about how to generate a ssh key on windows using putty (that is exactly how it is called). Now we are making progress; we just need to go and get puttygen, whcih can be obtained by itself, and create the keys. Following the last link, I created a key pair -- 4092 SSH2 RSA without passphrase since this is a test -- as shown in the picture on the left (you can click on it to make it bigger or something). Note the field I highlighted; I will refer to it later. For now, let's ignore that.

Here is the second place I screwed up. At first I thought the buttons to export the public and private keys were what I needed. So, I clicked on them and saved the files. The fact it wanted to give the private key the extension .ppk should have woken me up, but I dozed through that. Completely.

But, as I completely ignored that warning sign, I went back to the NetBeans Instructions and put the private key where it should be. And then I put the public key in my gitolite server. And then tried.

And it did not work.

So I decided to take a look at the keys. Here is the private one (trimmed out a bit to show the format while keeping this article small):

PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: rsa-key-20150320
Public-Lines: 12
AAAAB3NzaC1yc2EAAAABJQAAAgEA1pA7YEyqbDyVAjjK+VCJpCGxfOwf8WGJ6J4Q
PaE1KMs0TBt5rEPlOpIdsJwOPMBvIUGG8hIHTyxrmOhxj221GYLPNSku7BdLCrt8
[....]
Q/G9k8opoE/0UPtFC0ykkGJg3Vhjq2XRGn3nYJaps7hP8ZUnvkiBuOmBR5SETnFi
3PrYFZ3lgYf1Nz2FgPMjg1uufIxWWv3MUb2Nya44x3JYQUkNfXCjUVmKiK/gE5sM
enufKa0=
Private-Lines: 28
AAACAFb8M79BrN/FiIRcNpxswi3IeGMTnj9DN+iuyFBWHHhSYU9JaK2e/BDTc9H6
E5wWqZfcS3bkttrofqXGBIZBO5S4fYRBINxAy2U3QG8mkBRWoBX/FuyztWBXxKug
pPIDWliV0oiTP0Q+PSXQ4LKTNcZm4UYlKg0Qk+ejR7FTpELqbv0nJQvMulvnEqVk
[...]
a6KahmtK1FFcFUtnLUFW+t7d59TYB/aB6HByzf5JDZPE9dtVpdBF33NSHe0Z4i2e
9XybtlNfYqKWEfaFzaeJqkyhRH5woG7le8GPU67BKVg/mKHYnG3Tk93NvhcOXuyx
7I2AKDeR1M0qMl0aH0ympymKoNxJHD2CBweLyJSoG3QdXY5DxoRvdn/gMeGRdLp0
mR80D0IN/tUduNT/69lB+I1oTU4N+WB/NcHCicOZyzHQRIKnmHC/raBM5ln2Q/ih
qtM=
Private-MAC: 56aa3a9bcb05a65a89110a5de990d5021cfb9273

It sure does not look like the ones I created using ssh-keygen. The public key also looked a bit different. Then it hit me: because gitolite uses openssh, it expects the key to be puttygen is exporting the keys in a different format. So, how do we make this work? Well, do you remember the field I highlighted in the first picture? That is the public key already in the ssh format; that is what gitolite needs. So, cut-n-paste that to, say, smurf.pub inside the keydir directory in the gitolite config file.

Next is to export the private key in the right format. That is done by clickign on Conversions->Exporting OpenSSH key, naming it as something helpful; I named mine smurf_rsa to remind me I happened to have created a RSA key.

Time to go back to Netbeans. The picture on the left shows the setup I used. I was in a hurry so I used the testing repo, which is a bit of a village bicycle in my server: everyone who can connect to localgit can access, read, and write to and in general monkey with it. The key was fed and then I told it to finish. This time it worked or seemed to: proceeded to want me to create a project (with all the little files and directories the IDE creates). I let it do the deed and later on was able to check out what was created.

The moral of this tale is make sure you use the right key format or things will get very interesting. Either that or only drink warm beer if the fridge was built by Lucas, the Prince of Darkness. Or something like that. On the bright side, you managed to reach the end of this tale! You now may put your seat and tray in the upright position and start to laugh.

I did.

Tuesday, May 01, 2007

Installing OSX 10.4 without DVD player

Ok, so have here a 12" ibook that did not come with a DVD player. To its left I have the OSX 10.4 DVDs. I have to install 10.4 in the iBook. How to make them play together? Good question. Well, Apple does have a tradeup program in which you send out your 10.4 DVDs, proof of purchase, and a check of $9.95 or thereabouts and, in a few weeks, you get a 10.4 CD set. Kinda nice but this is not what we are going to do. I do not want to have to wait for a few weeks to get this taken care of. I want it now!

How to do that? Well, let's go over the different steps I tried and figure out, hopefully, why they went boink.

Boot from the built-in CD drive

Well, that one did not work out. We knew that because that is the entire reason I am writing this. This ibook has a built-in CD player, not a DVD player. If this was a desktop, chances are you could easily swap the drives. That is what I did before with a B&W Powermac G3.

Boot from an external USB DVD drive

I have an external USB dual layer DVD burner; why not use it? Well, possibly the reason is that it does not work. At least it did not work for me. I tried it and it cheerfully ignored the drive. I tried booting and holding the key sequences to boot from the cd -- I think it thought I wanted to boot from its built-in drive -- and to ignore its internal drive. Either way it did not; it kept cheerfully trying to boot from the internal hard drive.

Boot the ibook at a firewire device attached to my other ibook.

Now we are getting fancy here. From experience, I know I can make my Cube and my 14" iBook G4 to, at boot, become external hard drives that can be then connected to another machine through the firewire port. Ok, the Cube books in FW mode but right now I am having a few problems seeing its hard drive, but that is another story and I am digressing here.

External firewire drive.

Since the 12" ibook does not want to be a firewire device, what if we give it a firewire device, say, another hard drive? Well, I happen to have a USB2/Firewire case and a 10GB ATA (IDE for you old school crowd) doing nothing. So, I put the drive in the case and connect it to my 14" ibook, not to the 12" ibook just yet. There is reason behind my madness, believe it or not. So, I then boot the 14" ibook from the OSX dvd (remember this machine has a dvd player) and tell it to install tiger on the 10GB HD. After that is done, I then connect the drive to the 12" ibook and boot it. As the internal drive had no OS (I deleted it some time ago) installed, it went and found the external drive and booted from it! It seems I am on the right track.

Now let's make life more interesting. Once again I booted my 14" ibook and then connected the external drive and inserted the osx dvd. I then unmounted but not removed the firewire drive. That is an important step. I made a point to write down the firewire drive was being seen as /dev/disk2s10 and the dvd player is /dev/disk3s3. Now, there is probably a clever more Mac-like way to do this next step. But I do not know how to do it. So, I did it the unix way: I started a terminal session and entered the following command:

Mireille:~ dalek$ dd if=/dev/disk3s3 of=/dev/disk2s10
11712744+0 records in
11712744+0 records out
5996924928 bytes transferred in 11166.592623 secs (537042 bytes/sec)
Mireille:~ dalek$

I then connected the drive to the 12" ibook and rebooted. It thought the external firewire hard drive was the OSX dvd disc 1 and started the installation process! What about the disc 2? Well, I just put it in the external DVD burner and connected it to an available usb port in the 12" ibook. It happily continued installing from it.

Problem solved!

One day, when I am really bored I will try to put a dvd player in the firewire case and see if it can boot like that. In the mean time, I finished getting that 12" ibook running tiger and that is all I wanted to do for now. Next time perhaps I will have a quiet talk with a certain cube...

Monday, April 30, 2007

The case of the SunPCI 2 card

I have sunpci 2 pro card. Ok, I have a sunpci 1, a sunpci 2, and a sunpci 2 pro cards. Why, you would ask. Well, I thought the idea was clever: make a PC in a card (the predecessor of the blades?) and slap it inside a computer. The hardware approach has its benefits -- what would be better emulator than a complete computer? -- compared to emulated ones, specially if the host hardware is completely different. Many manufacturers have done similar things one time or another, but the tendency now if of course software-based emulation since modern machines seem to have the horsepower to make it work. Still I like to have that card as it has its own serial, parallel, VGA, ethernet, and usb ports.

And, as it turns out, its own IDE port.

Come again? Yes, it has an IDE port. I've always looked at the card during the boot process, and when checking its cmos, that it did check for IDE drives. But, it did not have a place to connect the cable to it. Well, there is an place on the board that does not have a connector in it. Upon checking it, I realize it has 40 pins. Hmmm, what if it was an IDE connector? After all, if you boot the card it seems to have everything it needs to use an IDE disk.

So I soldered a connector on it and then installed the card in a Ultra 60 running Solaris 10. I then boot the machine up as it was, just to make sure I did not screw anything up. So far so good. I then connected a 4.3GB IDE Hard drive I had doing nothing to it and rebooted. As you can see from the attached screen captures, the hard drive was seen by the card.

It would probably be a good time to find a way to mount a drive in the case; if you opened it you will remember that it really does not have much free space. For now I will leave it in one of the empty 3 1/2" drive bays; I may later make a bracket to put the drive somewhere else. Now the big question in my mind is can I boot the sunpci card off the ide hard drive? I don't know yet, but it would sure open a lot of nice possibilities. First we need to answer a few other questions. If I install, say, XP in the card, would it see the hard drive and be able to format and mount it? Also, would it be any limitations on the size of the hard drive or which devices I can slap to the ide cable? How about a cd burner or dvd player? Finally, would it be possible to slap a cdrom to that cable and install the OS off it (as opposite from the U60's dvd player)?