Avatar

Michael's Blog

Home | RSS | Gallery | Stats | About | Comics | Downloads | Links | Scripts | Test Scripts | Wiki |

quickly remove old ssh keys with sed

2012-04-24 10:13:00.00 by Michael 0.0 Comments
Tags: sed linux ssh sysadmin

If you work on a lot of servers and do a lot of reinstalls you will see the following error often.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a8:6a:60:5a:48:64:ac:90:33:b9:f2:7c:be:56:92:81.
Please contact your system administrator.
Add correct host key in /var/root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:9948
RSA host key for host.example.com has changed and you have requested strict checking.
Host key verification failed.

To save some time you can quickly remove the old host key with a single sed command:

sed -i '9948d' .ssh/known_hosts

Building the wl module on linux 3.2

2012-04-02 21:57:00.00 by Michael 1.0 Comments
Tags: linux kernel hardware hacking

After upgrading my netbook kernel to the latest stable version available on backports.org I soon discovered that my wireless interface no longer worked. Trying to rebuild the module resulted in the following error:

/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c: In function _wl_set_multicast_list:
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1435: error: struct net_device has no member named mc_list
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1435: error: struct net_device has no member named mc_count
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1436: error: dereferencing pointer to incomplete type
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1442: error: dereferencing pointer to incomplete type
make[4]: *** [/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.o] Error 1
make[3]: *** [_module_/usr/src/modules/broadcom-sta/amd64] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-0.bpo.2-amd64'
make: *** [all] Error 2
root@netbook:/usr/src/modules/broadcom-sta/amd64#  run "make API=WEXT"
bash: run: command not found
root@netbook:/usr/src/modules/broadcom-sta/amd64# "make API=WEXT"
bash: make API=WEXT: command not found
root@netbook:/usr/src/modules/broadcom-sta/amd64# make API=WEXT
KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-0.bpo.2-amd64'
  CC [M]  /usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.o
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c: In function _wl_set_multicast_list:
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1435: error: struct net_device has no member named mc_list
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1435: error: struct net_device has no member named mc_count
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1436: error: dereferencing pointer to incomplete type
/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.c:1442: error: dereferencing pointer to incomplete type
make[4]: *** [/usr/src/modules/broadcom-sta/amd64/src/wl/sys/wl_linux.o] Error 1
make[3]: *** [_module_/usr/src/modules/broadcom-sta/amd64] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-0.bpo.2-amd64'
make: *** [all] Error 2

A bit of googling lead me to a few patches that helped solve the issue. Here is a unified diff of my changes which should allow you to cleanly build and install the wl module using module-assistant.

http://www.watters.ws/broadcom_bcm4313_linux3.2.patch

One thing to note is that the source code needs to be patched BEFORE you run m-a, i.e. cd to /usr/src/modules/broadcom_sta/amd64/src/wl/sys and run patch the patch from there.

I hope that somebody will find this useful.

Happy New Year!

2011-01-01 12:28:00.00 by Michael 7.0 Comments
Tags: holidays

Happy new year everybody. I know it's been a long time since I posted here but whatever.

2010 is over and we're ushering in a new decade. Hope everybody has a great year.

Happy Thanksgiving!

2009-11-26 13:16:12.58 by Michael 3.0 Comments
Tags: thanksgiving ascii shell

Hard to believe it's been a year since I posted this.

                              ,+*^^*+___+++_
                         ,*^^^^              )
                      _+*                     ^**+_
                    +^       _ _++*+_+++_,         )
        _+^^*+_    (     ,+*^ ^          \+_        )
       {       )  (    ,(    ,_+--+--,      ^)      ^
      { (@)    } f   ,(  ,+-^ __*_*_  ^^\_   ^\       )
     {:;-/    (_+*-+^^^^^+*+*<_ _++_)_    )    )      /
    ( /  (    (        ,___    ^*+_+* )   <    <
     U _/     )    *--<  ) ^\-----++__)   )    )       )
      (      )  _(^)^^))  )  )\^^^^^))^*+/    /       /
    (      /  (_))_^)) )  )  ))^^^^^))^^^)__/     +^^
   (     ,/    (^))^))  )  ) ))^^^^^^^))^^)       _)
    *+__+*       (_))^)  ) ) ))^^^^^^))^^^^^)____*^
    \             \_)^)_)) ))^^^^^^^^^^))^^^^)
     (_             ^\__^^^^^^^^^^^^))^^^^^^^)
       ^\___            ^\__^^^^^^))^^^^^^^^)
            ^^^^^\uuu/^^\uuu/^^^^\^\^\^\^\^\^\^
               ___) >____) >___   ^\_\_\_\_\_\_\)
              ^^^//\_^^//\_^       ^(\_\_\_\)
                ^^^ ^^ ^^^ ^^


 #    #    ##    #####   #####    #   #
 #    #   #  #   #    #  #    #    # #
 ######  #    #  #    #  #    #     #
 #    #  ######  #####   #####      #
 #    #  #    #  #       #          #
 #    #  #    #  #       #          #


  #####  #    #    ##    #    #  #    #   ####
    #    #    #   #  #   ##   #  #   #   #
    #    ######  #    #  # #  #  ####     ####
    #    #    #  ######  #  # #  #  #         #
    #    #    #  #    #  #   ##  #   #   #    #
    #    #    #  #    #  #    #  #    #   ####


  ####      #    #    #     #    #    #   ####
 #    #     #    #    #     #    ##   #  #    #
 #          #    #    #     #    # #  #  #
 #  ###     #    #    #     #    #  # #  #  ###
 #    #     #     #  #      #    #   ##  #    #
  ####      #      ##       #    #    #   ####

