LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-24-2008, 07:57 AM   #46
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159

Hi,

What is the internal hdd type? What is the hardware specifications?
 
Old 11-24-2008, 03:39 PM   #47
uppman
Member
 
Registered: Jul 2008
Location: Stockholm, Sweden
Distribution: Slackware 13.1 32-bit
Posts: 145

Rep: Reputation: 24
Is the USB drive booting with a Zenwalk kernel? That might be the problem if so.

If I'm correct the Zenwalk kernel comes with "ATA/ATAPI/MFM/RLL support" disabled, and uses the SATA subsystem for both PATA and SATA drives. The result is that all drives end up as /dev/sdX where X=a,b,c,d etc.
I remember thinking of this as a neat feature, but also remember some strange behaviours similar to the ones described by you.

Do you see any printouts when it gets stuck in the loop?

There is a presumably working .config in my wiki that you could try if everything else fails..

Last edited by uppman; 11-25-2008 at 01:45 AM. Reason: Typo, sdaX should be sdX
 
Old 11-25-2008, 04:37 AM   #48
The MoD
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Rep: Reputation: 2
Hi,

@onebuck:

not sure what level of detail you need. I'm using a Dell notebook. The internal HD is standard IDE disk, 80 GB, Hitachi. The USB disk is a Trekstor, 80 Gb, should be USB 2.0 compatible.

@uppman:

yes, on the USB I've installed ZW Core, made a kernel update using ZW netpkg tool. No customization of the kernel.

And indeed, all drives follow the /dev/sdxy naming convention.

When the initrd goes into the loop I see the messages about partitions being found. However, so far I've no idea how to get a printout of these messages or to redirect it to a file. The only idea that comes to my mind is to set the value for the sleep command to 100 to gain more time to read it and make appropriate notes.

I will change the init (@ home), set the sleep value to 100, re-build the initrd, test with and without the internal HD and let you know what the printout says.

rds,

The MoD
 
Old 11-25-2008, 05:59 AM   #49
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Post the mkinitrd that you created.
 
Old 11-25-2008, 06:39 AM   #50
The MoD
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Rep: Reputation: 2
Hi,

what do you mean by "post the mkinitrd that you created"?

I've
1) installed the mkinitrd script (latest version downloaded from the ZW repository)
2) substituted the init file in /boot/initrd-tree with the one provided by Magnus Uppman for SW V12
3) edited the init file in two places - the label of the partition to be mounted as root and removed the # in the "sleep 10"
line
4) run mkinitrd to produce the initrd.gz

rds,

The MoD
 
Old 11-25-2008, 06:39 PM   #51
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

When you create initrd you must pass the correct parameters for your kernel;

Quote:
sample with options;

mkinitrd -c -k 2.6.24.5-smp -m ext3 -f ext3 -r /dev/hdb3
Code:
excerpt from 'man mkinitrd';

NAME
       mkinitrd  -  create  or  rebuilt  an  initrd  (initial  ramdisk)  using
       initramfs (simple cpio+gzip).

SYNOPSIS
       mkinitrd [ -F ] [ -c ] [ -f filesystem ] [ -h hibernate_partition  ]  [
       -k kernel_version ] [ -m module1:module2:module3...  ] [ -o output_file
       ] [ -r root_device ] [ -s source_tree ] [ -C crypt_device ] [ -L ] [ -R
       ] [ -V ]

