1

I can easily make a bootable flash drive for installing Debian by doing this:

dd if=debian-7.8.0-amd64-CD-1.iso of=/dev/sdg bs=4M; sync

but then it makes the flash drive read-only. I'd like to customize things, but how?

Frotz
  • 131
  • 5
  • This is really outside the scope of professional system administration. It MIGHT be appropriate on [unix.SE], but I won't migrate it there as it currently stands (for no other reason than you can answer it with a Google search for "Debian live USB with persistence" and get [many tutorials](https://www.linux.com/community/blogs/133-general-linux/420179-creating-a-debian-live-usb-flash-drive-with-persistence-for-non-techies)). – voretaq7 Mar 19 '15 at 18:11

1 Answers1

1

Having the install media writable enables a lot flexibility and time-savings. A plain install of Debian rarely has exactly what you want already installed. With a preseed file, you can make choices ahead of time as to how you want the system set up and what packages you want installed. A full discussion of this is at http://www.debian.org/releases/stable/amd64/apb.html.en. A writable flash drive installer is also handy for files that you may want immediately and before networking is available. These can include seperately-packaged network drivers (typically laptops), configuration files, wallpaper, source code, or keys. Be careful if you choose to include keys.

Here we go...

  • Install syslinux
  • Insert the flash drive and find the device using dmesg (assumed to be at /dev/sdg below)
  • Create a FAT partition and mark it bootable (assumed at /dev/sdg1 below)
  • Mount the FAT partition and put the following files on it:
  • Unmount the FAT partition if it was mounted (umount /dev/sdg1)
  • Run syslinux /dev/sdg1 as root

To automate the installation, the preseed.cfg file should go into the root of the flash drive. You can then change the syslinux.cfg file to:

default vmlinuz append 
initrd=initrd.gz auto file=/hd-media/preseed.cfg locale=en_US 
console-keymaps-at/keymap=us

You now have a bootable flash drive that you can also easily modify. You won't need to re-run syslinux unless you change vmlinuz or initrd.gz. This really isn't necessary unless you switch to a different release.

To get you started on preseeding, here is my preseed.cfg file:

d-i clock-setup/utc boolean true
d-i time/zone string US/Pacific
d-i clock-setup/ntp boolean true
d-i passwd/user-default-groups string cdrom floppy sudo audio dip \
    video plugdev netdev scanner bluetooth fuse vboxusers
d-i partman/mount_style select traditional
d-i mirror/country string US
d-i mirror/http/hostname string http.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i popularity-contest/participate boolean false
d-i apt-setup/backports boolean true
d-i apt-setup/use_mirror boolean true
d-i pkgsel/include string alsa-base alsa-utils alsa-oss oss-compat \
    sudo wicd-curses wicd-cli units cups-bsd curl \
    irssi mate-desktop-environment-extras/wheezy-backports \
    build-essential debhelper dpkg-dev g++ automake autoconf \
    libncurses5-dev libtool intltool-debian libdpkg-perl \
    wicd-gtk xterm xfonts-terminus openjdk-7-jdk xinit lightdm \
    iceweasel flashplugin-nonfree mozplugger \
    xul-ext-ablock-plus xul-ext-flashblock \
    xul-ext-useragentswitcher \
    texlive-latex-extra texlive-extra-utils \
    texlive-fonts-recommended texlive-fonts-extra \
    psutils pdfjam \
    xclip gcolor2 geeqie xsane mikmod xmp gnucash \
    git gitk

Please note that some old BIOSes might not happily boot USB drives created in this way.

This article is based on one that is no longer available.

Frotz
  • 131
  • 5