Saturday, October 27, 2012

Windows 8 Can't activate FIX

So all of you guys got stuck with activation after an upgrade installation. If you see the following error:


"The software Licensing Service determined that this specified product key can only be used for upgrading, not for clean installation".

The remedy:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OOBE
MediaBootInstall -> 0

After saving that, pull up an admin  cmd (Win key, type cmd, right click on it and pick Run As Admin) and type:

slmgr /rearm
After rebooting your system activate it.

Monday, March 19, 2012

Engineering 101 - Measurement

I wish everybody were on the same page with engineering. It is hard to explain the importance of data gathering and statistical approach to computing in a lower scale environment. Classical troubleshooting is like: "I check the logs!". Well if there is nothing in the logs because you did not enable logging and even if there is something you don't know were to look or for what pattern to look for, then you are unlucky. Even small number of nodes can be analyzed with statistical methods, looking for outliers helps. These terms and methods are mostly unknown to classical system administrators, they never had to troubleshoot complex problems, so they don't see any value having a data store with all the system level metrics for their nodes. Luckily more and more corporations discover the importance of proper metrics and monitoring system.
Here are few examples:
http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/
http://jedi.be/blog/2012/01/03/monitoring-wonderland-metrics-api-gateways/
http://code.flickr.com/blog/2008/10/13/flickr-digs-ganglia/

Monday, February 13, 2012

Installing a certain version of software with homebrew

Homebrew is making our lives easier on MacOS, letting us to install software from source. One feature which makes it exceptional is the version handling. Lets install the previous version of Erlang.
 #cd /usr/local/Library/Formula  
 #git checkout 9332ca9 /usr/local/Library/Formula/erlang.rb  
 #brew install erlang  
Basically the Formula directory is a git repo, therefore you can just checkout a branch which you would like to install and tada! Easy.

Friday, January 20, 2012

Installing Ruby 1.9.2 on Fedora 16

For some weird reason there is no official 1.9 branch available on Fedora at the moment. Here is what you do to get Ruby installed:


rvm pkg install zlib

rvm pkg install openssl

rvm install 1.9.2 --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr

rvm --default use 1.9.2


Saturday, December 10, 2011

Three ubuntu bugs for newbies

I am sick of listening to people telling me how great is Ubuntu and how secure is linux, because they are just plain wrong. There is no other operating system on Earth which has the same amount fucktards as Ubuntu.

Here are few examples why:

1. SUID Mount Helper has 5 Major Vulnerabilities

https://bugs.launchpad.net/calibre/+bug/885027

Best parts:

Dan: "There are already ways to safely achieve what you're trying to do without introducing security vulnerabilities. Ubuntu implements automatic mounting of USB media using udisks in conjunction with gvfs-gdu-volume-monitor. If this isn't an option, the "pmount" application allows users to safely mount and unmount removable media without introducing (obvious) security holes."

Kovid: "Kindly do not lecture me about using a setuid exececutable. Shocking as that may seem, I am actually aware of the dangers, and even if I weren't, rest assured that plenty of your ancestors have pointed it out to me in the past four years. Is it bad to have suid executables, yes. Is there a workable alternative, no."

The obvious question is: how could somebody say after this thread that linux/ubuntu is more secure than for example windows or any other linux distribution? This guys has no clue about security and when a well known security expert points out his mistakes he turns into a whinging bitch. Well done. Lets have a look to a non-security bug.

2. netcat-openbsd exits too soon

https://bugs.launchpad.net/ubuntu/+source/netcat-openbsd/+bug/544935

This bug is a classical example of ignorance and lack of technical skills. It is so obvious from the very first moment what the developer did is plain wrong and he managed to introduce an ubuntu specific bug with his code, yet, he is trying to play smart and not to fix the bug. As you can see in the comments, many engineers wasted multiple hours on investigating what is wrong with a certain service because they would never think that netcat is broken. This proves how ubuntu is bad for any business organization by adding several hours of unnecessary work. No wonder why redhat is THE linux distro for corporations.

3. pam_motd: assume update-motd responsibilities

https://bugs.launchpad.net/ubuntu/+source/pam/+bug/399071

