Friday, June 28, 2013

Spanish or Bust: Attaining fluency in 90 days or else ...

"How do you have an adventure?"

"You take a stupid idea, and follow through ..."

Perhaps, I've truly lost my mind for once, but I've decided to embark on a personal project to try and achieve some fluency in Spanish in just 90 days, and posting it to the internet to try and keep me honest and on track towards doing so. I will post future updates as I go, and would welcome help from anyone who would be interested in helping!

The cost of failure: being forced to praise Wndows 8 in a future video, and run it for one week on my laptop.



(I apologize for the quality, but I finally managed to find the nerve to record myself doing this, and just uploaded before I lost it again)


Friday, June 22, 2012

Announcement of Calxeda Highbank Images for Quantal

Hello all,

As many of you are aware, Canonical, in coordination with Calxeda and others have been working to bring Ubuntu to this new class of high-performance cluster yet low power-consumption computers built around ARM processors. Many of you who were in attendance at UDS in Oakland may remember seeing Calxeda's talks and demonstration live, and the exciting news that this represents. The full presentation is available here.

In line of this work, I'm am extremely pleased to announce that the initial images for the Calxeda Highbank platform are now available for download, with installation instructions available here. Please remember that Quantal is still in alpha development, and is not currently recommended for use in a production environment. As development of 12.10 continues, we will continue to refine these images, and our tools to fully embrace MAAS on ARM, and make 12.10 to be our best release yet.


As an additional note, Highbank support for Ubuntu 12.04 LTS will be released as part of the 12.04.1 update in mid-August and will join our support for ArmadaXP from Marvell, which was released as part of 12.04.

---
Michael Casadevall
ARM Server Tech Lead
Professional Engineering and Services, Canonical
michael.casadevall@canonical.com

Sunday, November 20, 2011

Possible GLX Bug in Ubuntu; feedback needed (affects Intel video cards 2D/3D acceleration)

So I've been recently screwing around with VirtualBox on a personal project, and I ran into an issue with not being able to enable 2D/3D acceleration on Ubuntu 11.10. After quite a bit of debugging and forum searching, the problem was that the NVIDIA GLX driver was being loaded instead of the standard MESA one, preventing any video acceleration from properly working on my Intel based video card.

I just recently reinstalled Kubuntu on this laptop, and since its a fairly stock install at the moment, I suspect that this is a general (K)ubuntu bug, and not something related to me screwing around with my system. In addition, since I switched to using Kubuntu full time, this is the first time I've seen transparency and other desktop effects, and system performance has improved dramatically. While I can't say for certian, I suspect that my system was also affected on its previous install. Part of the issue may be related to what packages are seeded per flavour, so this bug may only affect those who installed Kubuntu over say Xubuntu or Ubuntu; without more information, its impossible to say.

This is where you can help; if you are running any flavor of Ubuntu with an Intel based video card, you might be affected by this too.

Here's how to check; open a terminal, and type:

mcasadevall@daybreak:/var/log$ cat /var/log/Xorg.0.log

then find the section where the glx module is loaded. It looks something like this:

[236901.570] (II) LoadModule: "glx"
[236901.571] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[236901.578] (II) Module glx: vendor="X.Org Foundation"
[236901.578] compiled for 1.10.4, module version = 1.0.0
[236901.578] ABI class: X.Org Server Extension, version 5.0

(this is on a machine where the Intel acceleration is properly working).

If it says 'ATi' or 'NVIDIA', you've run into the same issue I have. So dear readers, I ask that if you've had any issue with graphic performance, gaming, or simple UI lag and have an Intel video card, please post a comment with you video card, what flavor of Ubuntu you have installed, and the glx section of Xorg.0.log. If I get a few reports that confirm this, I'll file a proper bug in Launchpad, and then work to get this fixed.

Wednesday, November 16, 2011

Touch-friend apps in Ubuntu/Debian?

I'm working on a personal pet project and wanted to get some feedback on the best apps to use in a touch only environment. I know that there are a few people who use Debian or Ubuntu on a tablet, and I was hoping to get suggestions on the best desktop environment and apps available. Please leave some comments with suggestions, and with a little luck, I'll have something to demo on this blog in a few weeks.

Tuesday, November 15, 2011

Secure Boot - its here and been here for quite awhile ...

There's been a lot of noise with Microsoft requiring Secure Boot for Windows 8 OEMs. For those of you unfamiliar with it, Secure Boot requires that the boot chain is signed, and this 'feature' must be enabled by default. Although I have been unable to find specific details, it appears that the chain of trust needs to extend from BIOS/UEFI all the way down to the kernel. Obviously, requiring a signed boot chain makes using FOSS platforms like Ubuntu or Debian an impossibility short of having the UEFI Platform Key and resigning the entire chain.

Steven Sinofsky's MSDN blog has a fairly good overview how it works. Canonical and Red Hat also have a good white paper on why secure boot is a serious problem for Linux distributions. Even if secure boot itself can be disabled, it *greatly* rises the bar for general end-users to successfully install Ubuntu on their machine. In addition, it is the responsibility of OEM and BIOS manufacturers to provide the option to disable it.

There already has been a long history of OEMs removing BIOS options or introducing DRM; for instance, locking out VTx on Sony laptops, or restricting laptops to only accept 'branded' wifi and 3G cards. Given this track record, can OEMs realistically be trusted to have this option available?

What most people don't realize is that secure boot itself is not a new concept; its simply part of the Trusted Computing initiative, and has been implemented on embedded platforms for many years. If you own any iPhone, or one of the vast majority of Android devices, you are using a device that either has the secure boot feature, or something very close. This especially painful in Android as Google's security system restricts users to a *very* limited shell and subset of utilities which can be used on non-rooted devices. WebOS, Maemo, and to my knowledge Meego give the end-user full unrestricted access to the boot chain and you can swap kernels and even the entire OS out if one was so motivated.

Although it is still an ongoing problem, several vendors such as HTC, Samsung, Motorola (kinda), and even Sony. In the Android community, having unlockable bootloaders has been a welcome middle ground in the traditionally restrictive and locked-down world of cellular devices.

While some may argue that such locks are necessary to protect consumers, it is perfectly feasible to create devices with unlocked bootloaders that are still secure. The Nook Color's is an Android powered eReader. It's stock firmware doesn't allow sideloaded applications or even access to a user shell via adb, but the BootROM on the device attempts to boot from the microSD card before eMMC, making it possible for enterprising users to easily modify the underlying OS (as well as making it physically impossible to brick the device due to a bad flash). Barnes and Nobles even sells a book on rooting the Nook Color; it was right next to the devices on display at the time. In addition, they've continued the tradition of easily modifiable devices with both the Nook Simple Touch, and the Nook Tablet.

One of the most impressive attributes is the possibility of running Ubuntu on it. The absolute poster child for this is the Toshiba AC100. For those of you unfamiliar, it ultralight netbook that shipped with Android 2.1/2.2 with easy access to the built in flash via the mini-USB port on the side of the device. Due to the valiant efforts of the AC100 community, Ubuntu was ported to this device, and became a supported platform with images available on cdimages.ubuntu.com. If you were an attendee at UDS, you likely saw several AC100s all running Ubuntu.

This brings me to the point that motivated me to write this post in the first place. One of the most impressive tablets I've seen to date is the ASUS eeePad Transformer, an Android tablet with fully dockable keyboard. I have one of these devices, and its one of the most impressive and usable Android tablets I own. Sadly, such a powerful device was hobbled from its true potential due to ASUS's decision to ship the device with a locked and encrypted bootloader. Surprisingly, the Secure Boot Key (SBK) was acquired and released to the wild, making it possible to reflash the device. Sadly, even with the SBK, the device's bootloader is still extremely hobbled compared to the AC100 making flashing a slow and difficult process.

In response, ASUS refreshed the eeePad's hardware to the new B70 SKU, which has a new Secure Boot. Despite this, a root exploit was recently found to allow people to circumvent these restrictions and install customs ROMs. It is however only a manor of time before ASUS responds and releases a new update that fixes this bug.

Steven Barker (lilstevie) on xda-developers successfully created a port of Ubuntu to the Transformer. Currently, installing Ubuntu on the Transformer requires nvflash access, so its not possible to use his image on the newly liberated B70 devices. I am certain that a new method of installing via an update.zip will be developed for those of us with hobbled devices.

It is a showcase of what is possible when you have open hardware, and also proves one indisputable point: any 'trusted boot' or DRM scheme can and will be defeated; at best you piss off your userbase, and at worst, you force users to exploit bugs to gain control of their device. As it is impossible to reflash these devices from the bootloader, a failed kernel flash WILL brick these devices, increasing warranty and support costs as users try to return their now broken devices.

In closing, while there have been some victories in ongoing war of open hardware vs. trusted comptuing, the road ahead still remains very murky. Victories in the mobile market have shown that there is a market for open devices. Google's own Nexus One was sold as a developers phone and as a way to encourage manufacturers to raise the bar. It sold well enough to recoup its development costs.. While there is no official statements, the Nokia N900 is suspected to have broken all sales expectations, backed up by the fact that Angry Birds sold extremely well on the Ovi Store for the N900.

From the article in question:
What reaction have you had in terms of sales and customer feedback?

Angry Birds had already been launched on App Store before it came out on Ovi Store, and it had a great review average from iPhone reviewers and users alike, so we expected a good reception from N900 users as well.

Even so, we were quite surprised by just how the N900 community immediately took the game to heart. The game obviously made many people very happy, and that is really the greatest achievement that anyone who creates entertainment for a living can hope for. Well, maybe the greatest achievement is huge bundles of cash, but making people happy comes a close second.

In the first week that Angry Birds has been on the Ovi Store, it has been downloaded almost as many times as the iPhone version in six weeks. Given that most N900 users have not even used Ovi Store yet, we are confident that there will be many more downloads in the months to come, and are sure that the N900 version will be very profitable.

That being said, with Microsoft pushing secure boot and trusted computing down everyone's throats with Windows 8, it is hard to say what the future might hold for those of us who want to own our devices.

Friday, July 1, 2011

Pandaboard Netboot Images Now Available

As I mentioned in my previous blog post, OMAP4 netboot images were available, but non-functional. I'm pleased to announce that these bugs have now been resolved and it is possible to have a functional install on OMAP4. This also has the added advantage of allowing one special partitioning layouts such as RAID, LVM, or simply having a non-SD based root device. The images are available here: http://ports.ubuntu.com/ubuntu-ports/dists/oneiric/main/installer-armel/current/images/omap4/netboot/

To use, simply dd boot.img-serial or boot.img-fb to an SD card, pop it in, and run, and the installer will pop up.

There is still a known bug that partman will not properly create the necessary boot partition. During the partitioning step, you must select manual partitioning, then create a 72 MiB FAT32 partition, with no mount point, and the Bootable flag must be set to 'on'. This partition must be the first partition on the device. flash-kernel-installer will be able to find the partition on its own.

Thursday, June 30, 2011

On porting the installer (Part 1)...

So as Alpha 2 approaches, I find myself working towards porting the alternate installer/d-i to the pandaboard to support the netboot installer. There's not a lot of documentation that describes the internals of d-i, nor what bits are platform specific.

This is especially true when working towards creating a new subarchitecture since lots of little places have to be touched, kernels usually have to be tweaked, and all other sorts of odds and ins. This post isn't a comprehensive guide to what's necessary, but just little tidbits of what I did, just some random odds and ends.

The first step of any enablement is to have something you can run and boot. The netboot images, as well as the alternate kernel and ramdisk are built out of the debian-installer package. In the debian-installer package, several config files for driving the process are located in build/config/$arch/$subarch. For omap4, we have the following files:

boot/arm/generate-partitioned-filesystem
build/config/armel.cfg
build/config/armel/omap4.cfg
build/config/armel/omap4/cdrom.cfg
build/config/armel/omap4/netboot.cfg

boot/arm/generate-partitioned-filesystem is a shell script that takes a VFAT blob, and spits out a proper MBR and partition table.

build/config/armel.cfg simply is a list subarchitectures to build, and some sane-ish kernel defaults for armel.

build/config/armel/omap4.cfg is also a simple config file which specifies the type of images we're building, and the kernel to use in d-i. This file looks like this:

MEDIUM_SUPPORTED = netboot cdrom

# The version of the kernel to use.
KERNELVERSION := 2.6.38-1309-omap4
# we use non-versioned filenames in the omap kernel udeb
KERNELNAME = vmlinuz
VERSIONED_SYSTEM_MAP =

As a point of clarification, 'cdrom' is a bit of a misdemeanor; it refers to the alternate installer kernel and ramdisk used by alternate images, and not the type of media. Other types of images exist such as 'floppy' and 'hd-install', but these are specialized images, and out of scope for this blog post.

Each file in build/config/armel/omap4/* is a makefile thats called in turn for each image that created. The most interesting of this is the netboot.cfg

MEDIA_TYPE = netboot image
SUBARCH = omap4
TARGET = $(TEMP_INITRD) $(TEMP_KERNEL) omap4
EXTRANAME = $(MEDIUM)
INITRD_FS = initramfs

MANIFEST-INITRD = "netboot initrd"
MANIFEST-KERNEL = "kernel image to netboot"
INSTALL_PATH = $(SOME_DEST)/$(EXTRANAME)

omap4:
 # Make sure our build envrionment is clean
 rm -rf $(INSTALL_PATH)
 mkdir -p $(INSTALL_PATH)

 # Generate uImage/uInitrd
 mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Ubuntu kernel" -d $(TEMP_KERNEL) $(INSTALL_PATH)/uImage
 mkimage -A arm -O linux -T ramdisk -C none -a 0x0 -e 0x0 -n "debian-installer ramdisk" -d $(TEMP_INITRD) $(INSTALL_PATH)/uInitrd

 # Generate boot.scrs
 mkimage -A arm -T script -C none -n "Ubuntu boot script (serial)" -d boot/arm/boot.script-omap4-serial $(INSTALL_PATH)/boot.scr-serial
 mkimage -A arm -T script -C none -n "Ubuntu boot script (framebuffer)" -d boot/arm/boot.script-omap4-fb $(INSTALL_PATH)/boot.scr-fb

 # Create DD'able filesystems
 mkdosfs -C $(INSTALL_PATH)/boot.img-fat-serial 10240
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/uImage ::uImage
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/uInitrd ::uInitrd
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial /usr/lib/x-loader/omap4430panda/MLO ::MLO
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial /usr/lib/u-boot/omap4_panda/u-boot.bin ::u-boot.bin
 cp $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/boot.img-fat-fb
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/boot.scr-serial ::boot.scr
 mcopy -i $(INSTALL_PATH)/boot.img-fat-fb $(INSTALL_PATH)/boot.scr-fb ::boot.scr
 boot/arm/generate-partitioned-filesystem $(INSTALL_PATH)/boot.img-fat-fb $(INSTALL_PATH)/boot.img-fb
 boot/arm/generate-partitioned-filesystem $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/boot.img-serial

 # Generate manifests
 update-manifest $(INSTALL_PATH)/uImage "Linux kernel for OMAP Boards"
 update-manifest $(INSTALL_PATH)/uInitrd "initrd for OMAP Boards"
 update-manifest $(INSTALL_PATH)/boot.scr-fb "Boot script for booting OMAP netinstall initrd and kernel from SD card. Uses framebuffer display"
 update-manifest $(INSTALL_PATH)/boot.scr-serial "Boot script for booting OMAP netinstall initrd and kernel from SD card. Uses serial output"
 update-manifest $(INSTALL_PATH)/boot.img-serial "Boot image for booting OMAP netinstall. Uses serial output"
 update-manifest $(INSTALL_PATH)/boot.img-fb "Boot image for booting OMAP netinstall. Uses framebuffer output"

The vast majority of this is fairly straightforward. TARGET represents the targets called by make. There are tasks for creating a vmlinuz and initrd that must be included. The omap4 target then handles specialized handling for the omap4/netboot image.

omap4 requires a VFAT boot partition on the SD card with a proper filesystem and MBR. The contents of the filesystem are straightforward:

MLO - also known as x-loader, a first stage bootloader
u-boot.bin - u-boot binary, second stage bootloader, used to book the kernel
uImage - linux kernel with special uboot header (created with mkimage)
uInitrd - d-i ramdisk with special uboot header
boot.scr - special boot script for u-boot for commands to execute at startup.

MLO and u-boot.bin are copied in from x-loader-omap4-panda and u-boot-linaro-omap4-panda which are listed as build-deps in the control file for d-i. boot.scr is generated from a plain-text file:

fatload mmc 0:1 0x80000000 uImage
fatload mmc 0:1 0x81600000 uInitrd
setenv bootargs vram=32M mem=456M@0x80000000 mem=512M@0xA0000000 fixrtc quiet debian-installer/framebuffer=false console=ttyO2,115200n8
bootm 0x80000000 0x81600000

These are u-boot commands that simply load the uImage/uInitrd into RAM, set the command line, and then boot into it.

When porting the installer, it is mostly a task of putting your subarchitecture name in the right places, then adding the necessary logic in places to spit out an image that boots. This provides a sane base to start working on porting other bits of the installer. When d-i is uploaded to Launchpad, these files end up in http://ports.ubuntu.com/ubuntu-ports/dists/oneiric/main/installer-armel/current/images/

My next blog post will go a bit into udebs, and understanding how d-i does architecture detection, and introducing flash-kernel.

Thursday, November 11, 2010

On Achieving Goals ...

*blows the dust off his blog*

It's been quite awhile since I last wrote anything in this thing, so I guess its a good time as any, off the tails of UDS-N, to finally sit down and write something down. Since my last blog posting in May, I've been travelling around the world, attending conferences, and trying to represent both Ubuntu and Debian itself, and Canonical in all my travels. I was recently posted to China for a full month where I lived and worked out of an office, made friends with fellow Ubuntu users, and tech enthusiasts, had a wonderful time meeting with people with the Beijing Linux User's Group, and worked hard within my team at Canonical, and the legions of Ubuntu Developers to help make one of the best releases we've ever had.

As I was writing specs and drafting work items, I came to the point that I was reflecting on my own personal goals and growth in life. Two years and change ago, I was a struggling junior at Rochester Institute of Technology, a little less than two years ago, I started working full time with Canonical, and this year, I've gone and traveled to many places I've only dreamed about; Anchorage & Barrow, Alaska; Tampere, Finland; Prague, Czech Republic; and Brussels, Belgium, just to name a few. I packed up and lived in China for a month (an amazing experience, and I look forward to going back and visiting again sometime in the near future). Had you told the me of two years ago what I would be doing now, I'd probably think you were smoking something good.

One thing I've discovered in my life is that if you want to do something, you need to get out there and just ****ing do it. This may seem simple, but I think of the dreams a lot of people have that never seem to come to fruition. When I have an opportunity, I take it; going to Alaska was a dream I harbored for many years, especially entering the arctic circle, and heading to Barrow. That entire trip was booked on roughly four days notice, and the side trip to Barrow was planned the day before it actually happen. I don't regret any of it; it was one of the best things I ever done.

It brings me to what I consider the flux of this blog posting. For those who know me, I've had a goal of visiting every state within the United States. At this time last year, this map looked like this

As of two weeks ago today, this map looked like this:



Now, by the end of the day today, it will look like this:



The point I'm trying to make is if you want to do something, do it the first chance you get, or just don't do it; I say this because you never know when you will be able to do it again.

As for completing a life goal, well, it feels pretty amazing :-). I may write about that in a future blog posting ...

Sunday, May 16, 2010

Mailing Lists and Newsreaders ....

So for awhile, I've been questioning on why very few FOSS programs use newsgroups (or USENET on moderated groups) as their primary means of communication between developers. I personally find email to be a clunky way dealing with mass-mailings, and while switching to alpine and mutt have helped, I feel newsgroups would work better in place of mailing lists.

In this spirit, I'm going to try to replace reading most of my public facing mailing lists with Gmane and see if my opinion actually holds true; if newsgroups are superior to bog-standard mailing lists, and post back in some time. I'm currently looking at various GUI and console based newsreaders to see which works best to meet my needs.

I also need to blow the dust off the memories and remember how to setup leafnode so I can mimic OfflineIMAP. Any suggestions are welcome.

Thursday, February 4, 2010

1984

It's been awhile since I last posted, but I felt the need to do so after my recent flight through ATL. While I was waiting for my connection the loudspeakers announced that we were at threat level "Orange" and that we, the people, had to be on guard for threats to our country.



Does this remind anyone of anything? If your answer is 1984, then you win. When did we get to this point that our government is feeling more and more like the Party; I am just waiting for the day when we have telescreens constantly watching for terrorism and other threats ...



I hope this day never comes but given the path we have been on since 9/11, I fear for the future ...

Tuesday, August 25, 2009

Setting up a GPG smartcard ...

So after having my trusty Sony VAIO do a bunk on me, its replacement, a Lenovo Thinkpad T400 has just arrived, and I'm now working through the process of getting it setup and ready to work as my main x86/amd64 machine, (for those wondering, my desktop machine, titan is an SMP ia64 that was donated to me to help improve the Ubuntu/ia64 port). I'm still getting things settled on it, but one of the nicest things about is it has a built in smartcard slot for me to use my GPG smartcard with, and figured now is a good time to write up howto get started with it.

If your using a smartcard that can handle larger than 1024-bit keys, make sure you use gpg2 in place of gpg, as gpg can't handle moving large keys to the card. The primary key in all cases can and should be as large as possible, since only the subkeys will be moved to the GPG smartcard. gpg-agent MUST be running to access the smartcard.

The first step is to install the correct packages for your smartcard; for me gpg2 and gpgsm did the trick. pcscd and gnupg-agent are also needed. If successful, you should be able to query your card:

mcasadevall@daybreak:~$ gpg --card-status

gpg: detected reader `Lenovo Integrated Smart Card Reader 00 00'
Application ID ...: D27600012401020000050000005D0000
Version ..........: 2.0
Manufacturer .....: unknown
Serial number ....: 0000005D
Name of cardholder: [not set]
Language prefs ...: de
Sex ..............: unspecified
URL of public key : [not set]
Login data .......: [not set]
Private DO 1 .....: [not set]
Private DO 2 .....: [not set]
Signature PIN ....: forced
Max. PIN lengths .: 32 32 32
PIN retry counter : 3 0 3
Signature counter : 0
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
General key info..: [none]



If you got this far, so far so good. The next step is to set your personal information on the card itself, and to generate new GPG keys for it. The first step can be done by typing the following commands:

Couple of important safety notes: The card will accept up to three wrong PINs and then block, making it impossible to unblock without the admin PIN. Three wrong admin PINs and your card fries itself (like a SIM card with too many wrong PUK codes entered) so be VERY VERY careful!


mcasadevall@daybreak:~$ gpg --card-edit

gpg: detected reader `Lenovo Integrated Smart Card Reader 00 00'
Application ID ...: D27600012401020000050000005D0000
Version ..........: 2.0
Manufacturer .....: unknown
Serial number ....: 0000005D
Name of cardholder: [not set]
Language prefs ...: de
Sex ..............: unspecified
URL of public key : [not set]
Login data .......: [not set]
Private DO 1 .....: [not set]
Private DO 2 .....: [not set]
Signature PIN ....: forced
Max. PIN lengths .: 32 32 32
PIN retry counter : 3 0 3
Signature counter : 0
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]
General key info..: [none]

Command> admin
Admin commands are allowed

Command> name
Cardholder's surname: Casadevall
Cardholder's given name: Michael
gpg: 3 Admin PIN attempts remaining before card is permanently locked

Admin PIN
gpg: gpg-agent is not available in this session

Command> lang
Language preferences: en

Command> sex
Sex ((M)ale, (F)emale or space): m

Command> quit
mcasadevall@daybreak:~$


Now there are a few choices to make here. You can generate a key on the card itself (the generate command) and then use it by itself, move your private key to the card, and use it as above, or add a subkey, and then use that. I'm going to choose the later.

For those of you who are not familiar, GPG subkeys as essentially private keys to be used while the primary key remains safe and sound. Subkeys can sign files, and encrypt/decrypt email as normal, but they can't be signed, nor can they sign other keys. They are trusted through signatures on the primary key.

As an additional step, since my GPG key is in the somewhat old and dated DSA 1024 format, I feel the time has come to replace it with a newer 4096 bit RSA key (for my rationale, take a look at: http://74.125.93.132/search?q=cache:wA6b7rbT0p0J:www.debian-administration.org/users/dkg/weblog/48+http://www.debian-administration.org/users/dkg/weblog/48&hl=en&client=firefox-a&gl=us&strip=1 (the link is a google cache link as of writing debian-administration.org is down)

So lets do that first. I'm generating my keyring onto an external device which will contain the primary key, and the subkeys on file. The primary key is the only one which can be used to sign other keys:

mcasadevall@daybreak:~$ gpg2 --homedir /media/disk/gpg_keys --gen-key
gpg: WARNING: unsafe permissions on homedir `/media/disk/gpg_keys'
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: keyring `/media/disk/gpg_keys/secring.gpg' created
gpg: keyring `/media/disk/gpg_keys/pubring.gpg' created
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 4
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
0 = key does not expire
= key expires in n days
w = key expires in n weeks
m = key expires in n months
y = key expires in n years
Key is valid for? (0) 1y
Key expires at Wed 25 Aug 2010 07:57:17 PM EDT
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: Michael Casadevall
Email address: mcasadevall@ubuntu.com
Comment:
You selected this USER-ID:
"Michael Casadevall <mcasadevall@ubuntu.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: /media/disk/gpg_keys/trustdb.gpg: trustdb created
gpg: key 7B8E6A47 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2010-08-25
pub 4096R/7B8E6A47 2009-08-25 [expires: 2010-08-25]
Key fingerprint = C7A5 543F 2D33 3791 4EF0 C915 7B4D 847C 7B8E 6A47
uid Michael Casadevall <mcasadevall@ubuntu.com>

Note that this key cannot be used for encryption. You may want to use
the command "--edit-key" to generate a subkey for this purpose.



I *really* need a hardware entropy generator for when I generate keys. I recommend setting the preferences for generating signatures and the like with: setpref SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed


mcasadevall@daybreak:~$ gpg2 --homedir /media/disk/gpg_keys --edit-key mcasadevall@ubuntu.com
gpg: WARNING: unsafe permissions on homedir `/media/disk/gpg_keys'
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1). Michael Casadevall <mcasadevall@ubuntu.com>

Command> uid 1

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1)* Michael Casadevall <mcasadevall@ubuntu.com>

Command> setpref SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
Set preference list to:
Cipher: AES256, AES192, AES, CAST5, 3DES
Digest: SHA512, SHA384, SHA256, SHA224, SHA1
Compression: ZLIB, BZIP2, ZIP, Uncompressed
Features: MDC, Keyserver no-modify
Really update the preferences for the selected user IDs? (y/N) y

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@ubuntu.com>"
4096-bit RSA key, ID 7B8E6A47, created 2009-08-25


pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1)* Michael Casadevall <mcasadevall@ubuntu.com>

Command> save
mcasadevall@daybreak:~$


Add any uids you need to your key. This can be done with the adduid command after issuing the edit-keys command

mcasadevall@daybreak:~$ gpg2 --homedir /media/disk/gpg_keys --edit-key mcasadevall@ubuntu.com
gpg: WARNING: unsafe permissions on homedir `/media/disk/gpg_keys'
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1). Michael Casadevall <mcasadevall@ubuntu.com>

Command> adduid
Real name: Michael Casadevall
Email address: michael.casadevall@canonical.com
Comment:
You selected this USER-ID:
"Michael Casadevall <michael.casadevall@canonical.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@ubuntu.com>"
4096-bit RSA key, ID 7B8E6A47, created 2009-08-25


pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1) Michael Casadevall <mcasadevall@ubuntu.com>
[ unknown] (2). Michael Casadevall <michael.casadevall@canonical.com>

Command> adduid
Real name: Michael Casadevall
Email address: mcasadevall@debian.org
Comment:
You selected this USER-ID:
"Michael Casadevall <mcasadevall@debian.org>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@ubuntu.com>"
4096-bit RSA key, ID 7B8E6A47, created 2009-08-25


pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1) Michael Casadevall <mcasadevall@ubuntu.com>
[ unknown] (2) Michael Casadevall <michael.casadevall@canonical.com>
[ unknown] (3). Michael Casadevall <mcasadevall@debian.org>

Command> adduid
Real name: Michael Casadevall
Email address: mcasadevall@kubuntu.org
Comment:
You selected this USER-ID:
"Michael Casadevall <mcasadevall@kubuntu.org>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@ubuntu.com>"
4096-bit RSA key, ID 7B8E6A47, created 2009-08-25


pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1) Michael Casadevall <mcasadevall@ubuntu.com>
[ unknown] (2) Michael Casadevall <michael.casadevall@canonical.com>
[ unknown] (3) Michael Casadevall <mcasadevall@debian.org>
[ unknown] (4). Michael Casadevall <mcasadevall@kubuntu.org>

Command> save
mcasadevall@daybreak:~$


Now lets add an encryption and signing subkey for this keyring so you can send and receive encrypted emails. Make sure the size is small enough to fit on your card (my card can take 3072 per key*, your millage may vary); this step and the next use gpg2 due to incompatbilities with my card (see below for full story). In addition, I'm going to set these subkeys to expire after a year, partially because I intend to replace the subkey with a 3072-bit or 4092-bit subkey later (depending on smartcard support), and partially incase my smartcard is ever lost, the keys will expire themselves should I loose the private subkey (which is possible by accident due to gnupg moving keys to smartcards).

* - for those of us with g10code 2.0 smartcards, there seems to be an issue with using 3072-bit encryption keys. I'm not sure if the problem with the card, the cardreader, or gnupg, but for now, I'll use 2048 subkeys, and replace them with 3072-bit keys later on.


mcasadevall@daybreak:~$ gpg2 --homedir /media/disk/gpg_keys --edit-key mcasadevall@ubuntu.com
gpg: WARNING: unsafe permissions on homedir `/media/disk/gpg_keys'
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2010-08-25
pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
[ultimate] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ultimate] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ultimate] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ultimate] (4) Michael Casadevall <mcasadevall@debian.org>

Command> addkey
Key is protected.

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@kubuntu.org>"
4096-bit RSA key, ID 7B8E6A47, created 2009-08-25

Please select what kind of key you want:
(3) DSA (sign only)
(4) RSA (sign only)
(5) Elgamal (encrypt only)
(6) RSA (encrypt only)
Your selection? 6
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
= key expires in n days
w = key expires in n weeks
m = key expires in n months
y = key expires in n years
Key is valid for? (0) 1y
Key expires at Wed 25 Aug 2010 08:12:37 PM EDT
Is this correct? (y/N) y
Really create? (y/N) y
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
[ultimate] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ultimate] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ultimate] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ultimate] (4) Michael Casadevall <mcasadevall@debian.org>

Command> addkey
Key is protected.

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@kubuntu.org>"
4096-bit RSA key, ID 7B8E6A47, created 2009-08-25

Please select what kind of key you want:
(3) DSA (sign only)
(4) RSA (sign only)
(5) Elgamal (encrypt only)
(6) RSA (encrypt only)
Your selection? 4
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
= key expires in n days
w = key expires in n weeks
m = key expires in n months
y = key expires in n years
Key is valid for? (0) 1y
Key expires at Wed 25 Aug 2010 08:12:51 PM EDT
Is this correct? (y/N) y
Really create? (y/N) y
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
[ultimate] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ultimate] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ultimate] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ultimate] (4) Michael Casadevall <mcasadevall@debian.org>

Command> save


*phew*
This step is optional, but if you want an authetication key, this is how you create one. A signing key can be used as an authetication key, but the reverse is not true. You need to use expert mode to create an authenication key.


mcasadevall@daybreak:~$ gpg2 --homedir /media/disk/gpg_keys --expert --edit-key mcasadevall@ubuntu.com
gpg: WARNING: unsafe permissions on homedir `/media/disk/gpg_keys'
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
[ultimate] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ultimate] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ultimate] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ultimate] (4) Michael Casadevall <mcasadevall@debian.org>

Command> addkey
Key is protected.

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@kubuntu.org>"
4096-bit RSA key, ID 7B8E6A47, created 2009-08-25

Please select what kind of key you want:
(3) DSA (sign only)
(4) RSA (sign only)
(5) Elgamal (encrypt only)
(6) RSA (encrypt only)
(7) DSA (set your own capabilities)
(8) RSA (set your own capabilities)
Your selection? 8

Possible actions for a RSA key: Sign Encrypt Authenticate
Current allowed actions: Sign Encrypt

(S) Toggle the sign capability
(E) Toggle the encrypt capability
(A) Toggle the authenticate capability
(Q) Finished

Your selection? s

Possible actions for a RSA key: Sign Encrypt Authenticate
Current allowed actions: Encrypt

(S) Toggle the sign capability
(E) Toggle the encrypt capability
(A) Toggle the authenticate capability
(Q) Finished

Your selection? e

Possible actions for a RSA key: Sign Encrypt Authenticate
Current allowed actions:

(S) Toggle the sign capability
(E) Toggle the encrypt capability
(A) Toggle the authenticate capability
(Q) Finished

Your selection? a

Possible actions for a RSA key: Sign Encrypt Authenticate
Current allowed actions: Authenticate

(S) Toggle the sign capability
(E) Toggle the encrypt capability
(A) Toggle the authenticate capability
(Q) Finished

Your selection? q
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
= key expires in n days
w = key expires in n weeks
m = key expires in n months
y = key expires in n years
Key is valid for? (0) 1y
Key expires at Wed 25 Aug 2010 08:15:34 PM EDT
Is this correct? (y/N) y
Really create? (y/N) y
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
sub 2048R/AF3D8E0C created: 2009-08-26 expires: 2010-08-26 usage: A
[ultimate] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ultimate] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ultimate] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ultimate] (4) Michael Casadevall <mcasadevall@debian.org>

Command> save



Ok. Now is a good time to export your keys, make backups of your .gnupg folder, generate revocation certificates and such. Once your done doing that, lets copy those keys to the card. What will happen specifically is the key will be moved to the card, and a stub key will be left in its place, which will require the card in place to be used. The backup you make here will be the full key, ready incase something ever happens to your card.

As a second note this is just a guideline on how I generated keys, some people might want to make their keys expire as an additional method of protection just in-case normal revocation becomes impossible. Finally, I know people will question why I generated an authentication key, but my goal with this key is to use it to make smartcard SSH possible, allowing me to replace my .ssh folder with the smartcard.

Anyway, take a drink, breath, and get ready to copy things to the card. We're going to take the secret subkeys, export them, then import them into the normal keyring, then move them to the card:

Couple of important safety notes:
1. A signing key CAN be used as an authetication key. If you generated a separate authentication key, make sure you put that in the right spot, and the signing key in the signing key spot, or else you will have to back up and do it again
2. Once you toggle, you can't see the purpose of the keys, so make sure you refer to it before doing anything
3. The admin pin is needed to move the keys
4. You need to deslect each key after you move it and select the new one
5. You can't delete a key off the card once its there (as far as I can tell), but you can replace it.
6. NEVER use your primary copy of your keyring to move keys!


mcasadevall@daybreak:/media/disk$ chmod a-w gpg_keys/*
mcasadevall@daybreak:~$ gpg --homedir /media/disk/gpg_keys/ --export-secret-subkeys > ~/tmp.key


Unmount your pendrive or secure media with your private keys, and have it go be guarded by orcs. Now its time to import the subkeys into GPG, and then move them to the card. Since your not moving the trustdb, you'll also have to manually reset the trust of your private key once its imported.


mcasadevall@daybreak:~$ gpg --import tmp.key
gpg: key 7B8E6A47: secret key imported
gpg: /home/mcasadevall/.gnupg/trustdb.gpg: trustdb created
gpg: key 7B8E6A47: public key "Michael Casadevall <mcasadevall@kubuntu.org>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
gpg: secret keys read: 1
gpg: secret keys imported: 1
mcasadevall@daybreak:~$ shred tmp.key
mcasadevall@daybreak:~$ rm tmp.key
mcasadevall@daybreak:~$ gpg --edit-key mcasadevall@ubuntu.com
gpg (GnuPG) 1.4.9; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: unknown validity: unknown
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
sub 2048R/AF3D8E0C created: 2009-08-26 expires: 2010-08-26 usage: A
[ unknown] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ unknown] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ unknown] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ unknown] (4) Michael Casadevall <mcasadevall@debian.org>

Command> trust
pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: unknown validity: unknown
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
sub 2048R/AF3D8E0C created: 2009-08-26 expires: 2010-08-26 usage: A
[ unknown] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ unknown] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ unknown] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ unknown] (4) Michael Casadevall <mcasadevall@debian.org>

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: unknown
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
sub 2048R/AF3D8E0C created: 2009-08-26 expires: 2010-08-26 usage: A
[ unknown] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ unknown] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ unknown] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ unknown] (4) Michael Casadevall <mcasadevall@debian.org>
Please note that the shown key validity is not necessarily correct
unless you restart the program.
Command> quit
mcasadevall@daybreak:~$ gpg2 --edit-key mcasadevall@ubuntu.com
gpg (GnuPG) 2.0.12; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2010-08-25
pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
sub 2048R/AF3D8E0C created: 2009-08-26 expires: 2010-08-26 usage: A
[ultimate] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ultimate] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ultimate] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ultimate] (4) Michael Casadevall <mcasadevall@debian.org>

Command> toggle

sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb 2048R/1E2110C3 created: 2009-08-26 expires: never
ssb 2048R/C511F667 created: 2009-08-26 expires: never
ssb 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> key 1

sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb* 2048R/1E2110C3 created: 2009-08-26 expires: never
ssb 2048R/C511F667 created: 2009-08-26 expires: never
ssb 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> keytocard
Signature key ....: 3396 1F69 327C 1645 B0CF 057E 89D1 1A4A 4E4D 5498
Encryption key....: 114E 692C D22F 89C1 F0EA 4AE8 83AA F05E A383 3408
Authentication key: FFFC 04A6 3FE8 AF4C F9A6 F660 A3C2 A7CD 1A8B DA08

Please select where to store the key:
(2) Encryption key
Your selection? 2

gpg: WARNING: such a key has already been stored on the card!

Replace existing key? (y/N) y

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@kubuntu.org>"
2048-bit RSA key, ID 1E2110C3, created 2009-08-26


sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb* 2048R/1E2110C3 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb 2048R/C511F667 created: 2009-08-26 expires: never
ssb 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> key 1

sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb 2048R/1E2110C3 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb 2048R/C511F667 created: 2009-08-26 expires: never
ssb 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> key 2

sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb 2048R/1E2110C3 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb* 2048R/C511F667 created: 2009-08-26 expires: never
ssb 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> keytocard
Signature key ....: 3396 1F69 327C 1645 B0CF 057E 89D1 1A4A 4E4D 5498
Encryption key....: 90FE 16DC C170 7550 780A 94B4 A1EE 54A9 1E21 10C3
Authentication key: FFFC 04A6 3FE8 AF4C F9A6 F660 A3C2 A7CD 1A8B DA08

Please select where to store the key:
(1) Signature key
(3) Authentication key
Your selection? 1

gpg: WARNING: such a key has already been stored on the card!

Replace existing key? (y/N) y

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@kubuntu.org>"
2048-bit RSA key, ID C511F667, created 2009-08-26


sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb 2048R/1E2110C3 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb* 2048R/C511F667 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> key 2

sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb 2048R/1E2110C3 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb 2048R/C511F667 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> key 4
No subkey with index 4

Command> key 3

sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb 2048R/1E2110C3 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb 2048R/C511F667 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb* 2048R/AF3D8E0C created: 2009-08-26 expires: never
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> keytocard
Signature key ....: 60C1 8447 B8B5 619A AD0B DE9E 9DDA 9A07 C511 F667
Encryption key....: 90FE 16DC C170 7550 780A 94B4 A1EE 54A9 1E21 10C3
Authentication key: FFFC 04A6 3FE8 AF4C F9A6 F660 A3C2 A7CD 1A8B DA08

Please select where to store the key:
(3) Authentication key
Your selection? 3

gpg: WARNING: such a key has already been stored on the card!

Replace existing key? (y/N) y

You need a passphrase to unlock the secret key for
user: "Michael Casadevall <mcasadevall@kubuntu.org>"
2048-bit RSA key, ID AF3D8E0C, created 2009-08-26


sec 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25
ssb 2048R/1E2110C3 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb 2048R/C511F667 created: 2009-08-26 expires: never
card-no: 0005 0000005D
ssb* 2048R/AF3D8E0C created: 2009-08-26 expires: never
card-no: 0005 0000005D
(1) Michael Casadevall <mcasadevall@ubuntu.com>
(2) Michael Casadevall <michael.casadevall@canonical.com>
(3) Michael Casadevall <mcasadevall@debian.org>
(4) Michael Casadevall <mcasadevall@kubuntu.org>

Command> toggle

pub 4096R/7B8E6A47 created: 2009-08-25 expires: 2010-08-25 usage: SC
trust: ultimate validity: ultimate
sub 2048R/1E2110C3 created: 2009-08-26 expires: 2010-08-26 usage: E
sub 2048R/C511F667 created: 2009-08-26 expires: 2010-08-26 usage: S
sub 2048R/AF3D8E0C created: 2009-08-26 expires: 2010-08-26 usage: A
[ultimate] (1). Michael Casadevall <mcasadevall@kubuntu.org>
[ultimate] (2) Michael Casadevall <mcasadevall@ubuntu.com>
[ultimate] (3) Michael Casadevall <michael.casadevall@canonical.com>
[ultimate] (4) Michael Casadevall <mcasadevall@debian.org>

Command> save




At this point, all the secret subkeys have been removed, and only exist on your pendrive (along with the primary key), or on your smartcard. The secret keys on this machine have been replaced with stubs that tell gnupg to look at the smartcard for the secert key. If you export the secret keys now, you'll only export the stub, and not the secret key.

If done correctly, any operations requiring your private key will now require you to put in the smartcard as that's the only copy of the subkeys available. You'll want to make sure both signing and encryption/decrption works:

Decryption:

mcasadevall@daybreak:~$ gpg2 -d examples.desktop.gpg
gpg: encrypted with 2048-bit RSA key, ID 1E2110C3, created 2009-08-26
"Michael Casadevall <mcasadevall@kubuntu.org>"
gpg: public key decryption failed: Card not present
gpg: decryption failed: No secret key

*card is inserted*
mcasadevall@daybreak:~$ gpg2 -d examples.desktop.gpg
gpg: encrypted with 2048-bit RSA key, ID 1E2110C3, created 2009-08-26
"Michael Casadevall <mcasadevall@kubuntu.org>"
[Desktop Entry]
Version=1.0
Type=Link
Name=Examples
Name[es]=Ejemplos
Name[fi]=Esimerkkejä
Name[fr]=Exemples
Comment=Example content for Ubuntu
Comment[es]=Contenido del ejemplo para Ubuntu
Comment[fi]=Esimerkkisisältöjä Ubuntulle
Comment[fr]=Contenu d'exemple pour Ubuntu
URL=file:///usr/share/example-content/
X-Ubuntu-Gettext-Domain=example-content

mcasadevall@daybreak:~$


Signing with smartcard:

mcasadevall@daybreak:~/src$ debsign hello_2.4-1_source.changes
signfile hello_2.4-1.dsc 7B8E6A47
gpg: selecting openpgp failed: ec=6.112
gpg: signing failed: general error
gpg: /tmp/debsign.voIxh9WX/hello_2.4-1.dsc: clearsign failed: general error
debsign: gpg error occurred! Aborting....
mcasadevall@daybreak:~/src$

*insert the card*
mcasadevall@daybreak:~/src$ debsign hello_2.4-1_source.changes
signfile hello_2.4-1.dsc 7B8E6A47

signfile hello_2.4-1_source.changes 7B8E6A47



Your done! I hope you've found this guide helpful. I currently haven't released this GPG key into the wild JUST yet, but I likely will within this week once I make sure I've done everything correctly. Please leave comments if you see any mistakes or want to make any recommendations. Thanks for reading!

Saturday, August 1, 2009

On the topic of being prepared ...

Disaster can strike at any time. Such as 00:00, in Ireland, thousands of miles away from home. I'm pleased to report my /usr/lib folder did a bunk, and simply vanished, leaving my system in an unusable state. I managed to check dmesg before my system crashed, seems my laptop's HDD reported a load of error messages before my system went and did a bunk. I'm not sure if this is failed hardware, a kernel issue, or something else.

Fortunately, I'm prepared for such a disaster. I have a Kubuntu livecd which has been living in my bag since UDS, a spare netbook (with an SATA drive I can poach if I can confirm this one has actually failed or I can use it as a full blown replacement if need-be, although its slow), a USB HDD which I'm now backing up what remains of my data (the irreplaceables, that is, my GPG, SSH keys, and most of my writing are already safely backed up at home on my file server), and so forth.

SMART status on the internal HDD is as follows:
ubuntu@ubuntu:/$ sudo smartctl -H /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022 054 031 045 Old_age Always In_the_past 46 (0 48 46 39)

Looks like the drive probably overheated in the distant past, but SMART did pass so I dunno ... Anyway, given the state of things, I'll run badblocks on the drive once I finish backing up, and hope for the best. Its got to make it to the end of this week ...

Wednesday, May 27, 2009

UDS Day 3 & KDE involvement

Hola all,
So this is my first blog post since UDS started (although I have been doing some work microblogging this session around (I find that if I treat it like multicast IRC using gwibber, it suddenly makes more sense to me). We're now three days into UDS, and working hard on defining what Ubuntu karmic will be, and I must say I am excited with the way things are shaping up to UNR discussions, to the Android Execution Environment (and if anyone has any questions on it, please direct those emails to Michael Frey and Debbie Beliveau as they are the people behind it, despite Slashdot's reports on the subject).

There are loads going on, including Moblin (which you'll see this afternoon), Android (same), ports kernel handling, and loads of other cool things come up. I'll comment on some of the more interesting things as time goes on.

In other news, as of late last night, I'm officially an upstream KDE developer with SVN commit writes. I've written an email detailing my plans for working on KDE to kde-core-deveonl, where is it is happily stuck in a moderation queue, so hopefully those involved in upstream KDE development will soon learn of my intentions :-).

I'll write more later,
Michael

Friday, April 24, 2009

Jaunty Retrospect

Guess its my time to post something about my feelings on Jaunty.

The Good:
* armel successfully birthed
* powerpc well on the way to be well maintained
- Kernel and installer work mostly done by TheMuso (thanks :-))
- Image testing by the people of #ubuntu-ps3, myself, and TheMuso
- powerpc, and powerpc+ps3 both in the release annoucements for Kubuntu and Xubuntu :-)
* Kubuntu upgraded to KDE 4.2
* Xubuntu upgraded to Xfce 4.6
* PowerPC FTBFS rate in main very low. ia64, and sparc looking more improved.

The Bad:
* SPARC, ia64, and HPPA remain fairly foobar w.r.t. to the installer and kernel

The Ugly:
* The drama over notifications and update-manager

All and all though, I think its been a fairly good cycle. Looking forward to karmic.

Thursday, January 15, 2009

Re-enginneering my network ...

As I move to having more and more machines on my internal LAN, I felt the time had finally come that I sit down, and rebuild my network to take advantage of things such as gigabyte networking, LDAP, single-user sign on, and so forth. I'm doing partially for fun, and partially because its an interesting experiment to see how Linux from an IS environment compares to a Windows 200x IS environment (one of my former jobs was a 2000/XP/2003/Vista sysadmin position).

So, here's my current network setup
blacksteel <- *wireless* ---------------------------------------------- cerberus <-> Internet
/
dawn <------ *wired*-----------------------------------------------------
/
360 <---- *wired* -----------------------------------------------------

Online machines:
cerberus - WRT51GS
backsteel - My laptop
dawn - Development machine
360 - Xbox 360, used to play media from blacksteel

Offline machines (aka, machines I have, but haven't fired up since moving:
helios (PowerMac G4)
apollo (old Dell P3)
junker (RS/6000 rescued from the dumpster, might be dead)
alexandria (NSLU2; gave up its plug for dawn)
coldfusion (Coldfire Board, might be dead; ethernet controller is faulty, but might be able to use a USB based one to breath some life into it; can't autoreboot due to built in bootloader not supporting it; and no JTAG to sanely change the default bootloader).
siren (old MacBook Pro, has a dead internal HDD, but runs fine from an external hard drive. Was my Debian test box until its HDD went to dawn)
exodius - second WRT54GS used to be part of a WDS bridge.
unnamed dev box (not here yet, but likely soon).

Of all these machines, only apollo has a wireless card which ATM is non-functional. In addition, the wired bits of my network are 100Mbps, with a g based wireless hotspot (WPA secured). Futhermore, blacksteel, helios, and siren have gigabyte ethernet. apollo has 100MBps ethernet card. alexandria and dawn have 10MBps, which is painful, especially for NFS root.

I'll drop another 1Gbps NIC into apollo, replacing its wireless card, and give dawn, alexandria, and maybe coldfusion USB based NICs once I get around to resurrecting systems (alexandria and coldfusion don't have hard drives at the moment)

What I would like to do is use an Linux-based router and replace Cerberus. Helios has two gigabyte NICs, so it will take up this duty, as well as provide DHCPv4, and radvd (for IPv6) for the internal network. It's an old computer, and has an onboard model, and its position in my apartment will be close to a phone jack; maybe I'll set it up so I can dial in from outside the LAN in case something goes down (although my phones here are VoIP based so I dunno how useful that's going to be :-)).

Another box (I might task this to apollo, or helios) will run LDAP and NFS services, providing both a netboot based installation with preseed for fast re-installation, and NFS home folders for all machines except blacksteel (unless someone knows a great solution for having a laptop sync NFS and local home folders. helios will run mail, news, and any other untrusted net facing services, with everything else shielded behind it. All machines will run IPv4 and 6.

Anyway, this is the start of my plan in a nutshell, and I intend to continue discussion as I slowly build and implement this updated setup. Wish me luck :-).

Friday, January 2, 2009

Notes from Underground, Part 1

For those following d-devel, you may notice that I've recently been working on improving one of the cornerstones of Debian infrastructure; the Debian Archive Kit, or dak for short. Most DDs and DMs don't notice dak exists expect when trying to determine why their latest upload was rejected, and then yelling at the powers that be. I'm here to shead some light on this mythicial beast.

First off, a quick history lesson:

dak (also known as projectb) is a replacement for Debian's original archive software, known simply as dinstall. dinstall itself was a fairly large perl script that does what dak process-unchecked/process-accepted does today. James Troup did a fairly decent summary of dinstall, and its issues

James Troup's README.new-incoming (from dak's git repo):

The old system:
---------------
o incoming was a world writable directory

o incoming was available to everyone through http://incoming.debian.org/

o incoming was processed once a day by dinstall

o uploads in incoming had to have been there > 24 hours before they
were REJECTed. If they were processed before that and had
problems they were SKIPped (with no notification to the maintainer
and/or uploader).

dak's first commits were in 2000, and rolled out onto ftp-master.d.o sometime in 2001 or 2002 (I can't find an exact date for this). Since then, dak is also used on security.d.o, and on backports.org (fun fact for bpo people; the dak installation there is now up to date, and tracking git's tip).

So now that you know the history lesson, what specificially does dak do is the next question. Simply put, dak is the glue that binds the rest of the Debian's backends together; both britney and wanna-build/buildd depend on it. It handles management of uploads to the archive, handles stable release updates, as so forth. It is also the only Debian archive software that uses an actual database backend, and scales fairly well handling over 10,000 packages, and 12 architectures. Unfortunately, there are also a lot of issues with dak as it stands.

Sections of the code base have bitrotted over the years; legacy and legacy-mixed support have died, the import-archive function is shot (more so now than ever, see below), the test suite is non-functional (never a good sign), the docs are out of date, and in many places non-existant, doing a release (both point and full) requires editing the database and so forth.

In addition, dak, while written in python, is written in a fairly procedural style, and and some very ugly code in some places. For instance, the original Debian Maintainer code was handled by having the uid's in the database prefixed by dm: vs having a flag somewhere, and had some hardcoded variables like checking for "unstable", as well as quite a few bugs which caused interesting behavior when uploading to a non-unstable suite such as experimental or one of the proposed queues. (for those of curious, I recommend checking the dak git tree to see what the old DM code looked like, and then aside from the design, find the two major bugs which caused a lot of the weirdness with DMs). It should be stated that the last merge from redid the DM code and design sanely using the new update framework.

These issues have lead to the genesis of the dak v2 project, which is an attempt to replace dak with a module, rewritten from the ground up to be more secure and modular, although its not gotten very far as of writing. I personally don't believe that the current iteration of dak is so bad as scrapping and rewritting is necessary. Instead, I've been working to implement v2 features in dak by aggressive refactoring and cleanup, with the hope of negating the need for a rewrite.

So now thats out of the way, I bet you probably are interested in my .plan for dak. Well, lets go over I've implemented so far.

* An update database framework for dak, which will allow for easy database upgrade and migration, vs the "does it work yet?" approach to applying schema updates. Simply type dak update-db, and your done!

* 822 formatted output for queues (http://ftp-master.debian.org/new.822); this information is now used on DDPO pages

* Rewriting DM management code to have more of a brain than the previous implementation.

What's next on the TODO list

* Content file generation from the database (part of removal of apt-ftparchive, but thats another blog post ;-)).

Oh, as a side note to my current readers, my blog has changed names to "Notes from Underground", after one of my favorite novels, and futher in reference to exploring the mysterious underground that is Debian's backend code. We're also now on Planet Debian :-).

Tuesday, November 18, 2008

ARM and MID ...

So for those of you playing along at home, we have a newly available ARM port, which has just reached the point of being able to debootstrap itself with a buildd varient (i.e., install build-essential and a few other packages). Now the fun begins with porting stuff.

First up is mono. Mono has a port to ARM and ARMel already, however, this code obviously hasn't been compiled in sometime, as it FTBFS due to glibc 2.8+svn. *grumble*. Oh well, easy fix, and one that will help clear a bunch of other dep-waits and get us that much closer to a usable port.

Monday, November 10, 2008

WiiBuntu (Part 1), Ubuntu Ports MID, and lpia

So here I am, with a wonderful Wii, complete with Twilight Hack and Homebrew Menu installed, wondering if I could do something crazy like run Ubuntu on it. After some trial and error, it appears possible to do a debootstrap of an Ubuntu PowerPC installation and have it work!.

So now that I have a Wii with Ubuntu installed, what am I going to do with it, that is the question I am now pondering. The answer seems obvious, put Ubuntu MID on the sucker, install XWii (Wiimote Pointer Driver), and the WiiX display driver, and turn it into a very pretty multitouch system. Yay :-) So it should just be a matter of 'aptitude install ubuntu-mid'

Sadly, its not quite that easy. Ubuntu-MID currently is only installable on lpia. I can hear the questions now, WTF is lpia. To answer that question, lpia is the Low-Power Intel Architecture, also known as the Intel Atom processor family. For those of you familar with Atom, you might be double-taking, saying Atom is an x86 based processor. Again, your right, lpia is x86 based (you can run it on normal PCs), its essentially i386 Ubuntu with a few optimizations.

The problem breaks down to the way some of the MID's compontents were packaged. The main problem comes in the form that the rules file, instead of properly splitting the packages out, the rules file checks for the lpia architecture, and then changes the configure options to build hildon support (hildon is the nifty library from Nokia that makes MID work). To fix MID on ports (and x86/amd64), each package with this lpia detector switch must be found, and then properly split. Sounds easily enough, right?

Wrong. Most of the packages (such as evince) are CDBS packages. For anyone who knows anything about CDBS, you know it was never meant to split packages :-/. This *will* be fun :-/.

As an added note, OpenOffice.org is broken on PowerPC, double fun, since compiling it will likely take longer than releasing Jaunty will take :-).

Wednesday, November 5, 2008

More notes from the PIE party (Ubuntu bootstrapping howto) ...

So after getting stuck and putting this work aside, I decided to take a second stab at it after meeting up with another Ubuntu developer in real life, and doing additional research. Using the experimental gcc-4.3 branch of Gentoo Hardened as a base, I'm now making extremely good progress bootstrapping amd64-pie, and the results look promising thus far.

For those of us curious, bootstrapping the archive is a straightforward if time intensive project. Essentially the process requires three individual bootstraps, an inital one that you use to build debian package, a chroot from those package, and a final chroot that is the end result.

Right now I'm working on the first part of this bootstrap, which is from a Linux host (without Debian) to generating the inital bootstrap packages. It requires compiling each build-dep from source with the proper configuration arguements, then building the packages with dpkg-buildpackage -d, and installing it, until you have build the entire base system.

From there, you take the debs, place them in a repo, and debootstrap, and then rebuild again, which produces the final result debs. It's straightforward and fasicating work (if a little tedious)
Michael

Friday, September 12, 2008

Well, I'm a (K)ubuntu member now :-)

I figure I should break in my first post, that I'm now a Kubuntu member, and through that, also an Ubuntu member, and thus can post to Ubuntu Planet now :-).

For all of those out there who helped make this possible, thank you. Next stop, MOTU.