Bug#567468: please set hostname via sysctl early on

2010-01-29 Thread martin f krafft
Package: initramfs-tools
Version: 0.93.4
Severity: wishlist

mdadm in incremental mode needs the hostname to be able to work
without a configuration file, which would make RAID-boot much more
robust. Instead of mdadm touching
/proc/sys/kernel/{host,domain}name, it feels like initramfs should
do that.

The attached scripts take care of it. hostname is the hook, and
00hostname the script for init-top. It might make more sense to put
this into local-top though, I don't really know how it interacts
with netboot.

-- 
 .''`.   martin f. krafft madd...@d.o  Related projects:
: :'  :  proud Debian developer   http://debiansystem.info
`. `'`   http://people.debian.org/~madduckhttp://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
#!/bin/sh
#
# initramfs script to inform the kernel about the hostname early on
#
# Copyright © 2010 martin f. krafft madd...@debian.org
# Released under the terms of the Artistic Licence 2.0
#
set -eu

case ${1:-} in prereqs) exit 0;; esac

if [ -s /conf/hostname ]; then
  . /scripts/functions

  HOSTNAME=$(cat /conf/hostname)
  log_begin_msg Setting hostname to $HOSTNAME

  case $HOSTNAME in
*.*)
  echo ${HOSTNAME#*.} /proc/sys/kernel/domainname
  HOSTNAME=${HOSTNAME%%.*}
  ;;
  esac
  echo $HOSTNAME /proc/sys/kernel/hostname

  log_end_msg
fi

exit
#!/bin/sh
#
# initramfs hook to store the hostname in the initrd
#
# Copyright © 2010 martin f. krafft madd...@debian.org
# Released under the terms of the Artistic Licence 2.0
#
set -eu

exec hostname --fqdn  $DESTDIR/conf/hostname


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)


Bug#567468: please set hostname via sysctl early on

2010-01-29 Thread Marco d'Itri
On Jan 29, martin f krafft madd...@debian.org wrote:

 mdadm in incremental mode needs the hostname to be able to work
 without a configuration file, which would make RAID-boot much more
 robust. Instead of mdadm touching
 /proc/sys/kernel/{host,domain}name, it feels like initramfs should
 do that.
What happens if the hostname is changed but the initramfs is not
rebuilt?


-- 
ciao,
Marco


signature.asc
Description: Digital signature


Bug#567468: please set hostname via sysctl early on

2010-01-29 Thread martin f krafft
also sprach Marco d'Itri m...@linux.it [2010.01.30.0233 +1300]:
  mdadm in incremental mode needs the hostname to be able to work
  without a configuration file, which would make RAID-boot much
  more robust. Instead of mdadm touching
  /proc/sys/kernel/{host,domain}name, it feels like initramfs
  should do that.
 What happens if the hostname is changed but the initramfs is not
 rebuilt?

How likely is that to happen? How likely is it to happen that the
hostname is changed, an array built (thus carrying the new
hostname), and the initramfs not rebuilt?

Yes, I see these problems, but I don't think they are so real that
they warrant guarding against them.

-- 
 .''`.   martin f. krafft madd...@d.o  Related projects:
: :'  :  proud Debian developer   http://debiansystem.info
`. `'`   http://people.debian.org/~madduckhttp://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
syntactic sugar causes cancer of the semicolon.
-- epigrams in programming


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)


Bug#567468: please set hostname via sysctl early on

2010-01-29 Thread Marco d'Itri
On Jan 29, martin f krafft madd...@debian.org wrote:

  What happens if the hostname is changed but the initramfs is not
  rebuilt?
 How likely is that to happen? How likely is it to happen that the
 hostname is changed, an array built (thus carrying the new
 hostname), and the initramfs not rebuilt?
It looks likely to me when building a new system.

-- 
ciao,
Marco


signature.asc
Description: Digital signature


Bug#567468: please set hostname via sysctl early on

2010-01-29 Thread martin f krafft
also sprach Marco d'Itri m...@linux.it [2010.01.30.0839 +1300]:
   What happens if the hostname is changed but the initramfs is not
   rebuilt?
  How likely is that to happen? How likely is it to happen that the
  hostname is changed, an array built (thus carrying the new
  hostname), and the initramfs not rebuilt?
 It looks likely to me when building a new system.

Right, but if you muck around with the system at this level,
I assume you can recover the system if it fails to bring up the RAID
by itself using the initramfs console.

Anyway, I don't really see a way to guard against the problems, nor
a way to solve it otherwise, short of running update-initramfs from
the hostname binary or grub trying to read /etc/hostname and passing
it via kernel command line. I guess I could try this, but it sounds
fragile and hard.

-- 
 .''`.   martin f. krafft madd...@d.o  Related projects:
: :'  :  proud Debian developer   http://debiansystem.info
`. `'`   http://people.debian.org/~madduckhttp://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
i wish i hadn't slept all day, it's really lowered my productivity
   -- robert mcqueen


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)