Tuesday, January 24, 2012

How to interpret the status of dpkg (–list)?

The first column of the dpkg -list corresponds to the status of a package. How to interpret this status.

Status of every package is represented by three characters xxx

First character: The possible value for the first character. The first character signifies the desired state, like we (or some user) is marking the package for installation

u: Unknown (an unknown state)
i: Install (marked for installation)
r: Remove (marked for removal)
p: Purge (marked for purging)
h: Hold

Second Character: The second character signifies the current state, whether it is installed or not. The possible values are

n: Not- The package is not installed
i: Inst – The package is successfully installed
c: Cfg-files – Configuration files are present
u: Unpacked- The package is stilled unpacked
f: Failed-cfg- Failed to remove configuration files
h: Half-inst- The package is only partially installed
W: trig-aWait
t: Trig-pend

Third Character: This corresponds to the error state. The possible value include

R: Reinst-required The package must be installed.

Taken from: http://joysofprogramming.com/status-dpkg-list/

Cleaning the boot partition in Ubuntu

Today I found a pop up message on one of my Ubuntu machines that said the boot partition was low on space. I did a search on the web for a cleaning solution for the boot partition and found this page:


Basically it is proposed a script for removing all unused Linux kernel headers, images and modules:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

I found some flaws in this script so I came with this one trying to improve it:

dpkg -l 'linux-*' | \
# We only need the second column of the installed linux-* packages list
awk '/^ii/ { print $2 } ' | \
# Take out the packages with the number of the running kernel 
grep -v $(uname -r | sed 's/\([0-9.-]\+\)-[^0-9]\+/\1/') | \
# The -v force me into this extra line
grep '[0-9]' | \
xargs sudo apt-get -y purge

Later I'll try to improve it a little bit more.

Friday, January 20, 2012

That moment!

All fascinating stuff, but not the vision that was driving Kotok and Samson and the others. They wanted to learn how to WORK the damn machines, and while this new programming language called LISP that McCarthy was talking about in 641 was interesting, it was not nearly as interesting as the act of programming, or that fantastic moment when you got your printout back from the Priesthood—word from the source itself!—and could then spend hours poring over the results of the program, what had gone wrong with it, how it could be improved.

This is so exact!
Taken from: http://www.gutenberg.org/cache/epub/729/pg729.html
Hackers, Heroes of the Computer Revolution, by Steven Levy

Tuesday, January 17, 2012

dladm and ndd in Solaris 10

show-dev is a dladm subcommand which lists only physical NICs along with their physical link state.

bash-3.00# dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full
e1000g1         link: up        speed: 1000  Mbps       duplex: full
e1000g2         link: up        speed: 1000  Mbps       duplex: full
e1000g3         link: up        speed: 1000  Mbps       duplex: full

ndd - get and set driver configuration parameters

To see which parameters are supported by the e1000g driver, use the following command:

# ndd /dev/e1000g2 \?

To set the full 1GB full-duplex negotiation:

ndd -set /dev/e1000g2 adv_1000fdx_cap 1

Thursday, January 12, 2012

2012 Federal Holidays

2012 Federal Holidays

Federal law (5 U.S.C. 6103) establishes the following public holidays for Federal employees. Please note that most Federal employees work on a Monday through Friday schedule. For these employees, when a holiday falls on a nonworkday -- Saturday or Sunday -- the holiday usually is observed on Monday (if the holiday falls on Sunday) or Friday (if the holiday falls on Saturday).
Monday, January 2*New Year's Day
Monday, January 16Birthday of Martin Luther King, Jr.
Monday, February 20**Washington's Birthday
Monday, May 28Memorial Day
Wednesday, July 4Independence Day
Monday, September 3Labor Day
Monday, October 8Columbus Day
Monday, November 12***Veterans Day
Thursday, November 22Thanksgiving Day
Tuesday, December 25Christmas Day
* January 1, 2012 (the legal public holiday for New Year's Day), falls on a Sunday. For most Federal employees, Monday, January 2, will be treated as a holiday for pay and leave purposes. (See section 3(a) of Executive order 11582, February 11, 1971.)
** This holiday is designated as "Washington's Birthday" in section 6103(a) of title 5 of the United States Code, which is the law that specifies holidays for Federal employees. Though other institutions such as state and local governments and private businesses may use other names, it is our policy to always refer to holidays by the names designated in the law.
*** November 11, 2012 (the legal public holiday for Veterans Day), falls on a Sunday. For most Federal employees, Monday, November 12, will be treated as a holiday for pay and leave purposes. (See section 3(a) of Executive order 11582, February 11, 1971.)

Taken from http://www.opm.gov/Operating_Status_Schedules/fedhol/2012.asp