Search Results: "Michael Prokop"

18 May 2007

Michael Prokop: grml 1.0, grml64 0.1 and grml-small 0.4

Screenshot of grml 1.0 It’s done. grml 1.0 is available. New features? Tons of them. 8-) Just check out the official release notes for grml 1.0. Need grml for a x86_64 system? No problem, grml64 0.1 is waiting for you. You are used to grml-small? Check out grml-small 0.4. You want to know what are my favourite features of the new release? Besides the updated kernel, libc, X.org and the 109 new packages? For example I love grml-debootstrap’s feature of installing a plain Debian with one single command (no further keypress!). I love playing with ZFS on Linux using zfs-fuse. I like the possibility to generate an OpenOffice document out of my existing asciidoc documentation using docbook2odf. I’ll present the new release at the grml booth of grazer linuxdays on 19th of may and will give a (german) talk about grml on the event as well. Hope to see you there. ;-)

Michael Prokop: docbook2odf

docbook2odf is a toolkit that automatically converts DocBook to OASIS OpenDocument (ODF, the ISO standardized format used for texts, spreadsheets and presentations). Conversion is based on a XSLT which makes it easy to convert DocBook->ODF, ODT, ODS and ODP as all these documents are XML based. This piece of software is pretty rocking for example if you write your docs in AsciiDoc and want to provide a document for use within OO:
% cp /usr/share/doc/asciidoc/examples/website/manpage.txt .
% a2x -f odt manpage.txt
% ooffice manpage.odt
Just to get an idea how the result looks like in OpenOffice: Screnshot of docbook2odt result in OpenOffice Just ‘apt-get install docbook2odf’ if you are using Debian/unstable, thanks to the work of formorer we could include the toolchain in the upcoming grml release.

8 May 2007

Michael Prokop: grml release candidates

grml 1.0 screenshot As formorer mentioned already we have new release candidates of grml: grml 1.0-rc1 with codename Meilenschwein is available as well as grml-small 0.4-rc1 with codename Springinkerl. We are proud to be able to present a 64bit version of grml as well: grml 64 0.1-rc1 with codename LiveShell which is based on the amd64 port of Debian. New features? Tons of new features. So what are you waiting for? Ah, that the mirrors are getting in sync, right. So grab the ISOs in the meanwhile from the master or the slave or even better use bittorrent (torrents for: grml, grml64 and grml-small) instead. We are waiting for your bug reports. 8-)

30 April 2007

Michael Prokop: Mercurial: remote: abort: No space left on device

I got ‘remote: abort: No space left on device:’ when running ‘hg push’ via ssh during a repository migration (from subversion to mercurial). Huh?! The partition with all the repositories on it has enough free space, so what? Ah, wait a second. When pushing data via ssh, mercurial does a ’ssh $HOST hg -R /path/to/repos serve –stdio’ and the data is put into /tmp/hg-unbundle-… in the meanwhile. As I’m running the mercurial repository inside a vserver system /tmp was limited to 16M tmpfs. So the temporary fix was pretty easy:
vnamespace -e repos mount -t tmpfs -o remount,size=32m,mode=1777 \
              none /var/lib/vservers/repos/tmp
I just talked to mercurial devs, quoting them:
00:24 < mpm> It finds the tmp dir based on the standard environment variables.
00:24 < mpm> We'll probably move it to .hg/
[...]
00:33 < brendan> defaults to /tmp if unset
Excellent. :-)

24 April 2007

Russell Coker: booting from USB for security

Sune Vuorela asks about how to secure important data such as GPG keys on laptops.

I believe that the ideal solution involves booting from a USB device with an encrypted root filesystem to make subversion of the machine more difficult (note that physically subverting the machine is still possible - EG through monitoring the keyboard hardware).

The idea is that you boot from the USB device which contains the kernel, initrd, and the decryption key for the root filesystem. The advantage of having the key on a USB device is that it can be longer and more random than anything you might memorise.

In my previous posts about a good security design for an office, more about securing an office, and biometrics and passwords I covered some of the details of this.

My latest idea however is to have the root filesystem encrypted with both a password that is entered and by a password stored on the USB device. This means that someone who steals both my laptop and my USB key will still have some difficulty in getting at my data, but also someone who steals just the laptop will find that it is encrypted with a key that can not be brute-forced with any hardware that doesn't involve quantum-computing.

Also coincidentally also on Planet Debian in the same day Michael Prokop documents how to solve some of the problems relating to booting from a USB flash device.

22 April 2007

Michael Prokop: Booting from USB pen: troubleshooting and pitfalls

As grml supports booting from usb devices (harddisk installation via grml2hd as well as booting from usb pens via grml2usb) and I helped many people at debugging booting problems I think I stumbled upon every existing pitfall. 8-) There are several situations where booting might fail. So here we go with a summary of the most common pitfalls and possible solutions:
  1. The Bootsplash is displayed, the kernel loads but you very soon get a:
  2. ran out of input data
    System halted
    
    Reason: everything OK, except for the filesystem used on your usb device. So instead of fat16 you use for example fat32. Fix: use the appropriate filesystem (fat16 for usb pens usually).
  3. When trying to boot from USB you get something like:
  4. Invalid operating system
    
    Possible reason: the partition layout is not ok. Very probably there’s no primary partition or none has the flag ‘bootable’ set. (Read on for further details.)
  5. When trying to boot from USB you get something like:
  6. No operating system found.
    
    Possible reason: you forgot to set the boot-flag on the partition. Or you did not install an operating system at all. ;-)
  7. When trying to set up the partition(s) on the USB device cfdisk reports something like:
  8. FATAL ERROR: Bad primary partition 0: Partition ends in the final partial cylinder
    
    Reason: the partition layout is not ok. Either use fdisk (requires detailed knowledge about partition setup!) or better: use a fronted of libparted, like gparted. gparted does an excellent job at setting up an appropriate partition layout for booting from USB (read on for details about the correct setup). As long as cfdisk has problems with the layout - it will exit on errors - your usb pen very probably does not have a valid partition setup for booting. Please notice that fdisk very often uses defaults which are not OK, whereas gparted uses the appropriate heads, sectors/track and cylinders settings. So if you really want to use fdisk for setting up the appropriate partition layout you might have to enter the ‘extra functionality (experts only)’ menu of fdisk.
  9. The system never displays the bootsplash of the usb device at all? Checklist:
    • does your system support booting from USB at all? Check settings in BIOS.
    • do you use the correct USB mode in BIOS? Check BIOS again, usually you want to use USB-HDD mode. Not possible? See USB-ZIP mode.
    • is "booting from USB" in the appropriate order of the booting sequence? Check the "boot"-section in your BIOS.
    • is the bootable flag set on the boot-partition? Check for example with cfdisk.
    • is the partition used for booting the first partition and a primary one on your device? Check with cfdisk again.
    • is the partition layout ok? The first partition (the one used for booting) has to start at cylinder 1/sector 63, otherwise booting will fail on most (all?) x86 systems. Check with ‘cfdisk -P s /dev/..’ or ‘fdisk -l -u /dev/…’. Do *not* trust the output of ‘fdisk -l /dev/…’. Really.
  10. syslinux does not work on your system (b0rken BIOS for example)? Possible solution: use grub instead.
  11. Kernel boots but fails to find the root filesystem with something like:
  12. kernel-panic: unable to mount root-fs...
    
    Yes? Then the root= argument in your kernel commandline (specified in the bootloader, usually lilo, grub or isolinux/syslinux) is pointing to the wrong device. Solution: adjust the root=-option in your bootmanager’s configuration. Tip: use root=UUID instead of root=/dev/[hs]d…
  13. All of the above tips don’t work? Maybe your USB pen is even larger than 1GB?
  14. Possible reason: Some BIOSes offer different modes for USB booting. The proper mode to boot a USB stick is USB-HDD. If that doesn’t work or is not supported by your system, you need to format your USB-Stick as USB-ZIP. To do this, the syslinux source distribution contains an utility called mkdiskimage, which you can use to re-format your USB stick in USB-ZIP format. For more information refer to the USB-webpage in the grml-wiki and Bootable USB Key in the knoppix-wiki.
I mentioned the correct partition layout several times. Reminder: a first, primary partition with fat16 (as filesystem as well as partition’s system id!) with bootable-flag set. The partition should start behind MBR at 1st cylinder and 63rd sector (see www.ata-atapi.com/hiwmbr.htm and thestarman.pcministry.com/asm/mbr/index.html for more details about MBR). So how does a correct partition look like? Output in several formats as reference:
# fdisk -l -u /dev/sda
Disk /dev/sda: 1039 MB, 1039663104 bytes
255 heads, 63 sectors/track, 126 cylinders, total 2030592 sectors
Units = sectors of 1 * 512 = 512 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63     2024189     1012063+   6  FAT16
# fdisk -l /dev/sda
Disk /dev/sda: 1039 MB, 1039663104 bytes
255 heads, 63 sectors/track, 126 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         126     1012063+   6  FAT16
# sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors
/dev/sda1 : start=       63, size=  2024127, Id= 6, bootable
/dev/sda2 : start=        0, size=        0, Id= 0
/dev/sda3 : start=        0, size=        0, Id= 0
/dev/sda4 : start=        0, size=        0, Id= 0
Tip: if you have a working stick, store your partition layout using ’sfdisk -d /dev/sda > sfdisk.sda’ for later restore (via ’sfdisk /dev/sda < sfdisk.sda’). This is also very useful for cloning a working setup to other devices (though you might have to adjust cylinder/units later on). And of course you can use it as backup if you ran [sc]fdisk-commands on the wrong device. ;-)

5 April 2007

Michael Prokop: crm114: Controllable Regex Mutilator and Spam Filter

Do you already know crm114? Taking quotes of the crm114 book:
What is this? Some kind of grep bitten by a radioactive spider?
— apocryphal CRM114 isn’t ugly like PERL. It’s a whole different kind of ugly.
— John Bowker
Want to get a calculator using crm114? No problem:
% cat > calc << EOF
 
  eval (:_dw:) /:@: :*:_dw: :/
  output /:*:_dw: \n/
 
EOF
% crm calc
(42*23)+(11/3.14) # press return and EOF (ctrl-d) at this stage and get the result:
 969.50318
There’s a crm114 book (PDF, 283 pages!) available for free download. Just apt-get crm114, the installed-size is less than 1MB. Thanks Maddi for pointing me to it again, it was on my todolist for ages. ;)

14 March 2007

Michael Prokop: Maintain /etc with mercurial on Debian

Based on Bart Trojanowski’s blog article “etc snapshots with git” I removed one further item from my todo list: maintain /etc with mercurial on my Debian systems. First step is creating the repository and securing access to the repository. As mercurial stores all its files within one single directory named .hg you won’t have any further directories within /etc besides /etc/.hg, rocking - right? ;-)
cd /etc
hg init
chmod og-rwx .hg
Ignore a few files:
cat > .hgignore << EOF
syntax: regexp
(^)*.dpkg-new
(^)*.dpkg-old
(^)blkid.tab( .old)
(^)mtab
# add other files if necessary, depends on your setup...
EOF
Now commit the current state:
hg add
hg ci -m "initial checkin"
We want to commit the changes automatically when using apt-get/aptitude so let’s write and include a wrapper for it:
cat > /etc/apt/hg-snapshot-script << EOF
#!/bin/sh
set -e
caller=$(ps axww   mawk '/aptitude apt-get/  for (i=5; i<=NF ; i++) printf ("%s ",$i); printf ("n")  '   head -1)
hg add 1>/dev/null
STATUS="$(hg st)"
if [ -n "$STATUS" ] ; then
   echo "hg-snapshot-script: found changed files:"
   hg st
   hg ci -m "snapshot from $LOGNAME after: $caller"
else
   echo "hg-snapshot-script: nothing to be done"
fi
EOF
chmod +x /etc/apt/hg-snapshot-script
cat >> /etc/apt/apt.conf << EOF
DPkg  
  Post-Invoke  "cd /etc ; ./apt/hg-snapshot-script"; ;
 
