Author

Christopher Marshall (christopherlmarshall@yahoo.com)

Raw Notes on Using Kernel 2.6 in Slackware

# using kernel 2.6.7 with slackware-10.0
# The packages you need to install are located in the testing tree:
slackware-10.0/testing/packages/
   linux-2.6.7
      alsa-driver.tgz
      kernel-generic-2.6.7.tgz
      kernel-headers-2.6.7.tgz
      kernel-modules-2.6.7.tgz
      kernel-source-2.6.7.tgz
      README.initrd
   lvm2
      device-mapper.tgz
      lvm2.tgz
   gcc-3.4.0
# after installing lvm2, you should 

# the README.initrd talks about how kernel-generic doesn't have filesystem 
# drivers compiled in.  You need to run mkinitrd to create initrd.gz
# to load whatever driver modules you need to boot your root partition.
# If all you needed were resierfs, you could do this:
mkinitrd -c -k 2.6.7 -m reiserfs
# if you needed reiserfs and dm_mod (device mapper) to get to a lvm2 partition,
# you could do that like this
mkinitrd -c -k 2.6.7 -m dm-mod:reiserfs
# mkinitrd first creates a directory initrd-tree with everything in it needed 
# to load modules, and the modules themselves.  Then it captures the filesystem
# and gzips it into initrd.gz.  If you needed to edit initrd-tree by hand, you
# could do so and run mkinitrd again to capture the changes in initrd.gz.

# here is the lilo.conf stanza you would use to boot into 2.6.7 using a normal 
# disk partition
image = /boot/vmlinuz-generic-2.6.7
  root = /dev/hda8
  initrd = /boot/initrd-2.6.7.gz
  label = root-2-6
  read-only

# and here is the lilo.conf stanza you would use to boot into 2.6.7 using 
# an lvm partition
# This should work but doesn't for me yet.
# I get a Kernel Panic on boot
image = /boot/vmlinuz-generic-2.6.7
  root = /dev/vg01/lv_root2
  initrd = /boot/initrd-2.6.7.gz
  label = lv_root2
  read-only

# to prepare such a lvm partition, you would do so when booted under /dev/hda8
# something like this:
mount -t proc none /usr/root2/proc
mount -t svsfs none /usr/root2/sys
chroot /usr/root2 ldconfig
chroot /usr/root2
depmod
devmap_mknod.sh
vgscan
# I had to copy devmap_mknod.sh from the source package for device mapper.  Patrick V
# didn't think it was needed for some reason.  It's only purpose seems to be to 
# create the device node /dev/mapper/control.

# The boot messages show this when I try to boot root2
VFS: Cannot open root device "fe01" or unknown-block(254,1)
please append a correct "root=" boot option
Kernel panic: VFS Unable to mount root fs on unknown-block(254,1)
# I'll bet that's because the initrd doesn't have /dev/mapper/control available!
# I'll be crushed if it doesn't work!
# O.K., it didn't work.
# I learned a little about how the initrd-tree is laid out, however.

# the next thing I could do is recreate the /dev/vg01 and /dev/mapper entries in the initrd.
# I did this, then noticed that linuxrc tries to run vgchange and vgscan if they exist.
# which they don't.
# so I copied lvm, two of the links it needed, to /sbin, and I copied libc and libdevmapper
# to /lib.  I was able to verify that lvm worked by doing a "chroot . lvm"
# I almost got it to work on this try!
# One of the slackware startup scripts, though, objected to the root partition being mounted
# read-only.  I am not sure what went wrong, but it rebooted.  I guess I must have made it to
# lv_root2, though, to have gotten that message!  So I must almost be there.
# *** another thing to try would be to insert a call to /bin/sh to linuxrc so I could see if
# vgscan worked.
#
# A wierd symptom, though.  Once I rebooted into /dev/hda8, I couldn't access any of the 
# /dev/vg01 devices!  I'll bet that was because I was using my new initrd for /dev/hda8 as
# well as for lv_root2 in lilo.conf, and the vgscan was only updating the device nodes in the
# ramdisk and not the switched root.  I wonder how that could be?
#
# *** I should use a different initrd for experimenting with lv_root2, and use the standard one
# for /dev/hda8 to keep this from happening again.

# I wonder if the problem I am hitting is that the VG's and LV's I am using have
# LVM1 and not LVM2 metadata?
# How did LVM1 handle it, BTW?  It must have put it in the initrd.  Perhaps if I looked at an
# LVM1 initrd, I could figure it out.

# In any event, if I upgraded my metadata from LVM1 to LVM2, perhaps it would work.
# *** I could even try that by creating an lvm2 vg vg02, alongside vg01.

# udev, ramfs, /dev, and part of the above mystery solved.
# cat /proc/mounts reveals:
rootfs / rootfs rw 0 0
/dev/root / reiserfs rw 0 0
proc /proc proc rw,nodiratime 0 0
sysfs /sys sysfs rw 0 0
none /dev ramfs rw 0 0
none /dev/pts devpts rw 0 0
/dev/hda7 /usr/root1 reiserfs rw 0 0
/dev/hda1 /boot ext2 rw 0 0
/dev/hda6 /mnt/drive2 reiserfs rw 0 0
/dev/vg00/lv_drive2 /usr/drive2 reiserfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/vg00/lv_drive2 /home reiserfs rw 0 0
/dev/root /usr/root2 reiserfs rw 0 0
/dev/hda8 /mnt/hd reiserfs rw 0 0
# notice that ramfs is mounted over /dev
# this seems to be part of the sysfs system in 2.6.7
# this explains why I couldn't access the /dev/mapper/ entries 
# from a LVM root partition, and why the /dev present inside the initrd
# seemed to be buried after the pivot_root step.  I'll bet if I had enabled or prevented
# this from happening in the initrd or after the pivot_root, it would cure it.
#
# this script
/etc/rc.d/rc.udev
# is the one that is doing, in effect, "mount -t ramfs none /dev" after the pivot root step.
# This mounting over /dev didn't show up when I typed "mount" but it did show up in 
# /proc/mounts.
#
# How to set links like /dev/cdrom -> /dev/hdd in the presence of udev?  Or widen device permissions, like /dev/snd/pcm*?
# the cleanest solution that occurs to me is to add commands to rc.local.

# problems I've noticed:
# -  when I have a mountable DVD in /dev/hdd at chrism1, the boot process hangs at the cdrom check.

# 2005-09-27
#the mkinitrd I am using now should be this:
mkinitrd -c -k 2.6.10 -m reiserfs
#and not this:
mkinitrd -c -k 2.6.10 -m reiserfs:dm-mod
# or, as a result of the above issues (mostly the original dev 
# being buried after the pivot root step), lvm won't work properly at all.  leaving the dm-mod
# module out of the initrd at least let's you mount non-root volumes.

# 2005-11-20
# compiling steps:
make oldconfig (or make xconfig)
make (this creates the compressed image at 
make modules_install
arch/i386/boot/bzImage

# 2.6.10 bug
# slackware-10.1's 2.6.10 config is set this way:
CONFIG_BLK_DEV_UB=m
# which effectively stops the usb-storage driver from working
# the fix is to disable it like this
   #CONFIG_BLK_DEV_UB is not set
# in other words, by commenting it out.
# it goes by the name "low performance usb block driver" if you go through
# "make xconfig" under block drivers.

hopeless_linux: RawNotes/kernel 2 6 slackware (last modified 2007-07-01 16:01:00)