Feb 142011
 

Took me some time to find this out digging the Net, hence creating a note here.

Example with a Ricoh printer (but Ubuntu includes tons of drivers), network connected and listening on IP 192.168.1.10.

lpadmin -E -p<my printer name> -v socket://<my printer address> -P
/usr/share/ppd/openprinting/Ricoh/PS/Ricoh-Aficio_SP_4210N_PS.ppd.gz 
-u allow:all
Then let’s make it default with command:
lpadmin -d <my printer name>
Enable it in CUPS with command:
cupsenable <my printer name>
And make it accepting print jobs with command:
accept <my printer name>
Once you’re done, you can test by echoing some text like:
echo "I am a Genius" | lpr -d
or printing files like:
lpr -d mytextfile.txt
Here a lot of additional cool settings.
Nov 082010
 

Today I successfully upgraded 4 ESXi hosts to VMware ESXi 4.1.

Since I do not have Virtual Center (they are mainly lab machines), I found very good hints about hot to do it from CLI via SSH.

And as usual, to avoid forgetting how I did it’s good moment to write down some notes about the process.

  1. First of all, access to your ESXi 4.0 with vSphere Client, power off all the VMs and put the host in maintenance mode.
  2. Second, from ESX console press ALT-F1 and type the word unsupported pressing <Enter> afterwards. Please note that you will not be able to see anything while you type. This is kind of secret word to enable Tech Support Mode (TSM) locally.
  3. It will prompt you for root’s password, after which you’ll get console shell access on ESXi. Now let’s enable SSH access to the machine.
  4. Vi the file /etc/inetd, search for ssh and remove the hash sign in front of the line:

    ssh      stream   tcp   nowait   root   /sbin/dropbearmulti   dropbear ++min=0,swap,group=shell -i –K60

  5. Find the process id of inetd and send a hiccup signal to it to reconsider updated configuration:

    ~ # pidof inetd
    4935
    ~ # kill -HUP 4935

  6. Access to the ESXi via SCP graphical interface (for example, using WinSCP.

  7. Locate datastore (normally under /vmfs/volumes/datastore-name) and create a directory there called, for example, upgrade-4.1

  8. Download the file upgrade-from-ESXi4.0-to-4.1.0-0.0.<somenumber>-release.zip from VMware Website and unzip it.

  9. Transfer the unzipped content into the directory you created on ESXi using scp.

  10. Access to ESXi host in SSH.

  11. Upgrade using commands:
    ~ # cd /vmfs/volumes/datastore1/upgrade-4.1
    ~ # esxupdate update –m metadata.zip

  12. Upgrade process will begin and conclude as shown below:
    image

  13. Reboot your ESXi

  14. Access with vSphere 4.1 client and exit from Maintenance mode.

  15. Restart your VMs.

Jul 052010
 

As usual, the main source for writing articles here is a need I had and a solution I found 😉

This time the need was to add a series of users in a Linux system without repeating the command useradd one zirillion of times.

First, we need to populate a text files with details about the users we’re going to create.

Let’s assume the file is called myuserlist.txt (permissions 600) with the following syntax:

user1:password1:1001:510:My First Account:/home/user1:/bin/bash
user2:password2:1002:510:My Second Account:/home/user2:/bin/bash
user3:password3:1003:510:My Third Account:/home/user3:/bin/bash
user4:password4:1004:510:My Fourth Account:/home/user4:/bin/bash

Once you’re done with the list, proceed to add the users with the command:

newusers myuserlist.txt

After command is issued, check the results in the following files:

/etc/passwd
/etc/shadow
/etc/groups

Jun 292010
 

I’ve been recently fashioned by Zeroshell project, a very well documented project run by an italian guy who made a splendid job.

I tried to set it up on a VIA based appliance with Intel 1 Ghz processor and 1 Gb RAM, using 1 Gb Compact Flash and the image provided in download section of Zeroshell web site.

Everything went smooth, except that when I booted the appliance the BIOS information was displayed correctly, but as soon as Zeroshell boot started I saw crappy characters on screen.

After some investigation and some good hints from a friend, I found where the problem was and, as usual, here’s a tech note to avoid again this investigation in the future.

The issue was that appliance BIOS was set to redirect console to serial port with settings normally in use: 9600 bps, 8N1

…while Zeroshell defaults in its boot to more performing (but also less “default”) 38400.

Continue reading »

Jan 182010
 

Quick not to myself since everytime I spend hours in searching it again.

The command line is:

openssl x509 –req –in <path>/<certificate_request>.csr  –signkey <path-to-CA-private-cert>/CA-private-cert.pem –out <path-to-certs-repository>/signed-cert-name.pem

Hopefully next time I do not have to search it again hours and hours 😉

Naturally this command required to have created the request before, and to have correctly setup the CA… but there is documentation on the ‘Net concerning these two operations.

Jan 182010
 

This is something not so easy to find on the internet, and once again Linux shows its immense power in the simplest way: CLI.

Question: I have a .ISO file representing the image of a DVD and I want to know the LABEL of that DVD.

Answer: Issue the command

dd if=/<path>/filename.iso bs=1 skip=32808 count=32

on whatever Linux terminal.

For example, here’s what is returned for a backup copy of DVD I legally own:

Input command:
dd if=Natale\ in\ Casa\ Muppets.iso bs=1 skip=32808 count=32

Output:
MUPPETS_CHRISTMAS_CAROL         32+0 records in
32+0 records out
32 bytes (32 B) copied, 0.00129793 s, 24.7 kB/s

Enjoy!

Jan 162010
 

Let’s start this new year by referencing an excellent system I happened to find on the Internet to perform uPnP server functionality on my Linux system.

The name of the thing is LLink and although I haven’t exploited at full yet, it looks VERY promising.

Some features:

  • Parses various video containers: vob, avi, ts, mkv, tp, mov, m2ts, evo.
  • Streams any file type the NMT player can handle: mp3, flac, jpeg, png etc.
  • Can play straight from rar files: no more need to unrar your media. (Comes with special unrar-3.7.8-seek.)
  • SSDP / UPnP discovery support (although minimal).
  • Skin support: make your own html templates or choose from pre-built.
  • Simple iMDb querying to look up media information for Jukebox skins.
  • Both HD and SD skins available.
  • Light, tiny and clean code for Unix, OsX and Windows.
  • Paginating: support to send listings in pages, with tags for Next/Prev.
  • PlayAll cgi tag, and PlayAllFrom.
  • External subtitles: subtitle files can be consolidated in one directory.
  • libdvdnav support (and libdvdcss): provides basic playback of DVD .iso and .img files and from DVD drives.
  • UDF 2.50 BD5-ISO support: provides basic playback of Bluray and HD-DVD.

Got interested? You can find more here.

Dec 312009
 

Although it could seem an oxymore, sort something in randomic order might be usefl sometimes.

Give a look to the script below, which I’m writing here for future reference.

#!/bin/bash
#
# This script creates a list of file or symbolic link to pictures in a directory
# The pictures are dynamically selected within a library of thousands
# This is to allow a wireless frame to display daily an ever changing list
# of pictures

# Define variable to be the target directory where we put the link/pictures
# This directory is regularly scanned by MediaTomb, the uPnP server talking to
# the digital frame

# Define variable to be the root directory where it will start to scan
scandir=/media/allphotos

# Clean previous contents of the directory used for streaming
cd /var/streampix
rm -rf *

# Define cycle to set the max number of photos to be displayed
# (like from 1 to 50 repeat)
for i in `seq 1 50`

# list the dir, pick a random file, add to the list
do
y="$(find $scandir -type f -iregex ‘.*\.\(bmp\|gif\|jpg\|png\)$’ | sort -R | head -1)"
cp "$y" /var/streampix/
done

Enjoy!