The stuff I always install on a Debian box

Sitting here installing a brand new box, I look through what I use on other machines and figure out a list of things I want to have installed on any box I’m on. Here’s the list so far, in no particular order:

  • vim – my favorite text editor
  • ssh – the secure shell server and client – a must.
  • realpath – gets the full pathname of a given file. very useful in scripts
  • autossh – keeps ssh connections open on its own. very useful for ssh tunnels.
  • sysstat – various performance tools, like mpstat to see the individual cpu usage in an smp setup
  • sudo – allows normal users to execute things as root. mind-bogglingly useful
  • preload – tracks which applications are frequently used and tries to keep them in memory to improve startup times
  • lshw – prints way more information about your machine than you really need
  • sysv-rc-conf – a nice tool to set at which runlevels the machine should start and stop services
  • console-setup – pretty, pretty console fonts (terminus)
  • pastebinit – lets you pipe output to most pastebins from the console. EXTREMELY USEFUL
  • ccze – pipe stuff to this program to colorize the output. “sudo tail -f /var/log/messages | ccze” = bliss
  • hdparm – sets various drive parameters for IDE drives, such as spindown time etc. also performs speed tests
  • logwatch – sends you a nice log summary every day
  • build-essential – compilers, kernel headers and other stuff which is damn useful
  • deborphan – finds autoinstalled packages which are no longer necessary
  • module-assistant – compiles and inserts modules on the fly with a running debian kernel. brilliant. remember to execute “m-a prepare” to get additional stuff it needs, including the kernel headers for your currently running debian kernel, which is always useful to have around
  • kernel-package – stuff needed to compile new kernels the debian way.
  • psmisc – contains the all important “killall” command
  • beep – makes a pc speaker beep. very useful to put at the end of a long series of commands
  • yafc – yet another ftp client, but my favorite one
  • lftp – easily scriptable ftp client – use this for all synchronization (which doesn’t support encryption)
  • rsync – for remote file synchronization
  • realpath – finds the real path of a file. useful in scripts
  • screen – allows several virtual consoles in one
  • p7zip-full – for those pesky 7z-archives which have suddenly started to appear everywhere
  • wget – if it’s not there, it damn well should be!
  • unace – file extraction
  • unrar – file extraction
  • unzip – file extraction
  • watchdog – keeps an eye on the computer and restarts it if it hangs (hopefully)
  • irssi – irc chat. it’s always useful to be able to reach #debian on irc.freenode.net
  • sshfs – utilities to allow remote mounting of directories through ssh. insanely useful. also installs fuse
  • smbclient – utilities to allow remote mounting of samba shares (windows shared directories)
  • smbfs – utilities to allow remote mounting of samba shares (windows shared directories)
  • nmap – simple portmapping utility. very useful.
  • nbtscan – scans for machines with windows shares. also useful sometimes.
  • rungetty – allows for autologin to consoles and, for instance, displaying the system log in a tty without having to log in. woo.
  • mutt – console-based email client
  • ntp – clock synchronization
  • ntpdate – manually query time servers
  • nload – displays network traffic graphs in the console
  • file – identifies filetypes by content
  • autofs – automatically mounts and unmounts preset filesystems when they are needed
  • fakeroot – useful for compiling stuff

And a one-liner to install them all and beep afterwards, for my own copy-pasting delight:

apt-get install ssh vim sudo ccze ntp lshw watchdog realpath sysstat nload \
sysv-rc-conf preload autofs pastebinit fakeroot file console-setup lftp \
autossh p7zip-full deborphan ntpdate nmap hdparm logwatch mutt nbtscan \
rungetty build-essential screen module-assistant kernel-package psmisc beep \
yafc rsync wget unzip unrar unace irssi sshfs smbclient smbfs &&
m-a prepare &&
update-alternatives --set editor /usr/bin/vim.basic &&
beep

more to come, probably…

anything to add to the list of incredibly useful stuff? comment!

SMS Message Recieved Confirmation – IMPLEMENT IT PROPERLY

Okay. If you have a cell phone, you’ve probably sent an SMS or two. I hate writing them, but sometimes they’re useful. When you’re on the subway and the connection goes in and out constantly, when you’re in a meeting, sending something which needs to be remembered or simply when you need to say something to someone you can’t stand talking to. (more…)

How to reset the root password on a Debian machine

Today I had to bring up an old virtual machine which was used to test some homebrew modifications to the apache webserver. The root password, of course, was nowhere to be found. What can you do?

There are several ways around this issue. A regular Debian system (etch) is normally set up to use the /etc/shadow file to store encrypted passwords. These lines appear like this:

bolt:$1$sR2twkpPvBql2ThisIsNotMyPassword3UzzB:0:99999:7:::

Perhaps the easiest way to replace the password is to boot up from any bootable linux livecd which has support for the filesystem you’re working on. In my case it’s the ext3 file system and the easiest available bootcd was the Debian installation disc.

All you have to do with this is boot from the CD, execute a shell, mount the partition in question, edit the /etc/shadow file and replace the password hash with something you know what is, perhaps from the shadow file on your own box (the password hash is the garble between the first and second colons).

In my case, however, I couldn’t be arsed to find the CD. What can you do without one?

Luckily, there was no password on the GRUB install. This means that when the boot menu shows up, I can press “e” to edit the selection and then press “e” again on the line starting with “kernel”. The whole line reads like this:

kernel  /boot/vmlinuz-2.6.18-4-686 root=/dev/sda1 ro clocksource=pit

All that’s needed here is to change “ro” to “rw” (or you can’t set the password with ‘passwd’) and append “init=/bin/bash“. This makes the system boot up throwing you straight into bash as root, rather than run its regular init routines.