DESCRIPTION
       mkinitrd  is used to build an initial ramdisk.  An initial ramdisk is a
       very small set of files that are loaded  into  RAM  and  "mounted"  (as
       initramfs  doesn't  actually  use  a  filesystem)  as  the kernel boots
       (before the main root filesystem is mounted).  The usual reason to  use
       an  initrd  is  because you need to load kernel modules before mounting
       the root partition.  Usually these modules are required to support  the
       filesystem used by the root partition (ext3, reiserfs, xfs), or perhaps
       the controller that the hard drive is attached to  (SCSI,  RAID,  etc).
       Essentially,  there  are  so many different options available in modern
       Linux kernels that it isn't practical to try  to  ship  many  different
 kernels  to try to cover everyone's needs.  It's a lot more flexible to
       ship a generic kernel and a set of kernel modules for it.

OPTIONS
       -F     Use the contents of /etc/mkinitrd.conf as  options  to  mkinitrd
              (optional).   If  this  is  used  in  conjunction with any other
              options passed on the command  line,  the  command-line  options
              will override the config file options.
              See mkinitrd.conf(5) for details.

       -c     Clear  the  existing  initrd  tree  (by default in /boot/initrd-
              tree/) first.  If this is not done, running  mkinitrd  will  add
              additional modules to the existing initrd.

       -f filesystem
              Specify  the  filesystem to use for the root partition.  If this
              isn't given, mount will usually figure it out.  This option must
              be used together with the -r option in order to be beneficial.

       --help Display a help summary.

       -h hibernate_partition
              Specify the swap partition holding the hibernation image.
I suggest that you 'man mkinitrd' to get a better understanding.
 
Old 11-25-2008, 08:19 PM   #52
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
Quote:
Originally Posted by onebuck View Post
Hi,

When you create initrd you must pass the correct parameters for your kernel;



Code:
excerpt from 'man mkinitrd';

NAME
       mkinitrd  -  create  or  rebuilt  an  initrd  (initial  ramdisk)  using
       initramfs (simple cpio+gzip).

SYNOPSIS
       mkinitrd [ -F ] [ -c ] [ -f filesystem ] [ -h hibernate_partition  ]  [
       -k kernel_version ] [ -m module1:module2:module3...  ] [ -o output_file
       ] [ -r root_device ] [ -s source_tree ] [ -C crypt_device ] [ -L ] [ -R
       ] [ -V ]

DESCRIPTION
       mkinitrd  is used to build an initial ramdisk.  An initial ramdisk is a
       very small set of files that are loaded  into  RAM  and  "mounted"  (as
       initramfs  doesn't  actually  use  a  filesystem)  as  the kernel boots
       (before the main root filesystem is mounted).  The usual reason to  use
       an  initrd  is  because you need to load kernel modules before mounting
       the root partition.  Usually these modules are required to support  the
       filesystem used by the root partition (ext3, reiserfs, xfs), or perhaps
       the controller that the hard drive is attached to  (SCSI,  RAID,  etc).
       Essentially,  there  are  so many different options available in modern
       Linux kernels that it isn't practical to try  to  ship  many  different
 kernels  to try to cover everyone's needs.  It's a lot more flexible to
       ship a generic kernel and a set of kernel modules for it.

OPTIONS
       -F     Use the contents of /etc/mkinitrd.conf as  options  to  mkinitrd
              (optional).   If  this  is  used  in  conjunction with any other
              options passed on the command  line,  the  command-line  options
              will override the config file options.
              See mkinitrd.conf(5) for details.

       -c     Clear  the  existing  initrd  tree  (by default in /boot/initrd-
              tree/) first.  If this is not done, running  mkinitrd  will  add
              additional modules to the existing initrd.

       -f filesystem
              Specify  the  filesystem to use for the root partition.  If this
              isn't given, mount will usually figure it out.  This option must
              be used together with the -r option in order to be beneficial.

       --help Display a help summary.

       -h hibernate_partition
              Specify the swap partition holding the hibernation image.
I suggest that you 'man mkinitrd' to get a better understanding.
From `man mkinitrd` in Slackware (though remember that the mkinitrd from Zenwalk may be different!):
Code:
       If run without options, mkinitrd will rebuild an initrd image using the
       contents of the $SOURCE_TREE directory, or, if that directory does  not
       exist  it  will  be created and populated, and then mkinitrd will exit.
       These options are handy for building an initrd mostly by  hand.   After
       creating  /boot/initrd-tree/,  you  can  add  modules and edit files by
       hand, and then rerun mkinitrd to create the initrd.
mkinitrd without options can be a correct way to generate an initrd. I have never used this method, so I can't be much more help than that; however, doing this is sometimes required (or easier, anyway) if you are making strange modifications to initrd-tree, such as in this example.
 
Old 11-26-2008, 01:05 AM   #53
The MoD
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Rep: Reputation: 2
Hi,

thanks for all the hints.

I've played around with busybox. It has an option to support recognizing partitions by there label or UUID. Normally not ticked. So I've run make menuconfig on busybox, ticked these options, run make && make install to build and install it.

Looks like I shall use the -F switch to force mkinitrd to use busybox, right?


Thx in advance.


The MoD
 
Old 11-26-2008, 03:39 AM   #54
uppman
Member
 
Registered: Jul 2008
Location: Stockholm, Sweden
Distribution: Slackware 13.1 32-bit
Posts: 145

Rep: Reputation: 24
Try to recompile your kernel with "ATA/ATAPI/MFM/RLL support" enabled.
That will probably solve the problem.

You can add a /bin/sh in the init file (before the loop starts) to get a shell prompt and do some debugging from there. The init script will continue after you exit the shell.

/Magnus
 
Old 11-26-2008, 06:53 AM   #55
The MoD
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Rep: Reputation: 2
Hi Magnus,

thanks for the answer. I'll try that as well.

Have you ever tried busybox for that purpose? I've build a new initrd using your init file for SW 12.1. I've build a statically linked version of busybox 1.12.2 with support for LABEL and UUID and copied that to /boot/initrd-tree/bin (overwriting the existing one).

By now I get an interesting result: the partition IS INDEED FOUND using the LABEL while the internal HD is installed. However, it is not being mounted. "mount -r /dev/sdb3 /mnt" plus "exit" solves the problem. "mount -r -L ZW_CORE /mnt" does not work. I'm getting something like "option --L not supported"

One more strange observation: when I open the busybox file with Midnight Commander F3, I see a text saying that busybox has been build for kernel version 2.6.18. I'm using 2.6.24.x. And as far as I remember at least ZW switched to the SDA naming convention with the introduction of kernel 2.6.20. Not sure whether this is valid for all SW- based distros. And I haven't seen an opion in busybox's menuconfig to select a specific kernel version. On the other hand, how can this work? I have only the corresponding kernel modules (2.6.24.x) installed.

Any ideas?

Thx.


The MoD

Added: looks like BB does not support "mount -L" at all. Checked findfs "LABEL=label". Result: not found. Giving up on BB for the moment. Keeps you just busy. W/o delivering the expected results.

Last edited by The MoD; 11-27-2008 at 12:20 AM.
 
Old 11-27-2008, 07:24 AM   #56
uppman
Member
 
Registered: Jul 2008
Location: Stockholm, Sweden
Distribution: Slackware 13.1 32-bit
Posts: 145

Rep: Reputation: 24
Quote:
Originally Posted by The MoD View Post
Added: looks like BB does not support "mount -L" at all. Checked findfs "LABEL=label". Result: not found. Giving up on BB for the moment. Keeps you just busy. W/o delivering the expected results.
I tried a long time ago and gave up just like you..
/Magnus
 
Old 11-27-2008, 09:39 AM   #57
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
"busybox has been build for kernel version 2.6.18." This is probably the version of your kernel headers.
It looks to me like you can make this work. If you are able to retrieve the partition label somehow, you just need to mount that partition using its' real partition info and then switch_root into the mounted directory. The problem is probably with the fstab entry which should usually match the kernel boot params. But, instead of trxing to use the label there or a hard-coded partition, just use rootfs, instead of something like this:
/dev/hdb3 / reiserfs defaults 1 1
use this:
rootfs / reiserfs defaults 1 1

This will let you mount it no matter which partition it is detected as. Of course you first need to echo the correct info into /proc/sys/kernel/real-root-dev.
 
Old 11-28-2008, 08:46 AM   #58
TSquaredF
Member
 
Registered: Dec 2005
Location: "The South Coast of Texas"
Distribution: Slackware64-current
Posts: 564

Rep: Reputation: Disabled
I've been working with Magnus' script for quite a while now & had to modify it to get it to work with ext3. See this post. Unfortunately, I do not have a machine that will boot from USB, nor have I used Zenwalk, so can't help you there. I am now happily using "root=LABEL/*" & copying my boot partition to a couple of machines without having to modify /boot/grub/menu.lst. If you need more details on what I did, post.
Regards,
Bill
 
Old 11-29-2008, 02:23 AM   #59
The MoD
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Rep: Reputation: 2
Hi,

thx for all hints.

Still experimenting with the initrd build acc. to Magnus' howto.

I'v added vol_id and usb_id in the same way as blkid and awk were added including the dependencies. And I've added a /bin/sh statement in the init file to be able to play around with the initrd mounted. And I've added the mount program instead of the symlink to busybox. Because it supports "-L LABEL" option.

The result is quite interesting: "fdisk -l" and "cat /proc/partitions" always shows all partitions, no matter how many devices are present. blkid works fine as long as the internal disk is present. If I remove the internal disk, blkid does not find sda2, sda6 and sda7! vol_id os no better. Because it uses the same underlaying technique?

"mount -r -L ZW_CORE /mnt" works only if a use blkid before. Seems like blkid first fills some table (/etc/blkid.tab???) and mount uses that table?
However, this works only, as long the internal disk is present. If I remove it even "mount -r /dev/sda7 -mnt" fails - producing a "Segmentation fault".

To me that sounds like a bug.

Maybe, I shall inspect how Debian based systems solved that issue.

rgds,

The MoD
 
Old 12-07-2008, 03:18 AM   #60
The MoD
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Rep: Reputation: 2
Hi,

I've found a very easy solution to solve the problem. I can now boot the box from my USB thumb drive using /dev/sdxy, LABEL and / or UUID - whatever I want.

Here is, how I did it (finally, and with the help of many others!)

1) install mkinitrd
get the latest version from e.g. http://packages.slackware.it
run pkginstall mkinitrd-version.tgz

2) edit the init file in /boot/initrd-tree
go to section "#Parse command line" and change the following lines:
line 73 from "root=/dev/*)" to "root=*)"
line 74 from "ROOTDEV='echo $ARG | cut -f2 -d=' to "ROOTDEV='echo $ARG | cut -b6-'
save changes