EOF
Finally track the two files too:
hg add
hg commit -m "apt will track /etc automagically using hg"
That’s it. :-) Oh BTW: users of subversion might want to point their browser to /etc under svk (by Enrico Zini).

10 March 2007

Michael Prokop: Chemnitzer Linuxdays 2007: done

grml booth at chemnitzer linuxdays 2007 Ok, a little bit delayed due to busy days… - anyway. Last weekend Chemnitzer Linuxdays 2007 took place and as already written in the grml-develblog I’ve been there. As every year Chemnitzer Linuxdays were great. I really enjoyed meeting people, hacking and giving support at the grml-booth, though it was quite stressful for me overall. On saturday I visited only one talk, it was Meike’s one - a very nice talk. :-) On sunday I had my own talk, about “Erfolgreiche OpenSource Projekt-Maintenance” (successfull opensource project maintenance). My slides (PDF) are available online (german only, sorry).

27 February 2007

Michael Prokop: grml @ Chemnitzer Linux Days 2007

The countdown is running… On 3rd and 4th of March 2007 the Chemnitzer Linux Days will take place. We’ll present grml (Linux Live-CD for sysadmins / texttool-users / geeks) at a booth there! If everything works as intented we will have a demo system as well as CDs of a special grml release named “Dioptrienotto @ clt07″: Screenshot of grml clt07 release Several grml developers will be there and I’m looking forward to meet formorer for the first time in RL. 8-) Hope to see you there! :-)

26 February 2007

Michael Prokop: argument list too long

A problem everyone stumbles across (at least) once:
% tar zcf stats_2005.tar.gz stats_2005*
zsh: argument list too long: tar
The reason? Too many files for the ARG_MAX limit. ARG_MAX defines the maximum length of arguments to the exec function (more precise: bytes of args plus environment for exec), defined in /usr/include/linux/limits.h on your Linux system:
% ls -la   grep -c stats_2005
9037
% getconf ARG_MAX
131072
% cpp << EOF   tail -1
#include <limits.h>
ARG_MAX
EOF
131072
%
Ok. But how to work around the issue? Possible solution for GNU:
% find . -name 'stats_2005*' > filelist
% tar zcf stats_2005.tar.gz --files-from filelist
Without the temporary file (filelist in our example):
% find . -name 'stats_2005*' -print   tar zcf stats_2005.tar.gz --files-from -
zsh provides zargs (but AFAIK it doesn’t work with gzip in the same command line due to the way zargs works, so create the archive in one step and compress it in another step later):
% autoload zargs
% zargs -- stats_2005* -- tar --ignore-failed-read -rpf stats_2005.tar
The approach works with other tools than tar as well of course, usage example for afio:
find . -name 'stats_2005*' -print   afio -o -Z stats_2005.afio
Depending on the type of problem (rm, cp, mv,…) you can choose differented approaches as well, some further examples:
% for file in stats_2005* ; do rm -f -- "$file" ; done
% perl -e 'unlink <stats_2005*>'
% zsh -c 'zmodload zsh/files && rm -f -- stats_2005*'
% zsh -c 'autoload -U zargs; zargs -r ./stats_2005* -- rm -f'
% ksh93 -c 'command -x rm -f -- stats_2005*'
% find . -maxdepth 1 -name 'stats_2005*' -print0   xargs -r0 rm -f
% find . -name 'stats_2005*' -print0   xargs -0 mv -i --target-dir=/destination
% zmodload zsh/files ; mv -- stats_2005* /destination

24 February 2007

Michael Prokop: zsh: insert-unicode-char

Ever wanted to insert a character in your terminal but don’t have a keybinding for that character? zsh provides a nifty feature called insert-unicode-char:
autoload insert-unicode-char
zle -N insert-unicode-char
bindkey '^Xi' insert-unicode-char
Figure out the character’s code (take a look at unicode.org/charts/ for example) and press ‘ctrl-x i’, followed by the character’s code and press ‘ctrl-x i’ once more. Usage example: ‘ctrl-x i 00A7 ctrl-x i’ will give you an ‘ ’.

Next.

Previous.