Press “b” to boot.

Pretty soon you’ll end up with a prompt saying “root@none:~“. Unless your box is named “none” this might come as a surprise, but don’t fret. You are logged in on your box.

Then just run the regular “passwd” command to change root’s password.

Voila!

..another useful thing to do here, which is what I actually ended up doing is edit the /etc/shadow file, replacing root’s password string with a single star (*) and then editing /etc/passwd and remove the x after the first colon on root’s line, leaving it as “root::0:0:root:/root:/bin/bash“. This allows you to log in as root without entering a password at all. NOT RECOMMENDED FOR GENERAL USE.

Intellisense issues in Visual C++ 2005

This content has been deliberately stolen from http://blogs.msdn.com/yash/archive/2007/09/19/intellisense-issues-in-visual-c-2005.aspx and saved here for personal reference.
All credits to that page.

Intellisense issues in Visual C++ 2005

When we are working with Visual Studio IDE, sometimes we encounter issues related to intellisense. The main objective of this article is to provide some basic troubleshooting steps to overcome some of the issues.

Lets first start with a basic understanding of IntelliSense Support in Visual C++

What is the issue?

  • Intellisense doesn’t work at all.
  • Intellisense is very slow (Giving Updating Intellisense… in status bar)
  • Intellisense fails causing Visual Studio to exit or Hang forever.
  • Intellisense doesn’t work for a part of the solution.

1. Verifying Intellisense issue (or Disabling Intellisense)

There are chances that we are misinterpreting some issues with Intellisense. We can verify this by disabling Intellisense in VC++. There is a file called feacp.dll in <VS8INSTALL>\VC\vcpackages folder. Renaming this file will disable Intellisense feature.

After disabling, if we can work with the IDE without any other issue then we can say for sure that Intellisense is causing the problem.

2. Is there any corrupt file(s)

If you are having some intellisense issues related with Project References, then you may also need to check the version of both the feacp.dll and vcpkg.dll files.

Here is a related KB article which links to the latest version of fix for this issue :
The intention to point to this article here is to get an understanding that these files are responsible for intellisense issues.

3. Updating Intellisense – IDE hangs

This is a very common issue with intellisense and it may occur due to a variety of reasons. There are two scenarios, either the intellisense returns after a long time or it doesn’t return at all.
The recommended way is to check for NCB corruption and also getting the ACPLOG.

4. NCB file corruption

In some circumstances, NCB file becomes corrupted and thus the PARSER is unable to proceed resulting HANGS. Sometimes by deleting the NCB, the problem is resolved. But it may be a temporary workaround. The permanent solution is to find out which part of our code is causing failure.

5. ACPlog

We can generate a log file to findout the reasons behind the failure of parser. The ACPLOG can be generated from the Visual Studio IDE by adding the following option :

/acplog:<file_name_with_complete_path>

If we build the solution, it will generate the log in the specified file. This is an ordinary text file which we can open in Notepad and can identify which part of our code is causing the parser to behave abnormally.

6. Intellisense and XML documentation

Intellisense is also helpful in generating XML code comments. For example if we enter three slashes(///), it will automatically add the code comments and may also try to include the elements very similar to the way we add variable in our code.
Supplying XML Code Comments

I have encountered a case in which Intellisense was not responding after adding CDATA to XML documentation.

When customer complaints about the XML documentation code comments then it might be due to the Intellisense feature.

7. Intellisense and network build

Building a project/solution over the network is unsupported. It may encounter Intellisense issues.

8. Is there any add-ins that the customer is using?

Removing the add-in might resolve the issue.

9. Opening a project when intellisense is busy?

If Intellisense is in the middle of updating and if you open a different project by File-&gt;Recent projects, the IDE hangs and never comes back.
It is suggested to wait for Intellisense to finish its work.

10. Is there any antivirus installed?

Try disabling the antivirus. There might be some conflict.

11. Running Visual Studio in safemode.

The safemode option in Visual Studio(Start-&gt;Run-&gt;devenv /safemode) ensures that no additional third party add-ins are loaded when VS starts. This helps us to isolate Visual Studio conflicts with other third party applications/addins.

/SafeMode (devenv.exe)

12. Is it a bug?

Last but not the least, it would be a good idea to check List of bugs that are fixed in Visual Studio 2005 Service Pack 1

Most of the known issues with Intellisense are going to be fixed very soon. You can contact Microsoft Support to get a hotfix.

Some good links

Troubleshooting IntelliSense in C++ Projects
When IntelliSense Is Unavailable
Testing the IntelliSense engine

VMWare mouse problems – mouse stuck in bottom right corner

If you convert a virtual machine which has Microsoft’s “Virtual Machine Additions” installed to a VMWare-compatible virtual machine using VMWare converter or a similar program and then proceed to install VMWare tools to optimize the virtual machine for its new environment, you will quickly find your mouse isn’t all that willing to move anymore. Either it wont show up at all, or it will be stuck in the bottom right corner of the screen, which is of course very inconvenient.

There are three, increasingly difficult but decreasingly time consuming, ways to solve this problem:

  1. Do it all over again, but make sure to uninstall the Virtual Machine Additions before you convert the machine.
  2. Install VMWare tools without the mouse driver (choose custom installation)
  3. Open regedit, and use your mad keyboarding skillz to navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}
    ..then remove the value “msvmmouf” and any adjacent spaces from the Regvalue UpperFilters, leaving whatever else is there, then reboot.

Happy mouse!

Yay. Blog.

Yes, I finally submit to the pressure.

This is a blog.

But I’m still not making a bloody facebook profile!

Get off my back about it!