Bug#594052: debootstrap: create example /etc/hosts and /etc/fstab?
Package: debootstrap
Version: 1.0.23
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch maverick
In https://bugs.launchpad.net/ubuntu/+source/debootstrap/+bug/110144,
Evan Klitzke (CCed) suggested that debootstrap could be improved to
create a few more skeleton system configuration files by default. I
didn't agree with all his points (see the Ubuntu bug for details), but
it does seem that creating skeleton /etc/hosts and /etc/fstab would be
beneficial - I've verified that this won't break netcfg or
partman-target respectively.
The essence of Evan's patch was (I've removed a bit about
/etc/network/interfaces since I feel that's better handled elsewhere,
and apologies that this is actually against the current Ubuntu script
but I'm sure the intent will be clear):
Index: scripts/gutsy
===================================================================
--- scripts/gutsy (revision 64498)
+++ scripts/gutsy (working copy)
@@ -53,10 +53,45 @@
setup_etc
if [ ! -e "$TARGET/etc/fstab" ]; then
- echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
+ echo '# /etc/fstab: static file system information.' > $TARGET/etc/fstab
+ echo '#' >> $TARGET/etc/fstab
+ echo '# file system mount point type options dump pass' >> $TARGET/etc/fstab
+ echo 'proc /proc proc defaults 0 0' >> $TARGET/etc/fstab
+ echo 'sys /sys sysfs defaults 0 0' >> $TARGET/etc/fstab
+ echo '' >> $TARGET/etc/fstab
+ echo '# Here are some example entries; uncomment these lines and add the correct' >> $TARGET/etc/fstab
+ echo '# device name. Note that the recommended way to mount partitions is now by UUID' >> $TARGET/etc/fstab
+ echo '# rather than device name; see https://wiki.ubuntu.com/LibAtaForAtaDisks for' >> $TARGET/etc/fstab
+ echo '# details. You can find out the UUIDs of your partitions by running blkid.' >> $TARGET/etc/fstab
+ echo '' >> $TARGET/etc/fstab
+ echo '#/dev/fd0 /mnt/floppy auto noauto,rw,sync,user,exec 0 0' >> $TARGET/etc/fstab
+ echo '#/dev/cdrom /mnt/cdrom iso9660 noauto,ro,user,exec 0 0' >> $TARGET/etc/fstab
+ echo '#' >> $TARGET/etc/fstab
+ echo '#/dev/XXX none swap sw 0 0' >> $TARGET/etc/fstab
+ echo '#' >> $TARGET/etc/fstab
+ echo '#/dev/XXX / ext3 defaults 0 1' >> $TARGET/etc/fstab
+ echo '#/dev/XXX /boot ext3 ro,nosuid,nodev 0 2' >> $TARGET/etc/fstab
+ echo '#UUID=XXX /home ext3 rw,nosuid,nodev 0 2' >> $TARGET/etc/fstab
+ echo '#UUID=XXX /tmp ext3 rw,nosuid,nodev 0 2' >> $TARGET/etc/fstab
+ echo '#UUID=XXX /var ext3 rw,nosuid,nodev 0 2' >> $TARGET/etc/fstab
+ echo '#UUID=XXX /usr ext3 rw,nodev 0 2' >> $TARGET/etc/fstab
+ echo '#UUID=XXX /home ext3 rw,nosuid,nodev 0 2' >> $TARGET/etc/fstab
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
+ if [ ! -e "$TARGET/etc/hosts" ]; then
+ echo '127.0.0.1 localhost' > "$TARGET/etc/hosts"
+ echo '' >> "$TARGET/etc/hosts"
+ echo '# The following lines are desirable for IPv6 capable hosts' >> "$TARGET/etc/hosts"
+ echo '::1 ip6-localhost ip6-loopback' >> "$TARGET/etc/hosts"
+ echo 'fe00::0 ip6-localnet' >> "$TARGET/etc/hosts"
+ echo 'ff00::0 ip6-mcastprefix' >> "$TARGET/etc/hosts"
+ echo 'ff02::1 ip6-allnodes' >> "$TARGET/etc/hosts"
+ echo 'ff02::2 ip6-allrouters' >> "$TARGET/etc/hosts"
+ echo 'ff02::3 ip6-allhosts' >> "$TARGET/etc/hosts"
+ chown 0:0 "$TARGET/etc/hosts"; chmod 644 "$TARGET/etc/hosts"
+ fi
+
if doing_variant fakechroot; then
setup_devices_fakechroot
else
I think the proposed /etc/hosts is probably fine, modulo verification
that it's bitwise-identical with netcfg's default. Regarding
/etc/fstab, I think we should be a bit less verbose than that and more
generic rather than referring to the Ubuntu wiki, and we should make
sure everything is synced up with partman-target. I'm also not sure
about removing "UNCONFIGURED FSTAB FOR BASE SYSTEM" - I remember that
that used to be a token that some software checked for, and, while that
doesn't seem to be the case in d-i any more, I'd be cautious about
removing it all the same.
Does anyone have any thoughts on this?
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
Reply to: