Debian installer partitioner confused by USB memory stick
I just installed Debian 4.0r3 on a Linksys NSLU2 (arm-based tiny NAS box), installing the root filesystem onto a 256MB USB flash thumb drive. I ran into an annoying Debian installer issue where the installer appears to try to use the device for the entire thumb drive (rather than a partition), but mkfs.ext3 blocks the process by asking for confirmation.
The Debian installer I'm using is from: <http://www.slug-firmware.net/d-dls.php>. This is the same as the official installer, but include proprietary microcode for the ethernet hardware, which is necessary since I'm installing over the network.
My setup: NSLU2 with 256MB thumb flash drive drive on USB port 2 and 1TB hard drive on USB port 1. The hard drive has 512MB of swap set up as /dev/sda1, and the rest as a partition I'll use for user data on /dev/sda2. I want to install Debian's root on the flash drive (/dev/sdb) to avoid accessing the disk too much, so it can spin down when idle.
My procedure:
- Flash Debian 4.0r3 firmware from http://www.slug-firmware.net/d-dls.php
- Boot slug.
- ssh in as installer.
- Proceed to partitioning step.
- Because the NSLU2 has too little RAM, we need to create a swap partition early. In another terminal, ssh in, go to shell, run 'mkswap /dev/sda1' and 'swapon /dev/sda1'.
- Choose manual partitioning in installer.
- Set up /dev/sdb1 as ext3, mounted on '/'. Oddly, it doesn't show the partitions on /dev/sda (SCSI1):
┌────────────────────────┤ [!!] Partition disks ├─────────────────────────┐
│ │
│ This is an overview of your currently configured partitions and mount │
│ points. Select a partition to modify its settings (file system, mount │
│ point, etc.), a free space to create partitions, or a device to │
│ initialise its partition table. │
│ │
│ Guided partitioning │
│ Help on partitioning │
│ │
│ /dev/mtdblock0 - 262.1 kB Unknown │
│ /dev/mtdblock1 - 131.1 kB Unknown │
│ /dev/mtdblock2 - 131.1 kB Unknown │
│ /dev/mtdblock3 - 1.4 MB Unknown │
│ /dev/mtdblock4 - 6.3 MB Unknown │
│ /dev/mtdblock5 - 131.1 kB Unknown │
│ SCSI1 (0,0,0) (sda) - 1.0 TB PI-202US SATA/USB20 Drive │
│ SCSI2 (0,0,0) (sdb) - 259.5 MB LEXAR JUMPDRIVE PHOTO │
│ > #1 259.5 MB F ext3 / │
│ │
│ Undo changes to partitions │
│ Finish partitioning and write changes to disk │
│ │
│ <Go Back> │
│ │
└─────────────────────────────────────────────────────────────────────────┘
- Continue. It hangs on this screen:
┌────────────────────────┤ Partitions formatting ├────────────────────────┐
│ │
│ 33% │
│ │
│ Creating ext3 file system for / in partition #1 of SCSI2 (0,0,0) │
│ (sdb)... │
└─────────────────────────────────────────────────────────────────────────┘
Running ps in a shell reveals:
11321 root 564 S udpkg --configure --force-configure partman-base
11322 root 492 S /bin/sh /var/lib/dpkg/info/partman-base.postinst conf
11323 root 680 S /bin/sh /bin/partman
11599 root 876 S parted_server
16361 root 672 S /bin/sh /lib/partman/commit.d/50format_ext3
16480 root 484 S log-output -t partman --pass-stdout mkfs.ext3 /dev/sc
16481 root 556 S mkfs.ext3 /dev/scsi/host1/bus0/target0/lun0/disc
If I manually run the mkfs.ext3 command, I get:
/var/log # mkfs.ext3 /dev/scsi/host1/bus0/target0/lun0/disc
mke2fs 1.40-WIP (14-Nov-2006)
/dev/scsi/host1/bus0/target0/lun0/disc is entire device, not just one partition!
Proceed anyway? (y,n) n
Looks like partman is invoking mkfs for the whole device and hanging while mkfs asks for confirmation! Here's my crude workaround:
/ # mkfs.ext3 /dev/sdb
mke2fs 1.40-WIP (14-Nov-2006)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
63488 inodes, 253440 blocks
12672 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
31 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
/ # cd /sbin
/sbin # mv mkfs.ext3 mkfs.ext3.real
/sbin # echo '#!/bin/sh' > mkfs.ext3
/sbin # chmod +x mkfs.ext3
Then I kill the hung mkfs.ext3 process with 'kill 16481'. The partitioner fails, and I go back through the process again. This time it succeeds (since mkfs.ext3 is a no-op).
It turns out a basic install of Debian (without the "standard system" task) just barely fits:
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 14.6M 388.0k 14.3M 3% /dev
tmpfs 14.6M 388.0k 14.3M 3% /dev
tmpfs 14.6M 388.0k 14.3M 3% /.dev
/dev/scsi/host1/bus0/target0/lun0/disc 239.7M 213.6M 13.7M 94% /target
It's much better after running apt-get clean:
sluggy:/var/cache# apt-get clean
sluggy:/var/cache# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 240M 168M 61M 74% /
tmpfs 15M 0 15M 0% /lib/init/rw
udev 10M 32K 10M 1% /dev
tmpfs 15M 0 15M 0% /dev/shm
I'm not sure what the best solution is to the installer problem. My preferred solution would be to have the partitioner actually use /dev/sdb1 rather than /dev/sdb. However, if there's some good reason to set up single-partition flash disks using the raw device rather than a partition, it should indicate that in the UI more clearly and invoke mkfs.ext3 in a way that it doesn't hang.
Seth
Reply to: