Tuesday, October 30, 2012

Using Debian package tools to list files in a package

To find a file in a Debian package here is a quick reference.

Using the dpkg command:

dpkg -l  =  List all the packages on the system.

dpkg -L {package}  =  List all the files in a package.

jemurray@unixhosts:~$ dpkg -l | grep mailman
ii  mailman                           1:2.1.13-1ubuntu0.2               Powerful, web-based mailing list manager
jemurray@unixhosts:~$ dpkg -L mailman | grep sbin

Saturday, October 20, 2012

OSX - Can't login after TM restore - 'Update Needed'

After replacing my stock hard drive with a new Samsung 830 and restoring backups from Time Machine, I could no longer log into the laptop.  After the system was rebooted, the only thing on the login screen was image that says "Update Needed":

Update Needed

You could not click on the login box, there was nothing that could be done to login.

The problem had to do with the type of partition I created before restoring the backup:

Mac OS Extended (Journaled, Encrypted)
You can not recover the Time Machine image on an encrypted partition.

After the drive was repartition with out encryption, time machine was used to restore the drive.   Everything worked as expected.

Side Note:

According to Blackmagic Disk Speed Test the speed from the stock drive was around 70 MB/s.   After installing the SSD the speed is quite a bit better:

Wednesday, October 17, 2012

Resize Linux ext4 partition using Parted Magic Live CD

I accidentally created a partition too small.

The system was the self contained version of cPanel running on top of CentOS 5.x, under the free version of vmware,

Luckily the file system I needed to expand was at the end of the disk (/dev/sda5):

root@cpanel-dev [~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             9.2G  4.3G  4.5G  49% /

Using vmware I expanded the disk by simply adding space to the existing disk, after which the disk now has 26gb of space:

Model: VMware Virtual disk (scsi)
Disk /dev/sda: 26.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  313MB   313MB   primary   ext3         boot 
 2      313MB   2459MB  2147MB  primary   ext3              
 3      2459MB  6662MB  4203MB  primary   linux-swap        
 4      6662MB  17.2GB  10.5GB  extended                    
 5      6663MB  17.2GB  10.5GB  logical   ext3 

In order to resize the disk, I downloaded a copy of the parted magic live cd.

Reboot the system and boot off the parted live cd.

The first thing that needed to be done was resize the extended partition 4 to the end of the disk.   After this was completed, I resized partition 5 to the end of the disk.

Apply changes.


The disk and filesystem was automatically resized:

root@cpanel-dev [~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5              18G  4.3G   13G  26% /

Monday, October 15, 2012

connectbot + hackerskeyboard

If you ever need to ssh from your Android device, you know how hard it can be to use the stock Android keyboard.   Simple things like the escape key, up arrow, tab completion, and various other keys like numbers and symbols make using a terminal much easier.

The following apps:

make remote ssh sessions from an Android device a pleasing experience.   vi, screen, bash history, etc all flow much easier with a "full sized" keyboard with all the important keys.   

Hacker's Keyboard with ConnectBot on Samsung Galaxy Nexus in landscape mode.

This past week I was staying at Sheraton Suites, which charges a ridiculous $9.95 per 24/hours for Internet access.  I was able to ssh into one of my servers, edit my named.conf and restart the service.    Besides the small screen, it was not difficult to do.   The keyboard is very comfortable.

Cisco fails to relay DHCP requests

After a multiple hour outage of DHCP services to one of our departments we finally determined the issue to be a DHCP relay (helper) problem (bug) after a router/switch upgrade.

In this example our layer3 SVI was anchored on a Cisco 3750 running:


To address some memory issues in this release we upgraded to:


After this change anyone with a layer 3 interface behind this device could no longer get DHCP services.   We spanned the uplink from this switch to the DHCP server and saw the discover and offer packets.   When we spanned links that faced our clients we would see the discover packets only.   

This narrowed the problem down to something local to the switch.   

We are always hesitant to run "debug" anything on Cisco device, however, once we put the switch into debug mode, the problem was obvious:

DHCP server packet debugging is on.
switch#term mon

02:06:19: DHCPD: option 47 is malformed (option length 0).
02:06:19: DHCPD: invalid DHCP options - unable to parse
02:06:20: DHCPD: option 47 is malformed (option length 0).
02:06:20: DHCPD: invalid DHCP options - unable to parse
02:06:20: DHCPD: option 47 is malformed (option length 0).
02:06:20: DHCPD: invalid DHCP options - unable to parse
02:06:20: DHCPD: option 47 is malformed (option length 0).
02:06:20: DHCPD: invalid DHCP options - unable to parse

In our ISC dhcpd.conf file we had this following option configured in one of our scopes:

option netbios-scope ""

I am not sure why this option was there or who configured, but either way it was, and probably has been for a very long time.   This subnet never gets changed.

We removed the option, reloaded the server, and everything started working as expected.   

Sunday, October 14, 2012

cut-and-paste with screen.

I have been using GNU/Screen for a very long time, never once have I taken the time to figure out how to cut and paste using the native interface.  Here are the basics.