This bug -or feature as they call it in ubuntu circles- is showing how these guys totally ignoring Unix principles. There is no excuse to ship your OS with out of date documentation. I like my motds static. :) 

Next time if somebody tells you how great is ubuntu please slap him on the face with this post.

Wednesday, October 26, 2011

my .vimrc

Here it is:
set nocompatible  
set bs=indent,eol,start  
set ruler  
syntax on  
set hlsearch
set tabstop=2

Tuesday, August 16, 2011

systemd in Fedora 15

One of the new features in Fedora 15 is systemd, which is meant to be the SysV init replacement. I am curious how good is the backward compatibility. :)

See more in man:

NAME
systemd, init - systemd System and Service Manager

SYNOPSIS
systemd [OPTIONS...]

init [OPTIONS...] {COMMAND}

DESCRIPTION
systemd is a system and service manager for Linux operating systems. When run as first process on boot (as PID 1), it acts as init system that
brings up and maintains userspace services.

For compatibility with SysV, if systemd is called as init and a PID that is not 1, it will execute telinit and pass all command line arguments
unmodified. That means init and telinit are mostly equivalent when invoked from normal login sessions. See telinit(8) for more information.

When run as system instance, systemd interprets the configuration file system.conf, otherwise user.conf. See systemd.conf(5) for more information.

http://www.freedesktop.org/wiki/Software/systemd

Monday, April 25, 2011

datacenter redundancy and amazon's ebs outage

Synopsis

I have seen many of good and bad articles on the (probably biggest) AWS outage. I guess the companies like Reddit did not know what datacenter redundancy means and therefore they went down together with that single availability zone where their service is located. This is neither desired nor optimal solution they have.

Regions and Availability Zones

Let me shed some light on the datacenters and availability zones and how these things are mapped. Infrastructure is divided into regions. A region is divided further into availability zones, usually shortened to AZ, you can think of this as a classical datacenter.

./bin/ec2-describe-regions

REGION  eu-west-1       ec2.eu-west-1.amazonaws.com
REGION  us-east-1       ec2.us-east-1.amazonaws.com
REGION  ap-northeast-1  ec2.ap-northeast-1.amazonaws.com
REGION  us-west-1       ec2.us-west-1.amazonaws.com
REGION  ap-southeast-1  ec2.ap-southeast-1.amazonaws.com

And now check the availability zones.

./bin/ec2-describe-availability-zones 

AVAILABILITYZONE        us-east-1a      available       us-east-1
AVAILABILITYZONE        us-east-1b      available       us-east-1
AVAILABILITYZONE        us-east-1c      available       us-east-1
AVAILABILITYZONE        us-east-1d      available       us-east-1


Imagine the worst case scenario, you lose an AZ. Why am I so sure about it? Usually the big enterprises roll out changes incrementally to different locations, but never at the same time to all datacenters (AZs). External threats like lighting hits, floods, fires usually damage one DC as well. I am not saying it is impossible to lose all the DCs in a region, but it is highly unlikely.

Service Availability

We can do some maths on this, just to prove the point. According to the EC2 SLA doc the aim is provide 99,95% availability for any given region. The region is unavailable if more than 1 AZ is not reachable.

A=1-(1-Az)^N

Based on this equation, the service availability looks like the following:


DC availability : 0.9   No. of DCs: 1 Service availability: 0.9
DC availability : 0.95  No. of DCs: 1 Service availability: 0.95
DC availability : 0.99  No. of DCs: 1 Service availability: 0.99
DC availability : 0.9   No. of DCs: 2 Service availability: 0.99
DC availability : 0.95  No. of DCs: 2 Service availability: 0.9975
DC availability : 0.99  No. of DCs: 2 Service availability: 0.9999
DC availability : 0.9   No. of DCs: 3 Service availability: 0.999
DC availability : 0.95  No. of DCs: 3 Service availability: 0.999875
DC availability : 0.99  No. of DCs: 3 Service availability: 0.999999
DC availability : 0.9   No. of DCs: 4 Service availability: 0.9999
DC availability : 0.95  No. of DCs: 4 Service availability: 0.99999375
DC availability : 0.99  No. of DCs: 4 Service availability: 0.99999999

There is a really nice article on wikipedia what this means by day, week and year.

http://en.wikipedia.org/wiki/High_availability#Percentage_calculation

Conclusion

Having 3 elastic IPs in the same region but different availability zones, gives the most of the companies suitable uptime for their service. SQL replication is available for all of the platforms (including MySQL). From now, the faith of your website is in the architect's hand, unnecessary to blame any cloud provider if you put all your servers into a single AZ/DC and it goes down.

Tuesday, April 19, 2011

Linux security myth

It is always said that open source is more secure, because anybody can spot bugs, and everybody will find bugs...

The reality is, most of the bugs are found by security professionals. See following slides.

142 CVE's assigned
● 30% worse than the previous worst year (2009)
● Based on public CVE requests, issues tracked at 
Red Hat Bugzilla, and Eugene's tagged git tree
● Missing dozens of non-CVE vulnerabilities (i.e. the 
“Dan Carpenter factor”)

61 (43%) discovered by six people
● Kees (4), Brad (3), Tavis (7), Vasiliy (4), Dan (37), 
Nelson (6)

http://jon.oberheide.org/files/stackjacking-infiltrate11.pdf

Blackhats might hate him :)

Monday, March 28, 2011

rackspace denies to open my account

Daytona B: Hello there, how can I help you?
Customer: the registered username is xxxx
Customer: Dear Customer,

Unfortunately there was a problem verifying your Rackspace Cloud account. We have placed a temporary hold on it until we can verify your account status. To lift the hold and confirm your account, please call a member of our support staff at 1-877-934-0407, or international +1.210.581.0407.

Daytona B: Just a moment
Daytona B: Unfortunately we will not be activating your account. At this time I would suggest you go with another hosting provider.
Customer: what?
Customer: are you kidding me?
Customer: i am going to post this to the internet and let everyone loling on you

Rackspace has more money they need. They reject mine. This is not the only reason why I suggest everybody to use Amazon... :)

Monday, March 21, 2011

AMD man talks rubbish

That's all well and good, but plenty of game devs, says Richard Huddy, head of AMD's developer relations team, don't want any API at all. Huddy points out the sadly obvious fact that modern graphics cards can pretty much stomp any console hardware into the dirt in a straight fight and yet fail to show the full extent of their superiority in actual game visuals. He'd prefer to see developers given direct low-level access to the hardware, so they can maximize their own talents and really push things forward.

Imagine the world where you can see BSODs due to work of talented 3D programmers . I have got enough of simple drivers, like Intel wifi, written by talented idiots causing blue screen every so often, and the blame goes to Microsoft of course. No guys, you gonna be kept in cage and forced to learn how to use the API, for everybody's benefit.

Thursday, March 3, 2011

Ubuntu meets rc scripts

Back in time when developers were working on software, and system engineers where managing systems we had a beautiful utility in all the unix-like clones called RC. From the manual:


The rc utility is the command script which controls the automatic boot
process after being called by init(8). The rc.local script contains com-
mands which are pertinent only to a specific site. Typically, the
/usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but
if you want to use rc.local, it is still supported. In this case, it
should source /etc/rc.conf and contain additional custom startup code for
your system. The best way to handle rc.local, however, is to separate it
out into rc.d/ style scripts and place them under /usr/local/etc/rc.d/.
The rc.conf file contains the global system configuration information
referenced by the startup scripts, while rc.conf.local contains the local
system configuration. See rc.conf(5) for more information.

The rc.d/ directories contain scripts which will be automatically exe-
cuted at boot time and shutdown time.

It does what the manual says, you can start/stop services with it and it handles the boot/reboot/shutdown processes to halt your system gracefully. It is in place since 1980, according to the manual.

HISTORY
The rc utility appeared in 4.0BSD.

Nowadays it is pretty popular to demolish what is reliable and working fine just for the sake of showing some sort of programming skills, as it has happened many times in the short but noisy history of Ubuntu. It is enough to have a look of the infamous netcat bug:

https://bugs.launchpad.net/ubuntu/+source/netcat-openbsd/+bug/544935


Today I encountered the following tragicomedy on launchpad:

https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/430224

Best comments:

