Comment 26 for bug 133072

Revision history for this message
Valery Frolov (fvgenn) wrote :

My 5 cents.
I guess the problem is in the console-setup package. i was digging in initramfs scripts. hope this may help.
Changes below working well for me (15.10, i386).
Look at the "#check" marks for comments (excuse me for my badly broken English ;-):

1. /usr/share/initramfs-tools/hooks/console_setup
====================================================================cut here
#! /bin/sh -e

PREREQ="kbd|console_tools"

prereqs () {
 echo "$PREREQ"
}

case $1 in
prereqs)
 prereqs
 exit 0
 ;;
esac

. /usr/share/initramfs-tools/hook-functions
[ -r /etc/default/keyboard ] || exit 0
[ -r /etc/default/console-setup ] || exit 0
. /etc/default/console-setup # also sources /etc/default/keyboard

# Copy console-setup configuration
mkdir -p "$DESTDIR/etc/default"
cp -p /etc/default/keyboard "$DESTDIR/etc/default"
cp -p /etc/default/console-setup "$DESTDIR/etc/default"

#check: because of naming convention: "8xNN" -> "NN"
FONTSIZE=${FONTSIZE#8x}
# Assume setupcon --save has been run
if [ -f "$FONT" ]; then
 FONT="/etc/console-setup/${FONT##*/}"
#check: .gz is a valid suffix
#check# FONT="${FONT%.gz}"
else
 FONT="/etc/console-setup/$CODESET-$FONTFACE$FONTSIZE.psf"
#check: font is always gzipped, so it's better to add ".gz" suffix
 [ -f "${FONT}.gz" ] && FONT="${FONT}.gz"
fi
if [ -f "$FONT" ]; then
 mkdir -p "$DESTDIR${FONT%/*}"
 cp -p "$FONT" "$DESTDIR$FONT"
fi
if [ -f "$ACM" ]; then
 ACM="/etc/console-setup/${ACM##*/}"
 ACM="${ACM%.gz}"
else
 ACM="/etc/console-setup/$CHARMAP.acm"
fi
if [ -f "$ACM" ]; then
 mkdir -p "$DESTDIR${ACM%/*}"
 cp -p "$ACM" "$DESTDIR$ACM"
fi
if [ -f /etc/console-setup/cached.kmap.gz ]; then
 mkdir -p "$DESTDIR/etc/console-setup"
 cp -p /etc/console-setup/cached.kmap.gz \
  "$DESTDIR/etc/console-setup/cached.kmap.gz"
fi

exit 0
====================================================================cut here

2. /usr/share/initramfs-tools/scripts/init-top/console_setup
====================================================================cut here
#! /bin/sh
# A crude much-simplified clone of setupcon for use in the initramfs.

#check: no FRAMEBUFFER needed
#check# OPTION=FRAMEBUFFER
#check# PREREQ="framebuffer"

PREREQ=""

prereqs () {
 echo "$PREREQ"
}

case $1 in
prereqs)
 prereqs
 exit 0
 ;;
esac

[ -r /etc/default/console-setup ] || exit 0
. /etc/default/console-setup

[ "$ACTIVE_CONSOLES" ] || exit 0

if [ "$VERBOSE_OUTPUT" = yes ]; then
 verbose=
else
 verbose='>/dev/null 2>&1'
fi

for i in 1 2 3 4 5 6; do
 [ -c /dev/tty$i ] || mknod /dev/tty$i c 4 $i
done

#check: because of font naming convention: "...8xNN" -> "...NN"
FONTSIZE=${FONTSIZE#8x}
#check: Define font name only once, not every cycle, also it gives proper font name for /dev/tty1
if [ "$FONT" ]; then
 FONT="/etc/console-setup/${FONT##*/}"
#check: .gz is a valid suffix
#check# FONT="${FONT%.gz}"
else
 FONT="/etc/console-setup/$CODESET-$FONTFACE$FONTSIZE.psf"
#check: try to find gzipped font
 [ -f "${FONT}.gz" ] && FONT="${FONT}.gz"
fi

for console in $ACTIVE_CONSOLES; do
 [ -w $console ] || continue

 if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM$CHARMAP" ]; then
  printf '\033%%G' >$console
 else
  printf '\033%%@' >$console
 fi

 if [ -f "$FONT" ]; then
  if type consolechars >/dev/null 2>&1; then
   eval consolechars -v --tty=$console -f "$FONT" $verbose
  elif type setfont >/dev/null 2>&1; then
   eval setfont -v -C $console "$FONT" $verbose
  fi
 fi

 if [ "$ACM" ]; then
  ACM="/etc/console-setup/${ACM##*/}"
  ACM="${ACM%.gz}"
 else
  ACM="/etc/console-setup/$CHARMAP.acm"
 fi
 if [ -f "$ACM" ]; then
  if type consolechars >/dev/null 2>&1; then
   eval consolechars -v --tty=$console --acm "$ACM" \
    $verbose
  elif type setfont >/dev/null 2>&1; then
   eval setfont -v -C "$console" -m "$ACM" $verbose
  fi
 fi

 if type kbd_mode >/dev/null 2>&1; then
  if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM" ]; then
   kbd_mode -u <$console
  else
   kbd_mode -a <$console
  fi
 fi
done

if [ -f /etc/console-setup/cached.kmap.gz ] && type loadkeys >/dev/null; then
 eval loadkeys /etc/console-setup/cached.kmap.gz $verbose
fi

exit 0
====================================================================cut here

3. /usr/share/initramfs-tools/scripts/init-top/keymap
====================================================================cut here
#!/bin/sh

#check:
#check# OPTION=FRAMEBUFFER
PREREQ=""
prereqs()
{
 echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
 prereqs
 exit 0
 ;;
esac

OPTS="-q"

# Should terminal be in UTF8 mode?
if [ -x /bin/kbd_mode ]; then
 /bin/kbd_mode -u
 OPTS="${OPTS} -u"
fi

# Load custom keymap
if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then
 loadkeys ${OPTS} /etc/boottime.kmap.gz
fi
====================================================================cut here

4. /usr/share/initramfs-tools/scripts/panic/console_setup
same as [2]

5. /home/vfrolov/rebuild-initrd/initrd/scripts/panic/keymap
same as [3]

6. Configure and save

sudo dpkg-reconfigure console-setup #choose font and keyboard map
sudo setupcon --save-only #save settings to /etc/default/console-setup
sudo update-initramfs -u #that's it

Thank you for the very best OS i'm using and really enjoying with!!!