#!/bin/bash # Author: Interbird, interbird1964 at gmail.com # Version: 20071107 #3 # DISCLAIMER: ## If this script kills your cat then *you and only you* are responsible for that. ## ## In no way am I responsible for any damage caused by this script. ## # WARNING: ## Before you run this script, do a cp -a /boot /boot.backup as root. ## # WARNING: ## Be sure to have at least 30MB free in /boot. ## # This script tries to fix the quirk that seems to be in the gutsy initramfs code. # It does this by modifying the initrd.img image. # Make sure you have at least 30MB of free space in /boot. # Note that this hack is not a proper solution. # Make sure long lines are not wrapped when you paste this script in your editor. # This script uses sed. # USAGE: Put this script anywhere you want. # Make it executable with: chmod +x fix-gutsy-initramfs # Then run: sudo ./fix-gutsy-initramfs # After the script is done, make sure the new initrd.img is present in the /boot directory. # Reboot your computer. # Kernel log-lines should now appear after a few seconds. # If you put fbcon and vesafb in /etc/modules you can remove them because they are now loaded in the initrd image. # I hope this script works for you. # If you have trouble using it you can mail me at the above address. # We need sed, so lets make sure it is installed. apt-get install sed # Enter the directory where the initrd image resides. pushd /boot # Get the version of the running kernel. kv="$(uname -r)" # Compose the filename of the initrd image. initrd_img="initrd.img-$kv" # This is the name of the temporary directory we use to extract the initrd image. tmpdir="tmp-initrd" # The framebuffer driver we want loaded. # This driver should work on any vesa 2.0 compliant videocard. fbdriver="vesafb" # First we make a backup of the current initrd image. cp -a $initrd_img $initrd_img.backup # Remove the temporary directory if it exists so this script can be run from scratch more than once. rm -rf $tmpdir # Create the temprary directory mkdir -p $tmpdir # Unzip the current initrd image to the temporary directory. gzip -cd $initrd_img > $tmpdir/$initrd_img # Enter the temporary directory. pushd $tmpdir # Unpack the initrd image. cpio -i < $initrd_img # Remove the unpacked initrd image to prevent it from being included in the new initrd image. rm $initrd_img # Enter the directory where the blacklist files are. pushd etc/modprobe.d # Make a backup. cp -a blacklist-framebuffer blacklist-framebuffer.backup # Unblacklist the framebuffer module. cat blacklist-framebuffer.backup | sed -e 's/^.*blacklist '$fbdriver'/#blacklist '$fbdriver'/' > blacklist-framebuffer # Back to temporary directory. popd # Now one would think that this would be enough but it seems it still does not load. # So, we change a script too to make the modules load unconditionally. # Enter boot-scripts directory. pushd scripts/init-top # We don't want duplicate lines, so remove them if they are present present. cat framebuffer | sed -e '/modprobe fbcon/d;/modprobe '$fbdriver'/d' > framebuffer.tmp # Now add the modules to the end of the script so they will be loaded unconditionally. echo "modprobe fbcon" >> framebuffer.tmp echo "modprobe $fbdriver" >> framebuffer.tmp # Rename the script to its original name. mv -f framebuffer.tmp framebuffer # Make it executable again. chmod +x framebuffer # Back to temporary directory. popd # Now create a new initrd image and put it in the parent directory which is /boot. # This overwrites the bad one. find . | cpio -V -H newc -o | gzip -9 > ../$initrd_img # Back to /boot directory popd # Cleanup the temporary directory. rm -rf $tmpdir # Back to wherever this scripts was called from. popd