art's abode

Archive for the ‘unix’ Category

Windows and Linux Seamlessly

without comments

Look ma, two OSes, one Desktop (and I ain’t talking Cygwin cheese either…):


Yes yes… I know you’re scared… let the VM frenzy begin!

Written by art

September 30th, 2009 at 7:35 am

Installing Debian 40r6 for Sparc

with one comment

If your Sparc is not set to automatically boot from CDROM, you might find the following handy.


  • Sparc (tested on UltraSparc 10)
  • Debian image
  • ISO burning software
  • Monitor and keyboard for Sparc (alternatively, run from serial terminal—serial cable required for this).


  1. Download the debian sparc netinst iso image.
  2. Burn the image to CD.
  3. Put the CD into your Sparc.
  4. Power off the Sparc.
  5. Plug in keyboard, mouse, and monitor.
  6. Power on the Sparc, you should see the POST and the machine initializing memory check.
  7. Hit STOP-A. You will be brought to the “ok” prompt.
  8. type “boot cdrom”.
  9. Run through regular Debian setup process.

That’s it.

You may want to read this previous post for installation caveats regarding MBR, SILO, and serial terminal install.

Written by art

February 1st, 2009 at 7:57 pm

Posted in sparc,unix

Tagged with , , , , ,

Recursively cat’ing all files in a directory

with one comment

$ cat `find /directoryname -type f`

Written by art

February 21st, 2008 at 12:07 am

Posted in shell

Installing Linux on an UltraSparc 10 via serial console

with 2 comments

Aye, the Ultra 10 (Model 440) finally came in yesterday.

Headless mode install definitely works–here’s how:

  1. Get your Linux media burnt. Ensure your bootloader settings support serial console I/O (I tried using a nightly ubuntu-server/sparc .iso).
  2. Get your serial console working with your Ultra 10. You will need a DB9 (com) port, which is commonly called ttyb. If your sparc didn’t come with one, you can order them online.
  3. You will need a null modem cable, and a terminal on the other end of the cable to capture I/O.
  4. Boot via serial console, OpenBoot will load, at the “ok” prompt, type “printenv”. Take careful note.
  5. Set any variables you need to, using “setenv” (i.e., to ensure your terminal settings are correct). Some useful ones: auto-boot?, boot, input-device, output-device, reset.
  6. You can also do this in blind-mode: headless using a keyboard plugged in locally to the sparc, hitting STOP-A once the keyboard LEDs stop blinking, and setting output-device and input-device, for example, to terminal, or screen/keyboard.
  7. Now that it’s all working, put in the Linux media, boot, and at the “ok” prompt type “boot cdrom”.
  8. Install your distro. All the stock hardware should be supported. Make note that SILO (LILO for Sparc) has specific requirements in terms of the disk (it must be installed within the first gigabyte).
  9. It failed during the ubuntu-server setup process. Continue it regardless and complete the installation process.
  10. Reboot the cdrom, and enter rescue mode. Mount the drive(s) that you just installed, and install the silo package (i.e., using apt-get for debian/ubuntu). It installed without incident for me here.

This information was tested on an Sun Ultra 10, 440-MHz UltraSPARC IIi, 2MB external cache, 1GB memory, 3D card, 2 x 9GB disk drives.

Written by art

January 25th, 2008 at 1:46 am

Posted in hardware,terminal,unix

Getting BSD, Home, End, Putty, and screen to play nice

without comments

… you can try putting shit into your /etc/inputrc (or ~/.inputrc):

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word

You will have to re-login to your terminal session for these changes to take effect. But that may not fix anything in screen, until you change the $TERM in your screen session:

bash-3.2$ cat ~/.screenrc
term linux

… which means you have to restart your screen session for the changes to take effect. "term vt220" is also a good choice, but if you tend to use syntax highlighting with vim, for instance, or any other high-tech features of your system, it may look ugly-underliney.

Written by art

December 7th, 2007 at 12:26 am

Trapping signals in Ruby

without comments

It’s pretty easy to handle signals in Ruby, which is sometimes necessary when you want your code to interact with the system running it.

Signalz Ahoy!

If you want to know which kill signals you have:

bash-3.2$ kill -l
1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL
5) SIGTRAP      6) SIGABRT      7) SIGEMT       8) SIGFPE
9) SIGKILL     10) SIGBUS      11) SIGSEGV     12) SIGSYS
13) SIGPIPE     14) SIGALRM     15) SIGTERM     16) SIGURG
17) SIGSTOP     18) SIGTSTP     19) SIGCONT     20) SIGCHLD
21) SIGTTIN     22) SIGTTOU     23) SIGIO       24) SIGXCPU
29) SIGINFO     30) SIGUSR1     31) SIGUSR2

If you want to know which kill signals Ruby recognises:

irb(main):002:0> Signal.list.keys.join ", "

Some quick-n-dirty source code:

There’s probably better ways of doing this, but here’s a stupid little example demonstrating how it could work:

bash-3.2$ cat signal.rb

$hups = 0

def quit_on_int
  puts "Quitting on interrupt signal."

def quit_on_quit
  puts "U sure killed me guud!"

def handle_hup
  puts "HUP! (count: #{$hups})"

while true
  trap("INT") {quit_on_int}
  trap("HUP") {handle_hup}
  trap("QUIT") {quit_on_quit}

Example in use:

bash-3.2$ ruby signal.rb
HUP! (count: 1)
HUP! (count: 2)
HUP! (count: 3)
^CQuitting on interrupt signal.

We run the program as above, then send it three SIGHUPs (i.e., using "kill -HUP pid"). We break out the program using ^C (ctrl-c), sending an Interrupt. Note this may not work in windows.

bash-3.2$ ruby signal.rb
U sure killed me guud!

Here we run the program again, and send it a SIGQUIT ("kill -QUIT pid").

Written by art

December 7th, 2007 at 12:21 am


with 3 comments

I’m tired of constantly forgetting this ultra-advanced syntax:

iface eth0 inet static

or, via DHCP:

iface eth0 inet dhcp

Written by art

December 3rd, 2007 at 3:32 am

Posted in network,unix

putty – Vista fonts (Lucida Console) and unix consoles

without comments

lucida_console-vs-terminal Aye, it was a pain to get this one going properly with the line drawing:

Set the font to Lucida Console, which should have been installed with Vista. If you’re using a linux terminal you might as well make sure the linux keyboard layout is selected as well.

For lines and other special characters, set the line drawing to Unicode. Lucida Console has Unicode lines. This is also why it doesn’t work with Terminal or Fixedsys fonts in Vista, woe is me, I spent ages trying to figure that one out.

Unless you know you’re using another translation page, set the translation to UTF8.

Things should look a lot better now!

Written by art

November 11th, 2007 at 12:57 am

Modifying your $PATH

with one comment

… is handy so that you don’t have to type ~/usr/bin/someapp, for instance, if you’ve installed something it under your home directory using ./configure ––prefix=~/usr (naturally this works no matter what your path is).

Most shells support .profile. The system settings for the shell might be found in /etc/profile, for instance; user-specific profiles are stored in their home directories, i.e., /home/art/.profile. Edit this file in your favorite browser.

Append the following, modifying it to suit your needs:

export PATH=~/usr/bin:$PATH

Take note that the PATH variable prioritizes by order. So, according to the above line, if there is /home/art/usr/bin/cat, and /bin/cat, the path specified before (here, /home/art/usr/bin/cat) will take precedence.

Written by art

November 7th, 2007 at 12:26 am

Posted in $PATH,shell

Doing a rootless ./configure; make; make install

without comments

Often I want to compile something for my normal user account. In these cases, it doesn’t make sense to install system-wide. Lots of source tarballs nowadays allow you to compile and install a program in a particular location.

In general, you should be doing something like so:

$ tar -jxvf some_fantastic_warez.tar.bz2

$ cd some_fantastic_warez
$ ./configure ––prefix=~/usr

$ make

$ make install

make install will place your compiled binary into the path you specified with the ––prefix option when running configure. In this case I’ve set it to install it under the directory tree ~/usr (i.e., /home/username/usr).

If the source is fairly standard, you will then find the binary as ~/usr/bin/some_fantastic_warez.

You may wish to read about modifying your $PATH, so that you don’t need to specify the full path to run your program.

Written by art

November 6th, 2007 at 11:32 pm

Posted in shell,source-code