"For me, the right solution would be that the init daemon could be made aware of chroots, e.g. through a config file. It'd then read the /etc/init directory inside the chroot, and manage those jobs along-side those in the real system"

"Replacing /sbin/initctl with a symlink to /bin/true is a fairly standard
way to disable services in a chroot."

Scott James Remnant (Canonical)

Linux is getting really messy.

Monday, February 14, 2011

YoLD - Year of the Linux desktop

So it isn't the kernel, it's not libflashplayer.so, and it doesn't seem to be alsa-lib. If it's not pulseaudio, then what else is involved in sound generation?

And then:

Normally, a memcpy that copies _downwards_ (like the one above) will work perfectly well in practice, because the "natural" way to do memcpy() by making it just copy things upwards will "just work" even for the overlapping case.

So it would be a bug to use memcpy for overlapping areas, but it would be a bug that normally would never show up.

But if the new improved 64bit memcpy started copying things backwards, it might cause trouble with such an overlapping memcpy user.

So, this is how linux development works. Getting things better. The year of Linux desktop!!@#!@ Here we come...

https://bugzilla.redhat.com/show_bug.cgi?id=638477#c14

Saturday, February 12, 2011

netsh 101

Just a quick head up about netsh.

Some examples for the most common scenarios:

list dns server(s)

>netsh int ipv4 show dns

list ipv4 address(es)

>netsh int ipv4 show addr

list ipv6 address(es)

>netsh int ipv6 show addr

list ipv4 interfaces

>netsh int ipv4 show int

show route ipv4 information

>netsh int ipv4 show route

List of available commands:

netsh int ipv4 show

The following commands are available:

Commands in this context:
show addresses - Shows IP address configurations.
show compartments - Shows compartment parameters.
show config    - Displays IP address and additional information.
show destinationcache - Shows destination cache entries.
show dnsservers - Displays the DNS server addresses.
show dynamicportrange - Shows dynamic port range configuration parameters.
show global    - Shows global configuration parameters.
show icmpstats - Displays ICMP statistics.
show interfaces - Shows interface parameters.
show ipaddresses - Shows current IP addresses.
show ipnettomedia - Displays IP net-to-media mappings.
show ipstats   - Displays IP statistics.
show joins     - Displays multicast groups joined.
show neighbors - Shows neighbor cache entries.
show offload   - Displays the offload information.
show route     - Shows route table entries.
show subinterfaces - Shows subinterface parameters.
show tcpconnections - Displays TCP connections.
show tcpstats  - Displays TCP statistics.
show udpconnections - Displays UDP connections.
show udpstats  - Displays UDP statistics.
show winsservers - Displays the WINS server addresses.

Sunday, January 30, 2011

robocopy backup meets symlinks in windows

