Dear lazyweb, I would like to download an arbitrary ISO image (say, a Ubuntu 10.04 Desktop CD)
into a directory of a USB flash drive, and then make that USB flash drive boot
that ISO image. I do not want to
- re-partition or re-format the flash drive (this eliminates usb-creator, AFAIU)
- extract the contents of the ISO image into the root of the USB drive
(this eliminates unetbootin)
- skip the ISO's bootloader and directly boot the kernel+initramfs from
the ISO (eliminates this
recipe, and this
recipe)
I just want a bootloader on the USB to read the VFAT filesystem, mount the ISO image as a loop device,
then chain-load the bootloader from that ISO. Bonus points for having a menu letting me choose one of
several ISO images. Running a script to edit a text file (say, grub's config)
to get that menu is fine.
Is this even possible? If not, can I at least have two out of three (no
partition/extraction, but skipping intrinsic bootloader is fine)?
Solution that I finally chose (from Ubuntu forums):
Plug in USB key. Find out the mount point (/media/disk) and the device
name (/dev/sdx) of the USB key with
$ mount|grep /media
Install GRUB 2 into the USB key with
$ sudo grub-install --root-directory=/media/usbdisk /dev/sdx
If it says something about embedding being impossible and falling back
to UNRELIABLE blocklist-based setup, run
$ sudo grub-install --root-directory=/media/usbdisk /dev/sdx --force
Download a CD
image, let's say ubuntu-10.10-desktop-i386.iso. Put it into
/media/usbdisk/ubuntu/.
Create a text file /media/usbdisk/boot/grub/grub.cfg with
menuentry "Ubuntu 10.10 (x86 desktop livecd)" {
set isofile="/ubuntu/ubuntu-10.10-desktop-i386.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash noprompt --
initrd (loop)/casper/initrd.lz
}
You can have as many ISO images as you want, just make sure to add a
menuentry for each. There's no need to run grub-install again after adding
or removing a .iso file. Oh, and if you want to use an ISO file for a
different distribution, you'll have to figure out the correct linux and initrd
lines somehow.
Update: Ubuntu 13.04 changed the name of the kernel -- use
(loop)/casper/vmlinuz.efi instead of (loop)/casper/vmlinuz.
I tested it with the following images
- ubuntu-10.04-desktop-i386.iso
- ubuntu-10.04-server-i386.iso
- ubuntu-10.04-server-amd64.iso
- ubuntu-10.10-desktop-i386.iso
- ubuntu-11.04-desktop-i386.iso
- ubuntu-11.10-desktop-i386.iso
- ubuntu-12.04-desktop-i386.iso
- ubuntu-12.04-desktop-amd64.iso
- ubuntu-12.04-server-i386.iso
- ubuntu-12.04-server-amd64.iso
- ubuntu-12.10-desktop-i386.iso
- ubuntu-12.10-desktop-amd64.iso
- ubuntu-13.04-desktop-amd64.iso
This solution skips the CD-ROM's boot menu. I haven't found a better
one.
Unix is an IDE. I do my
development (Python web apps mostly) with Vim
with a bunch of custom plugins, shell
(in GNOME Terminal: tabs rule!), GNU make, ctags, find + grep,
svn/bzr/hg/git.
The current working directory is my project configuration/state. I run
tests here (bin/test), I search for code here (vim -t TagName, find + grep), I
run applications here (make run or bin/appname). I can multitask
freely, for example, if I'm in the middle of typing an SVN commit message, I
can hit Ctrl+Shift+T, get a new terminal tab in the same working directory, and
look something up. No aliases/environment variables/symlinks. I can work on multiple projects at the
same time. I can work remotely (over ssh).
Gary Bernhardt's screencasts on
Vimeo show how productive you can get if you learn Vim and tailor it
to your needs. I have Vim scripts that let me
-
See the name of the class and function that I'm editing in the statusbar,
even if the class/function definition is offscreen:
pythonhelper.vim.
-
See all pyflakes warnings and errors in a list as soon as I press F2 to
save the file: python_check_syntax.vim.
-
Add a "from foo.bar import Something" line at the top of the file if I
press F5 when my cursor is on Something, looking up the package and module
from ctags: python-imports.vim.
-
Switch between production code and unit tests with a single key if the
project uses one of several conventions for tests (e.g. ./foo.py
<-> ./tests/test_foo.py):
py-test-switcher.vim.
-
Generate a command line for running one particular unit test (the one
my cursor is inside) and copy it into the system clipboard, so I can
run that test by Alt-Tabbing into my terminal window and pasting.
py-test-runner.vim.
-
Open the right file and move the cursor to the right line if I
triple-click a line of traceback in a shell (or an email) then press F7 in
my gvim window:
py-test-locator.vim.
-
Compare my version of the code with the pristine version in source control
in an interactive side-by-side diff that lets me revert bits I no longer
want:
vcscommand.vim.
-
Highlight which lines of the source are covered by my tests, if I have
coverage information in trace.py format:
py-coverage-highlight.vim.
-
Show the signature of a function/class's __init__ when I type the name
of that class/function and an open parenthesis (looked up from tags):
py-function-signature.vim.
-
Fold code into an outline so I only see names of methods or classes
instead of their full bodies:
vimrc, function PythonFoldLevel.
-
Fold diff files so I can see whole hunks/files and can delete those with
a single key (well, two keys -- dd). Useful for reviewing large
diffs (tens of thousands of lines):
vimrc, function DiffFoldLevel.
Some of these come from www.vim.org, some
I've written myself, some I've taken and modified a little bit to avoid an
irritating quirk or add a missing feature. Some things I don't have (and envy
Emacs or IDE users for having -- like an integrated debugger for Python apps,
and, generally, integration with other tools, running in the background).
It's been my plan for a long time to polish my plugins, release them
somewhere (github? bitbucket? launchpad?) and upload to vim.org, but as it
doesn't seem to be happening, I thought I'd at least put an svn
export of my ~/.vim on the web.
I booked a stay at a particular hotel because the web page said "Free WiFi".
It didn't say "all outgoing ports firewalled except for port 80 and a few
other (useless) ones". Not having SSH access is most painful. Luckily,
there's a solution.
You need a web server running Apache and SSH. Enable mod_proxy and
mod_proxy_connect and add this to the first (i.e. default) virtual
host configuration:
<VirtualHost whatever:80>
...
# allow ssh to localhost over http proxy
ProxyRequests on
AllowCONNECT 22
<Proxy localhost>
Order allow,deny
Allow from all
</Proxy>
</VirtualHost>
Reload Apache configuration. The setup is done. (Instructions based on
Tunneling SSH over
HTTP(S) by Dag Wieers.)
On the client side you need proxytunnel. Sadly, it's not
packaged for Ubuntu yet, but compiling from sources is trivial. Edit ~/.ssh/config
and add an entry for your proxied ssh connection:
Host pmyservername
ProxyCommand proxytunnel -q -p myserver.mydomain.com:80 -d localhost:22
That's it. Now you can ssh pmyservername. (The p prefix
is a reminder that I'm using a proxied connection: ssh fridge versus ssh
pfridge. Also it reminds me of Terry Pratchett's Pyramids.).
For extra fun (e.g. IRC) use ssh's built-in SOCKS5 proxy: ssh -D 1080
pmyservername. Then tell the apps to use a SOCKS5 proxy on
localhost. Since telling each app to use a proxy (and then, later, telling it
to stop using it) is a big *pain*, and some apps (e.g. ssh) don't support
proxies directly, a wrapper like tsocks is handy. Edit
/etc/tsocks.conf and set the default socks server to 127.0.0.1, then use
it to run apps:
$ tsocks xchat-gnome
$ tsocks bzr push lp:myprojectname
tsocks is packaged for Ubuntu.
If your hotel doesn't have free WiFi, a prepaid SIM card with 3G access
could be cheaper than roaming charges. Apparently you can get one with a
virtually unlimited (for a short stay, anyway) data plan for 27 EUR in
Amsterdam.