Hintshop

Practical Linux, networking, and hardware notes by Michael Ludvig.

Splitting large images for printing

I happened to have been tasked with a seemingly simple job — split a large image (size A1) into small A4 tiles for draft printing on a standard office laser printer. Couple of minutes of Googling only led to a some online services, either paid (come on, paying for cutting an image?!) or free with limitations on the maximal number of output tiles or on the size of input file. Anyway, this is what we’ve got (scaled down): Large Property Solutions banner. And this is what we want: Desired cutting marks.

Read article

Interactive pre-/post-install scripts in RedHat KickStart

RedHat Enterprise Linux, Fedora, CentOS and similar systems can be auto-installed using KickStart scripts. Unfortunately the KickStart concept is not designed to conveniently interact with the operator. One of the most Frequently Asked Questions about KickStart is “How do I enter a hostname and IP address during installation?” That’s indeed a common and valid question but there’s no well known answer. If you’re in position to install dozens of RedHat machines, perhaps a classroom full of workstations, you will probably look at using a customised DVD with a kickstart file tuned to your needs. In such a case you want all the machines be exactly the same, except for their hostname and IP address. Sure, you can use DHCP to set both, but in some cases that’s not possible. It may be better to ask for the hostname and IP during installation. How to do that?

Read article

Solaris jumpstart from a Linux server

I was asked to revive an old Sun Fire V120 server and install Solaris 10 on it for some Oracle tests. The server is in a server room a couple kilometers away — I could indeed drive there, put the DVD in the drive and install it that way but I found me too lazy to lift my bottom. Instead I decided to give a Solaris Jumpstart installation a try. I never did it before so I started googling — most tutorials explained how to setup Jumpstart server on Solaris but I didn’t have another Solaris available in that subnet. Only some Linux boxes. So I kept on googling, found some hints but not a complete tutorial on doing a Solaris Jumpstart installation from a Linux server. Following the break is my take on the How-To.

Read article

avrdude -c buspirate

Let’s put two things together today… The BusPirate is the ultimate tinkerers’ tool that makes the SPI, I2C, 1-Wire, UART, JTAG and some other low-level protocols available to an ordinary PC equipped with a serial or USB port. That way a PC can talk to many digital electronic components, from temperature sensors through microcontrollers and memories to I/O devices like LCD displays or ethernet interfaces.   Uploading a firmware to an Atmel AVR microcontroller (MCU) is possible through many different ways, with the most common and universal probably being ICSP — In Circuit System Programming. In essence ICSP is an SPI-based protocol, where the programmer sends special programming commands to the AVR chip along with data to be written to the flash memory. In most cases the MCU doesn’t even need to be removed from its circuit first. So the AVR can be programmed using SPI and the BusPirate can talk SPI, therefore the BusPirate can program AVRs, correct? Yes, of course it can! All you need is a recent enough avrdude — either the current SVN checkout or avrdude 5.7 once it is released. BusPirate with 2 independent AVRs. AVRdude with BusPirate Programming one AVR is a breeze, let’s have an example of ATtiny2313. Connect BusPirate to the IC like this: BusPirateATtiny2313 SignalDIP20 PIN GNDGND10 +5V or +3.3VVcc20 CSRESET1 MOSIMOSI17 MISOMISO18 SCL/CLKSCK19 It is possible, although not required, to power the chip from the BusPirate during programming. Even if the BP is not used as a Vcc supply for AVR their GNDs should still be interconnected. All right, the ultracomplex “circuit” is ready to go. It’s time to test if it works… .../attiny2313/test $ avrdude -p attiny2313 -c buspirate Detecting BusPirate... ** ** Bus Pirate v1a ** Firmware v3.0 ** DEVID:0x0447 REVID:0x3003 (A3) ** http://dangerousprototypes.com ** BusPirate: using BINARY mode avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.02s

Read article

Persistent names for usb-serial devices

I own a bunch of devices that appear as /dev/ttyUSB<something> in the system. At least three of them I use regularly: Arduino, BusPirate and a simple USB-to-RS232 converter to talk to my ARM boards. I keep plugging them in and pulling them out from the USB ports and they keep getting names like /dev/ttyUSB0 or ttyUSB1 or ttyUSB2 or so. Sadly the device names are not persistent — whether the BusPirate pops up as /dev/ttyUSB0 or /dev/ttyUSB2 depends on the order in which are the devices discovered by the kernel. That makes things difficult — it usually requires a trial and error approach to find out what the hell is the ARM board’s tty name this time.

Read article

Creating a CentOS text-only CD / DVD

Some HP ProLiant systems come with a stripped down version of ILO (Integrated Lights-Out) management card that, without an additional license, supports only text mode remote console. While this is indeed a big problem for Windows users who are therefore forced to purchase the Advanced ILO license, Linux can happily run in a text mode. With one exception though: installation disks of most current distributions boot up into a graphical mode first and only then allow selecting a text-only installation. That’s true at least for RedHat Enterprise, CentOS, OpenSUSE and Ubuntu.

Read article

IPv6 VPS

I am used to have my own server on the Internet. Ever since I first got in touch with the Net in mid-90’s I have had at least one server of my own serving my emails, domains, websites, etc. I used to have the machine my server was running on in a colocation facility (aka ISP server housing) in Prague, but then in 2005 I moved to New Zealand, leaving my server some 20.000km behind. That soon became a problem. Whenever the hardware experienced issues or the OS needed an upgrade I was inconveniently too far. Luckily the ISP staff was very helpful and they often tried hard to help me out but the distance between me and the server was a real issue. Finally, in June 2008, I undertook the big step and shifted from my very own hardware to a hosted Virtual Private Server (VPS).

Read article

Untrusted SSL certificate in Citrix ICAclient on Linux

Today I was asked to perform some Linux server maintenance for an important client. They use Citrix Access Gateway™ (CAG) for remote access to their systems. The plan was to login to the Citrix Access Gateway web interface from Firefox, click the PuTTY icon, let CAG server execute the PuTTY SSH client and display its interface on my Linux desktop via a locally installed ICA client. Once it’s up enter the remote Linux server’s IP and do my job. Unfortunately when I clicked the PuTTY icon things went wrong instantly:

Read article

How to redirect all STDERR in a script

Every now and then I have a need to redirect all output, both standard and error, within a shell script (bash) to a file. There are two ways — the obvious beginners’ one and the elegant gurus’ one. For starters let’s have a very simple script test.sh that generates both standard output (stdout) and error message (stderr): #!/bin/sh echo "Going to run /non/existent" /non/existent That will produce an expected result when run:

Read article

How to copy raw partition over the net

Earlier today I worked on migrating a D3 database server to a VMware ESX environment. The tool that we used for migration did a good job in converting the RHEL3 operating system and all the Linux filesystems, but failed to copy the D3’s raw data partition: old-server:~# fdisk -l /dev/sda [...] /dev/sda12 10965 17816 55038658+ d3 Unknown Now what? I didn’t have enough space neither on the source server nor on the destination VM to dump the partition contents to a file, copy across and reload back to /dev/sda12 on the VM. It had to be done online.

Read article

ByteFlow + Apache HowTo

When searching for an engine for this brand new blog site I’ve come across ByteFlow. It immediately appealed to me, because: it’s written in Python, language that I like a lot and use a lot. it’s based on Django, framework that I used on one of my past projects. seems to have a rich feature set and is being actively developed On the other hand it’s relatively new and (therefore?) doesn’t come with an overwhelmingly extensive documentation. For start, installation wasn’t a piece of cake. First I tried to run ByteFlow with lighttpd, following a howto on Benjamin Smith’s blog, but ended up with a little problem I didn’t manage to solve. Not knowing much about lighttpd I eventually switched to Apache that I’m pretty familiar with. The ByteFlow people recommend Apache with mod_wsgi as the best way to run their engine, however information on how to do that are pretty sparse. If you also wonder how read on, I’ll document my setup here. Perhaps you’ll find some useful hints in here.

Read article