Download the script here: http://linuxshellaccount.blogspot.com/2008/11/happy-thanksgiving-unixlinux-ascii-art.html

Ubuntu Automatic Updates

2009-09-14 00:38:05.29 by Michael 2.0 Comments
Tags: ubuntu linux

If you're sick of the update notifier bugging you on your Ubuntu desktop you can easily set up a cron job to automatically take care of things.

sudo crontab -e
0 5 * * * apt-get -y upgrade

Change the time to whenever you want.

A Smile From Heaven

2009-07-23 18:17:21.50 by Michael 0.0 Comments
Tags: orthodox christian

This news is a bit old but I wanted to post and get the word out.

The Holy Great Monastery of Vatopedi on Mount Athos today mourns the dormition of our Elder Joseph of Vatopedi, one of the few remaining true Athonite elders who reposed this morning at 2:30, July 1, 2009. The Elder was born on July 1, 1921, on the celebration of the Holy Anargyroi (Saints Cosmas and Damian). After the dormition of his Elder, Joseph the Hesychast, he left the Skete where he lived and went to the Skete of the Holy Anargyroi. St Cosmas and St Damian were those who protected him throughout his life and those who chose to take him with them on the day of their celebration.

May his memory be eternal!

There's also a very interesting thread over at http://www.christianforums.com/t7387199/ with pictures, the most amazing part is that the expression on his face changed 45 minutes after his death. While I don't normally like viewing pictures of the deceased these are strangely reassuring.

SQL Query Optimization

2009-06-10 18:19:19.72 by Michael 0.0 Comments
Tags: postgresql mysql sql code

I've been updating the code for my site a bit to make things load a bit faster and one of the things I fixed was the random query generator.

SELECT quote, name FROM quotes ORDER BY RANDOM() LIMIT 1

The query above works great for small tables but consider the issue when you have a table with millions of rows, the server must read every row, sort them, and then throw out all the results but the first. This takes a lot of CPU time and is slow, the optimal solution is to use create a sequence as the primary key and then generate a random number using that. For example:

idx = select last_value FROM quotes_idx_seq

SELECT quote_text, name FROM quotes WHERE quote_id = '%s' %idx

It requires two queries instead of one but there is much less disk I/O required.

Tip of the Day

2009-06-05 14:51:43.50 by Michael 0.0 Comments
Tags: linux shell console

Directory '/var/run/screen' must have mode 777.

This is a fairly common error I've been seeing lately and the solution is quite simple.

chmod g+s /usr/bin/screen

Holy Pascha

2009-04-16 19:01:04.35 by Michael 0.0 Comments
Tags: religion life christianity orthodoxy

I haven't posted anything here for a while so I just wanted to take a moment to wish everybody a joyous Pascha. This coming Holy Saturday I will be baptized into the church, my days as a Catachumen are almost over.

I'm looking forward to the day and I'm sure it will be an extremely profound moment in my life, to be honest this is the first time that I've felt peace for a long, long time. Pics will be posted when I get them.

Also, I would like to quote the words of His Beatitude Metropolitan Jonah:

Let the fruit of our Lenten efforts be the enlightenment of our minds and the renewal of our hearts that our repentance not be in vain.

Let us sing with joy together with the Angels and Archangels, and all creation which has groaned awaiting the revelation of the Son of Man. With all creation, the living and dead, the spiritual and material, and with all the saints, let us cry:

Christ is Risen from the dead, trampling down death by death, and upon those in the tombs bestowing life!

Христос Воскресе из мертвых, смертию смерть поправ, и сусщим во гробех живот даровав!

Χριστος ανεστη εκ νεκρων, θανατο θανατον πατησας και της εν τοις μνημασι ζωην χαρισαμενος.

Market Freefall

2009-03-02 22:39:08.21 by Michael 0.0 Comments
Tags: economics DJIA dow

I originally posted about this back in October when this whole crisis started but as with all things econ there is a time lag between cause and effect. I have stated many times that I expect the DJIA to return to around the 5000 level and now many economists expect it to go even lower than that.

I'm not trying to spread gloom and no matter what happens I think we'll survive, humanity has made it through far worse times. One things for sure, the days of zero down, interest only loans are OVER.

Here's the latest graph I've made reflecting recent closing values.