3) download busybox from www.busybox.net (I'm using 1.12.2)
- untar it (using -jxf, I think)
- run "make menuconfig"
- go to "Busybox Settings --> Build Options" and set the option "Build as static"
- exit to the main menu
- go to "Linux System Utilities" and "tick" in the section "Routines for detecting label in uuid on common file systems"
the file systems you need
- go to the section "mount" and "tick" support specifiying devices by label and uuid"
- exit menuconfig and save your configuration
- run "make"
- note: there is no need to run "make install" !!!
- replace the busybox version in /boot/initrd-tree/bin with the one created in /path/busybox-version/busybox

3) build your initrd.gz
I used the following howto:
http://linuxconfig.dyndns.org:1184/l...vable_USB_disk

4) adjust your lilo.conf and run "lilo -v"
my one looks like this:
image = /boot/vmlinuz
append = "root=UUID=1234abcd-5678-efgh-90ij-klmnopqrstuv"
initrd = /boot/initrd.gz
label = by_UUID

you may also use LABEL. In this case the second line looks like this
append = "root=LABEL=label"

Enjoy.

The MoD
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel root=LABEL handling Maze the Kid Linux - General 4 08-27-2009 02:31 PM
mkinitrd not working cobweb Linux - Newbie 1 02-22-2006 02:45 PM
Why 'mkinitrd' not working? chandrakanta Linux - Software 1 09-08-2004 10:54 AM
compile 2.6.7 kernel and root=LABEL=/ not work? robert.china Fedora 3 07-06-2004 04:05 AM
mkinitrd isn't working when compilaing a new kernel citrus Linux - General 6 02-12-2004 06:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration