Following instructions isn’t always easy

Need to update my Slacko stick

But there is no newer Firefox in Puppy it seems and I am too lazy to
go through all the creation of PETs when I want a new version.

A bit of web searching led me to
Freedom Embedded

So let’s see if I can follow the instructions.

They boil down to roughly this:

  • Create a disk image that corresponds in size to the size of the USB
    stick,

  • Obtain a Debian ISO image,

  • Boot QEMU with that image,

  • Install to the newly created image file, setting up file system
    type, swap, encryption, etc. as we go.

  • Shut down QEMU,

  • Copy the image file to the stick using dd.

So here we go.

To make slightly better use of time I’ll start downloading the Debian
image first so that it can work while I do the other steps. I’ll go
for a stable build instead of a daily. A quick look on debian,org
took me to this:

http://cdimage.debian.org/cdimage/release/current/i386/iso-cd/debian-8.1.0-i386-netinst.iso

First make a directory for all this stuff then run wget to download
the image.

kj@otto:~$ mkdir ~/encryptedusb
kj@otto:~$ cd encryptedusb/
kj@otto:~/encryptedusb$ wget http://cdimage.debian.org/cdimage/release/current/i386/iso-cd/debian-8.1.0-i386-netinst.iso
--2015-06-14 17:56:00--  http://cdimage.debian.org/cdimage/release/current/i386/iso-cd/debian-8.1.0-i386-netinst.iso
Resolving cdimage.debian.org (cdimage.debian.org)... 130.239.18.173, 130.239.18.165, 2001:6b0:e:2018::173, ...
Connecting to cdimage.debian.org (cdimage.debian.org)|130.239.18.173|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://gensho.acc.umu.se/cdimage/release/current/i386/iso-cd/debian-8.1.0-i386-netinst.iso [following]
--2015-06-14 17:56:00--  http://gensho.acc.umu.se/cdimage/release/current/i386/iso-cd/debian-8.1.0-i386-netinst.iso
Resolving gensho.acc.umu.se (gensho.acc.umu.se)... 130.239.18.176, 2001:6b0:e:2018::176
Connecting to gensho.acc.umu.se (gensho.acc.umu.se)|130.239.18.176|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 330301440 (315M) [application/x-iso9660-image]
Saving to: ‘debian-8.1.0-i386-netinst.iso’

 5% [=>                                     ] 19,346,405   393KB/s  eta 10m 44s^C
kj@otto:~/encryptedusb$

Actually that took almost no time because it is the net install image.

No we need to find the device name of the stick because we need to
find out how big it is. This is not something I do everyday so I have
forgotten how. I started Nautilus and an entry appeared in the devices list on the left pane accompanied by a large box with an error message which amongst a lot of other verbiage said:

Failed to mount '/dev/sdc1': Invalid argument.

and complaints about NTFS signatures being missing.

Some people,
superuser: How do I figure out which /dev is a USB flash drive?,
suggest using the mount command to find it but that won’t work
because it is not mounted. I also tried the suggested blkid without
getting any output at all.

In the end the most useful was this:

kj@otto:~/encryptedusb$ ls -l /dev/disk/by-id/*usb*
lrwxrwxrwx 1 root root  9 Jun 14 17:20 /dev/disk/by-id/usb-Multiple_Card_Reader_058F63666435-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Jun  4 19:39 /dev/disk/by-id/usb-Multiple_Card_Reader_058F63666435-0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Jun 14 17:21 /dev/disk/by-id/usb-SanDisk_Cruzer_Blade_4C530100231211109035-0:0 -> ../../sdc
lrwxrwxrwx 1 root root 10 Jun 14 17:22 /dev/disk/by-id/usb-SanDisk_Cruzer_Blade_4C530100231211109035-0:0-part1 -> ../../sdc1
kj@otto:~/encryptedusb$

Now I have it because it has Sandisk Cruzer written on it. So
/dev/sdc it is.

So to get the size we do exactly as Balau did and hit our first
roadblock:

kj@otto:~/encryptedusb$ blockdev --getsize64 /dev/sdc
blockdev: cannot open /dev/sdc: Permission denied
kj@otto:~/encryptedusb$

Perhaps this has something to do with the file system that is on the
stick. But no it does not, it is simply that I am not root, serves me
right for not reading carefully enough, try again with sudo:

kj@otto:~/encryptedusb$ sudo blockdev --getsize64 /dev/sdc
[sudo] password for kj: 
16008609792
kj@otto:~/encryptedusb$

Now make a file, called usbkey that size, being careful to subtract
one:

kj@otto:~/encryptedusb$ dd if=/dev/zero of=usbkey.img bs=1 count=1 seek=16008609791
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.0665122 s, 0.0 kB/s
kj@otto:~/encryptedusb$

Now I start qemu:

kj@otto:~/encryptedusb$ qemu -m 512 -enable-kvm -hda usbkey.img -cdrom debian-8.1.0-i386-netinst.iso 
The program 'qemu' can be found in the following packages:
 * qemu-system-arm
 * qemu-system-mips
 * qemu-system-misc
 * qemu-system-ppc
 * qemu-system-sparc
 * qemu-system-x86
Try: sudo apt-get install 
kj@otto:~/encryptedusb$

This is a bit irritating because I have just installed qemu using
Synaptic. Time for more web searching.

A search for ubuntu quemu command missing finds (Index » Newbie
Corner » Qemu command not
found..)[https://bbs.archlinux.org/viewtopic.php?id=134902].
Scrolling all the way to the bottom we find:

firecat53 wrote:

The command on our systems with the regular 'qemu' package is "qemu-system-x86_64" (or i-386)

So try that:

kj@otto:~/encryptedusb$ qemu-system-i386 -m 512 -enable-kvm -hda usbkey.img -cdrom debian-8.1.0-i386-netinst.iso 
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
kj@otto:~/encryptedusb$

Try without -enable-kvm:

kj@otto:~/encryptedusb$ qemu-system-i386 -m 512 -hda usbkey.img -cdrom debian-8.1.0-i386-netinst.iso

Well, at least it started qemu. But it declared that the disk image
was not bootable.

Try another route. I installed QtEmu from Synaptic and used it to
create a new VM. Just create any size hard disk, you will change it
later.

Go to the settings and choose the image you created earlier as the
hard disk in the Settings tab, also change the memory from the
default 128MB to 512MB. In the Control Panel under Reload Optical
drive
choose the Debian image that was downloaded earlier.

Now try starting it. Unfortunately it also complains about KVM
modules so I suppose I must conclude that something is missing from my
kernel.

I have *VirtualBox installed so I suppose I could try that.

Leave a comment