Since I use robocopy to backup all my stuff I had trouble with the default configuration of Windows 7 because all the "My" folders are included in the "My Documents" folder and it makes robocopy to backup everything (but your real documents, isn't this ironic?) twice.

Windows 2000 or above supports symbolic links but the Redmond folks forgot to provide any tools to remove or create symlinks and by default you get some really fucked up one. Maybe the importance of this matter is not enough high but for fuck sake, if you have a freaking feature provide some tool for it!

Mark Russinovich saves our life not the last time with his tool, called Junction. This guy should be the vice president of operating systems division of Microsoft, but than there would not be any chance for competitors. Anyways, I downloaded his tool and got rid off the symlinked stuff in the documents directory.

C:\Users\user\Documents>junction -d "My Music"

Junction v1.06 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

Deleted My Music.

C:\Users\user\Documents>junction -d "My Pictures"

Junction v1.06 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

Deleted My Pictures.

C:\Users\user\Documents>junction -d "My Videos"

Junction v1.06 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

Deleted My Videos.

Happy days, afterall.

So back to robocopy. I was looking for a tool to backup all my stuff, and I have encountered this tool. I am using the following commands from a powershell script:

http://support.microsoft.com/kb/160513

robocopy C:\Users\user\Music E:\music\ /MIR /Z /NP /LOG:C:\Users\user\Desktop\logs\music_e_$(Get-Date -format yyyy_M_d).log.txt
robocopy C:\Users\user\Pictures E:\pics\ /MIR /Z /NP /LOG:C:\Users\user\Desktop\logs\pics_e_$(Get-Date -format yyyy_M_d).log.txt
robocopy C:\Users\user\Documents E:\docz\ /MIR /Z /NP /LOG:C:\Users\user\Desktop\logs\docz_e_$(Get-Date -format yyyy_M_d).log.txt

Tuesday, October 19, 2010

The most secure operating systems worldwide

Do you know which operating system is the most secure one? I have the answer for you! Right here, right now, for free!!

http://lists.centos.org/pipermail/centos/2010-October/100034.html

The only problem is with this statement the unfortunate happening yesterday.

http://seclists.org/fulldisclosure/2010/Oct/257

--------------------
Affected Software
------------------------

At least the following versions have been tested

2.12.1, FC13
2.5, RHEL5 / CentOS5

The most secure operating system worldwide? U mad bro?

Friday, September 24, 2010

Narcissism of minor differences

I am loling my head off. This is so true.

The Linux Zealot typically displays an irrational hatred of Microsoft, a complete conviction that his choice of operating system is the only valid one, and a scathing patronising contempt of anyone "stupid" enough to use "windoze"*.

What causes this mindless OS bigotry? you may be wondering. Well, the father of modern psychoanalysis - Professor Sigmund Freud proposed an idea which he called the "narcissism of minor differences". Put simply it means that people hate other people who are very similar to them. This similarity threatens their sense of individuality, their sense of self, causing them to react in a hostile manner, which seems to become more hostile, the closer the similarity.

http://www.adequacy.org/stories/2002.2.28.112557.148.html

Friday, September 17, 2010

iconv gem fails to install on FreeBSD

sigh, a new linux only developer in the ruby biz.

/usr/local/bin/ruby18 extconf.rb
checking for iconv() in iconv.h... no
checking for iconv() in -liconv... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby18
        --with-iconv-dir
        --without-iconv-dir
        --with-iconv-include
        --without-iconv-include=${iconv-dir}/include
        --with-iconv-lib
        --without-iconv-lib=${iconv-dir}/lib
        --enable-config-charset
        --disable-config-charset
        --with-config-charset
        --without-config-charset
        --with-iconvlib
        --without-iconvlib
[root@irkmaffia ~]# ls -larth /usr/local/include/iconv.h
-r--r--r--  1 root  wheel   9.0K Aug  7  2009 /usr/local/include/iconv.h

Actually I didn't know that you can pass parameters to the build script using the following:

[root@irkmaffia ~]# gem install iconv -- --with-opt-dir=/usr/local/
Building native extensions.  This could take a while...
Successfully installed iconv-0.1
1 gem installed
Installing ri documentation for iconv-0.1...
Installing RDoc documentation for iconv-0.1...
[root@irkmaffia ~]# gem install iconv -- --with-opt-dir=/usr/local/



I played tada.wav

Sunday, August 1, 2010

RMSism in 2010

Can's stop loling on this:


6. ZorbaTHeHut: Ten years ago, GNU/Linux was pulling itself out of the depths,
supported on the shoulders of the FSF. GCC was the compiler of choice
and people looked forward to Hurd. The GPL seemed to be the future - a
network of GPL-licensed software was rapidly spreading across the
software ecosystem. Today, relatively few people care about the Linux
kernel itself. The focus has moved towards the operating systems built
upon GNU/Linux, with Ubuntu at its forefront. Meanwhile, the Linux
kernel, while impressive, is Mostly Good Enough - there have been few
must-have improvements in the last few years, with the majority of work
going towards software that runs on it. The BSD kernels are catching up
rapidly, to the point where some "Linux distributions" now have BSD
kernel options. The Linux kernel itself is stuck on a GPLv2 license,
the GPLv3 Hurd is near-stagnant, and even GCC is finding itself
threatened by the BSD-licensed LLVM+Clang.

RMS: That states many claims, some of which I think are true, while others
seem exaggeratedly negative. My overall response is that I don't see
anything that all these points are particularly relevant to.

http://blog.reddit.com/2010/07/rms-ama.html

This guys should wake up. License trolling is not something smart and MySQL is the best example that it won't save projects from death at all. Quality, responsible and smart developers, good community, these are the ingredients of success.