The Gate/setup

From Hackerspace Brussels
Jump to: navigation, search

This is old and mostly outdated. This page is left for historical reasons and it's accuracy still need to be verified[edit]

A warning note about compact flash cards[edit]

Compared to a regular hard disk, compact flash cards have a very unusual geometry. A hard disk has 63 sectors per track, and leave a 62 sectors gap between the partition table and the first partition. For a 512 bytes sector size (the norm), this is about 31 KiB of "unusable" space on the disk. Since that space is normally unused, grub install by default it's core image in that gap area that is called the embedding space.

Since the compact flash card installed in The Gate report 16 sectors per track, this leave a gap of 15 sectors of 512 bytes, which means 7 KiB of the same "unusable" space. Grub cannot install it's core image in that space and complain about it during boot loader (re)installation, telling you that you should use block list to make it usable. During package installation/update/upgrade, grub will silently fail and leave your machine in an unbootable state.

To avoid the shortage of that useful "unusable" space, here is how you should partition the flash card:

  • Delete all partitions
  • Create a new partition of size between 31 KiB and 1 MiB
  • Create the partition containing your root filesystem
  • Create other partitions as needed
  • DELETE the first partition (this is the crutial step)
  • Format all partitions and proceed as desired.
  • (re)install grub as usual

A cleaner alternative would involve creating partitions in GPT format, but the gdisk tool is not packaged in Debian "Squeeze".


Root filesystem[edit]

Flashcard rootfs has been built with debootstrap (need to be updated: not current anymore)

debootstrap --include=openvpn,ssh,mc,aiccu,radvd,dmidecode,wireless-tools,bzip2,less,ddclient,etherwake,linux-image-686,whois,rsync,ppp,pppoeconf,arp-scan,sudo,screen,sed,nmap,lm-sensors,bridge-utils,acpi,firmware-linux-free,pciutils,grub,console-setup,quagga,acpid,hostapd,deborphan,telnet,lsof,libapache-gallery-perl,ntpdate,cron-apt,mpd,alsa-utils,ncmpc,mpc,cryptsetup,cryptmount,pwgen,tcpdump,dma,rkhunter,rssh,sipcalc,genisoimage,wide-dhcpv6-server,bind9,tftpd-hpa squeeze /mnt/usb

/etc/fstab:

/dev/sda1       /               auto            noatime,errors=remount-ro       1       1
proc            /proc           proc            defaults                        0       0
/tmp            /tmp            tmpfs           nosuid,nodev                    0       0
/var/tmp        /var/tmp        tmpfs           nosuid,noexec,nodev             0       0
# list cache. Rebuild it with apt-get update
aptlist		/var/lib/apt/lists	tmpfs	noexec,nosuid,nodev		0	0
# This is the apt cache. Must be cleaned once in a while with apt-get clean
aptcache	/var/cache/apt	tmpfs   	noexec,nosuid,nodev		0	0
# The documentation is somewhere else. Save space. :-)
usrsharedoc	/usr/share/doc	tmpfs	        noexec,nosuid,nodev		0	0
# The manpages are elsewhere
usrshareman	/usr/share/man	tmpfs   	noexec,nosuid,nodev		0	0



/dev/mapper/cswap       none            swap            sw                              0       0
/dev/mapper/srv       /srv            auto            nosuid,nodev,noexec               1       2

/etc/default/grub: An extra option must be added to the kernel command line to make sure the kernel can access the compactflash cards on the IDE bus. This option disable DMA for compactflash while leaving it on for IDE CD-ROM and IDE harddisks

GRUB_CMDLINE_LINUX_DEFAULT="libata.dma=3"

Rebuild grub config with update-grub