Screen size calculator

Today I found out I want to replace one of my 20″ 4:3 LCD screens with a widescreen, to watch movies on a bigger surface. However, I didn’t want to reduce my vertical screen space.

What I mean is that a 20″ widescreen is, necessarily, shorter vertically than my 4:3 screen, meaning I get to see less of vertically oriented webpages, word documents, spreadsheets… basically everything except movies are designed for a screen with a relatively large vertical size.

Thus, getting a 20″ widescreen was completely out of the question. So I grabbed my calculator, and then thought… why bother? Someone must have done this before.

Exactly. The link below provides a “TV Aspect Ratio Calculator”, which works just as well for LCD screens. Using 20″, 4:3 as input, my widescreen needs to be 24.5392 inches to fit my needs. Thus, we’re going for 26″ 🙂

http://www.nicetaco.com/tv.aspx

How to move a mysql database from one box to another

Simple reference, moving a mysql database:

mysqldump -h <oldhostip/name> -u username -p[<password>] <databasename> > <dumpfilename>.sql
mysql -u<username> -p[<password>] < <dumpfilename>.sql

Note: The lack of spaces in some places of the commands. They are intended.
Note: Specifying the password after -p is []’d, which means it’s optional.
Note: If you do enter a password on the command line, it will get saved in your .bash_history or similar in clear text.

CIFS VFS No response for cmd n mid…

On a few systems, I’ve noticed CIFS mounts have a tendency to lock up the system when transferring large files, or a shitload of small ones in quick succession. When this happens, the system may or may not completely lock up, and lines like these will appear in your syslog:

Aug 1 22:58:16 dreadnought kernel: CIFS VFS: No response to cmd 46 mid 25661 
Aug 1 22:58:16 dreadnought kernel: CIFS VFS: Send error in read = -11
Aug 1 22:58:16 dreadnought kernel: CIFS VFS: No response for cmd 50 mid 25664
Aug 1 22:58:16 dreadnought kernel: CIFS VFS: No response to cmd 47 mid 25663
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: No response to cmd 47 mid 25662
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: Write2 ret -11, written = 0
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: Send error in read = -9
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: Write2 ret -9, written = 0
Aug 1 22:59:52 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:00:29 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:00:36 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:01:16 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:02:28 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:03:23 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:03:44 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:05:35 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:06:18 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:06:35 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:06:46 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:06:46 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:07:02 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:07:46 dreadnought kernel: CIFS VFS: server not responding

I found a workaround which involves disabling Opportunistic Locking. This will have a small performance impact, but at least the thing wont hang up and use 100% CPU for no goddamn reason. Yes, this article has an angry tone, because this issue has eaten way too much of my time today.

To disable Opportunistic Locking, you have to set the contents of the file “/proc/fs/cifs/OplockEnabled” to 0. This file only exists after the cifs module has been loaded, and will be replaced if the module is unloaded and reloaded. Thus, I configured my /etc/rc.local script (use whatever equivalent your distro has to a startup script) to both load the cifs module and set the contents of said file:

# cifs client workaround
modprobe cifs
echo 0 > /proc/fs/cifs/OplockEnabled

There you go.

Disable the “No mail” notification on machines which have no local mail

On machines which are set up to have no local mail and send all their messages to a smarthost, using e.g. exim4, the “No mail.” message at login is both unnecessary and annoying, because when things are set up correctly, there should never be any local mail in the first place.

This can be remedied by editing /etc/pam.d/ssh (or whichever file corresponds to the login method you’re using) and taking a look at the two following lines:

# Print the status of the user's mailbox upon successful login.
session optional pam_mail.so standard noenv # [1]

It’s time to comment something out 🙂

Hardware clock fix for Debian on Mac Mini

On my Mac Mini, the hardware clock was seriously screwed up under Debian. The clock would set itself 1 hour back for each boot and cause all kinds of strange issues with cron when corrected. A small fix will remedy this situation.

  1. sudo vim /etc/init.d/hwclock.sh
  2. change ‘HWCLOCKPARS=‘ to ‘HWCLOCKPARS=”–directisa”‘ (note: that’s two dashes before directisa, even if your browser might put them together)
  3. On Debian Lenny, you have to do the same to the HWCLOCKPARS line in /etc/init.d/hwclockfirst.sh

Disable Debian’s motd on login

Tired of seeing this?

Linux ***** 2.6.18-6-686 #1 SMP Fri Jun 6 22:22:11 UTC 2008 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: ***** from *****

Edit /etc/motd, remove everything in it, or ‘echo “” > /etc/motd

Then edit /etc/rcS.d/S55bootmisc.sh and comment out the two lines following “#Update motd

Installing vmware from scratch

This is an updated (as of 6. July 2008) howto on how to install vmware server on top of a fresh install of Debian Linux.

First, make sure you have all the required libraries. If you’re on a console-based installation, you may need to “apt-get install linux-headers-`uname -r` libx11-6 libx11-dev x-window-system-core x-window-system xspecs libxtst6 psmisc build-essential” or you’ll get the dreaded “The correct version of one or more libraries needed to run VMware Server may be missing” message during the next few steps.

Dig through the horribly designed vmware.com to find http://register.vmware.com/content/registration.html.

Fill in a bullshit name, address and all the other crap, and put in an email address like <something>@mailinator.com. I used “blowme@mailinator.com”. Request at least one serial number.
This time, they actually gave me the serial number on the following page, however, if they send it to the email address, go to www.mailinator.com, input the username you entered (no need for a password) and fetch the serial(s).

Download the server and the management interface with wget. The links to these, if outdated, can be found at http://register.vmware.com/content/download.html

(as root)
cd /usr/src
mkdir vmware
cd vmware
wget http://download3.vmware.com/software/vmserver/VMware-server-1.0.5-80187....
wget http://download3.vmware.com/software/vmserver/VMware-mui-1.0.5-80187.tar.gz

Extract, compile and install vmware. Follow the on-screen instructions. If unsure, just press <enter>. It’ll work. Enter your serial number when asked.

tar zxvf VMware-server-1.0.5-80187.tar.gz
tar zxvfVMware-mui-1.0.5-80187.tar.gz
cd vmware-server-distrib/
./vmware-install.pl
cd ..
cd vmware-mui-distrib/
./vmware-install.pl
cd ..

vmware should now be set up and configured, ready to go 😀