Showing posts with label cygwin. Show all posts
Showing posts with label cygwin. Show all posts

Thursday, October 14, 2010

Cygwin: Update your packages / Install a new one in less than 5 minutes

[what is cygwin? like unix for windows. a better shell and command line.]
Actually, it's the same way you _install cygwin_ ..
Just faster because you don't have to download as much.

If you're installing cygwin for the first time, installing a single missing package,
or updating your install to the latest version, it's the same.
  1. Run cygwin's setup.exe -- the same one you used to install cygwin.
    This took me 2 minutes, because I couldn't remember where I put it.
    Better: just go to cygwin.com and click the Install or update Cygwin now! link and you'll have the latest installer.
  2. click, click, click, just click through, all your previous settings were saved.
    List of mirrors is downloaded
    ..hang?
    Pick a new mirror if you want. I used to think http: servers provided better downloads, but now I think they just hang more often. Use http: only if ftp: doesn't work for you (e.g. problems with ftp because you're behind a firewall).
  3. The list of packages is downloaded. This should be pretty quick; if you don't see any activity within 15 seconds or so, cancel and go back to 1.
  4. Select / search for the package(s) you want. Just type in the search area (e.g., cygrun) to find the package and select for install.
    (? if you don't know the package name.. where is a search for files ?)
    old ones are updated automatically ?
  5. Click next to install. All the package(s) are downloaded and installed.
    If it hangs, cancel and go back to 1. Maybe try a new mirror?
  6. "Can't install , file is in use" -- this can happen if
    1. you are running the .exe; for example, bash.exe and you have a bash.exe window open
    2. you are updating a .dll which is in use by your exe or service
    3. service is running, such as sshd. Do this:
    • open a cmd window
    • find the service(s) with the following command:
      net start | findstr /i cyg
      the service(s) names are printed
    • stop the service with
      net stop "CYGWIN sshd"
      replace with the name you have. (? other services besides CYGWIN ?)
    • click Retry on the dialog warning box
    • It should continue now. When you get to the end, remember to restart with
      net start "CYGWIN sshd"
      This is a generally useful way to stop/start services easily from the command line or from a script. If you prefer the slow way of clicking, you can run services.msc
  7. Finished!
    after updating my 1.5.x to 1.7.x, I get this for the cygrund package:
    Postinstall script errors
    Package: No package
    passwd-grp.sh exit code 1
    I got something like this when I first updated, but I haven't noticed any problem.
Actually, it could take more than 5 minutes, if there are slow downloads.
Once you get the hand of it though, it will probably only take two minutes to grab a missing package.

Because updating/adding a package is so easy, the first time you should click through and accept the defaults, then later adding missing features. I used to spend a lot of time going through all the packages, trying to decide if someday it might be useful. This just takes up more space, and more time later when upgrading.

Enhanced by Zemanta

Saturday, April 24, 2010

Setup sshd on cygwin in 4 minutes

4 steps, less than 4 minutes to do,
assuming: you have cygwin installed already, plus the requisite packages.
It took me less than twenty minutes (well, I had to perform some due diligence, even though I had done it before on another system. And the windows firewall issue).
All commands should be run in a bash shell unless directed otherwise.
  1. Check that you have cygrunsrv. The brute force method:
    $ cygrunsrv.exe -S sshd
    cygrunsrv: Error starting a service: OpenService: Win32 error 1060:
    The specified service does not exist as an installed service.
    If you get 'command not found', then you'll need to install the package.
  2. run ssh-host-config
    seemed to take a minute or so before I got any output, but maybe that's because my virtual machine didn't have much entropy for key generation.
    type 'yes' a couple times at the prompts, unless you don't want to.
  3. now install as a service:
    cygrunsrv.exe -S sshd
    when asked for value of CYGWIN, you can give:
    binmode tty ntsec

  4. start the service.. run services.msc (from a cmd window) or use 'net start'

All set?
Test from bash with 'ssh -v username@localhost'.
Now, test externally with 'ssh -v username@cygwinSshHost' .. if you don't see any output, windows firewall or other form of bandaid is keeping you out.

After you're logged in, do 'ssh-add -L >> ~/.ssh/authorized_keys2' so you don't need to type passwords to log in anymore (maybe on the second login, agent forwarding doesn't happen on a new host ?).

More steps, with more detail: How to configure cygwin for sshd .

Tuesday, October 6, 2009

Vista tweaks

I got a new laptop a couple months ago (Acer Aspire 5515), and it has Vista installed. Although a number of people have reported 'downgrading' to XP, I decided to give it a try.
(Acer has a download sight for drivers, Vista and XP. Don't know if it's complete, but looks like it. Is ATI South Bridge included?)
(Aspire 5515 might be tricky with SATA AHCI drivers -- see here.

Vista's not so bad; some days it doesn't even bother me. My computer would probably run faster with XP; if I get enough frustration and time I might try it...

Some things I have to change in windows:
  • CapsLock is control.. this is where the control key should be, and how it was before IBM decided to make a 'PC'.
    (set in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout)

  • focus follows mouse -- I don't need the window to be on top to type in it.
    "correct entry should be 9F for the first hexidecimal number. That should activate the x-mouse without bringing them to the forefront"
    (does this explain the registry flag bits ?)
    You have to open registry Editor then Navigate to following location [HKEY_CURRENT_USER\Control Panel\Desktop] For full X-Mouse, add +1h to the first number stored in binary key "UserPreferencesMask".
    For me, this was 9E, changed it to 9F.

another BartPE boot CD will work? (DVD?)
Ubuntu seems to work okay, haven't tried much..

What is the equivalent of BartPE for Vista? I did some research on this and found something that looks promising, but can't recall the name. I have it bookmark'd somewhere...

Still looking for problems with cygwin "file name too long" (using find/updatedb), stupid permissions problems (like from an external HD after copying files from another machine).
Maybe here: UTF-8 Cygwin

A cygwin package tool (like urpmi on mandriva--I like to just say "download and install the package that has curl" or netcat or gcc or whatever...).

random vista stuff: powercfg, scripting with jscript.. would like to be able to control e.g. windows media player with a javascript. What's the debugger/interpreter for playing with jscript on windows?

I should get a MacBook, then just install Linux here....

Monday, December 15, 2008

New cygwin install: "cannot create directory" for mountpoint

I installed cygwin on a 'new' machine (well, a fresh disk, after Encryption Anywhere made my old one unsalvagable). After the install (and a reboot, I believe) a new bash window gave me this message:
cygwin mkdir: cannot create directory `/cygdrive/m': No such file or directory
where M: is the (network) path to my home directory (aka %HOMEDRIVE% in windows). M: was available, but I couldn't get to it from cygwin. Also, I couldn't manually mount it.

After doing some research, I didn't find a solution. People who weren't logged in to their domain at the time seemed to have the problem occasionally, but I was logged in. Maybe rebuilding the passwd/group files? It wasn't affecting me at the time; I had other things to do, so I put it on hold.

At some point, I rebooted, and the problem was fixed... kind of annoying for a problem to fix itself like that, but that's Windows for you--good enough that you sometimes forget it's a substandard operation system.

Maybe this will help someone else from wasting time on a problem that might be fixed by rebooting Microsoft Windows. Remember when you had to reboot after any change?