LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-15-2015, 10:07 AM   #1
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
initramfs creation issue


Hi!
I want to switch from booting by device (root=/dev/sda1) to booting by UUID (root=UUID=...) or by label (root=LABEL=....)
So I need initramfs.
Initramfs support enabled in .config as built-in (*), compression method set to XZ.
What I did till now: I ran mkinitrd generator script and followed supposed command:
Code:
mkinitrd -c -k 3.10.17-cust -r /dev/sda1 -f ext4 -m usbhid:hid_generic:ext4 -u -o /boot/initrd.gz
Initrd.gz was created and installed at /boot as well as initrd-tree.
However I do not see there System.map or something similar.
Relevant part of grub.cfg looks like this:
Code:
linux = vmlinuz-3.10.17-cust root=/dev/sda1 ro
initrd = /boot/initrd.gz to grub.cfg and rebooted.
When trying to boot, I getting kernel panic.
If I deleting initrd string from grub menu, system boots fine.

Where is my fault?

Last edited by Teufel; 01-18-2015 at 02:11 AM.
 
Old 01-15-2015, 10:47 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,056

Rep: Reputation: Disabled
AFAIK labeling your devices by UUID or LABEL doesn't create a need for an initramfs

This notwithstanding, it's hard to say if your initrd tree ships the needed modules.

Maybe you could try /usr/share/mkinitrd/mkinitrd_command_generator.sh to generate the mkinitrd command if you insist using an initrd (assuming you do that on Slackware, of course).

As you use a customized kernel, you should copy yourself the System.map file from the corresponding kernel tree to /boot.
 
Old 01-15-2015, 10:49 AM   #3
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
EDIT: Absolutely wrong answer. Removed to avoid confusing the OP.

Last edited by Richard Cranium; 01-15-2015 at 10:50 AM. Reason: Derp.
 
Old 01-15-2015, 12:06 PM   #4
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 142Reputation: 142
I tried to boot by UUID and by label without initrd, it leads to kernel panic with code (0,0).
In Gentoo I had to use initramfs to point root partition by UUID or LABEL, so assuming it should be the same in Slackware, since I do not use huge kernel.

Copying System.map from /usr/src/linux to /boot doesn't help.

I have all the modules I need to mount root partition already built in kernel, may it lead to kernel panic?
 
Old 01-15-2015, 12:35 PM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,056

Rep: Reputation: Disabled
Does the same initramfs allows you to boot when not using UUID's or LABELs ?

If that is the case, please provide full output of
Code:
lsblk -o name,fstype,model,size,mountpoint,label,uuid
and the content of /etc/fstab.

Else, I'd suggest that you first try a huge kernel.

Last edited by Didier Spaier; 01-15-2015 at 12:42 PM.
 
Old 01-15-2015, 02:37 PM   #6
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 142Reputation: 142
Initramfs i built doesn't allow to boot neither by block device nor by uuid, nor by label. Completely unusable.

Here only one disk with one ext4 partition only, so it isn't a mispointing issue.
Code:
NAME    FSTYPE MODEL     SIZE  MOUNTPOINT  LABEL   UUID
sda            HD080HJ  74.5G  
  sda1  ext4               9G  /           SLAX    a7112bd0-a352-4dd7-8379-0515908c5dd0
Apart from special filesystems (devpts, proc, tmpfs) I have in fstab only one string:
Code:
UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0  /  ext4  defaults  0  0
It is kind of huge kernel, with built-in usb modules needed to boot from usb:
Code:
CONFIG_USB_STORAGE=y
CONFIG_USB_EHCD_HCI=y
CONFIG_USB_XHCI_HCD=y
I do not need huge kernel as it is. I tried to use it with above options enabled with the same result: it boots by block device name only, attempt to load initrd leads to panic.
 
Old 01-15-2015, 02:51 PM   #7
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,056

Rep: Reputation: Disabled
The line showed in /etc/fstab is wrong. It should be:
Code:
UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0  /  ext4  defaults  1  1
see "man fstab" to know more.
 
Old 01-15-2015, 03:18 PM   #8
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
//LE: Wrong answer, I've read more closely what's the problem OP's having... Sorry for my post

Last edited by Smokey_justme; 01-15-2015 at 03:28 PM.
 
Old 01-15-2015, 08:43 PM   #9
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 142Reputation: 142
Quote:
Originally Posted by Didier Spaier View Post
The line showed in /etc/fstab is wrong. It should be:
Code:
UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0  /  ext4  defaults  1  1
see "man fstab" to know more.
My fstab line is correct.
fstab doesn't require to set fifth and sixth columns to value of "1".
Fifth column shows should filesystem be dumped by dump command or not.
Sixth column indicates whether filesystem needed to be checked with fsck and describes the order in which filesystems must be checked.
I do not need neither to dump nor to check filesystem, so these columns set to "0".
Moreover, these columns may be omitted:
Code:
UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0  /  ext4  defaults
It will work as well.
 
Old 01-15-2015, 09:48 PM   #10
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,056

Rep: Reputation: Disabled
Quote:
Originally Posted by Teufel View Post
My fstab line is correct.
fstab doesn't require to set fifth and sixth columns to value of "1".
Fifth column shows should filesystem be dumped by dump command or not.
Sixth column indicates whether filesystem needed to be checked with fsck and describes the order in which filesystems must be checked.
I do not need neither to dump nor to check filesystem, so these columns set to "0".
Moreover, these columns may be omitted:
Code:
UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0  /  ext4  defaults
It will work as well.
Strictly speaking you're right. But in Slackware the root filesystem is checked by default anyway. In /etc/rc.d/rc.S:
Code:
# Check the root filesystem:
if [ ! $READWRITE = yes ]; then
  RETVAL=0
  if [ ! -r /etc/fastboot ]; then
    echo "Checking root filesystem:"
    /sbin/fsck $FORCEFSCK -C -a /
    RETVAL=$?
  fi
  # An error code of 2 or higher will require a reboot.
  if [ $RETVAL -ge 2 ]; then
    # An error code equal to or greater than 4 means that some errors
    # could not be corrected.  This requires manual attention, so we
    # offer a chance to try to fix the problem in single-user mode:
    if [ $RETVAL -ge 4 ]; then
      echo
      echo "***********************************************************"
      echo "*** An error occurred during the root filesystem check. ***"
      echo "*** You will now be given a chance to log into the      ***"
      echo "*** system in single-user mode to fix the problem.      ***"
      echo "***                                                     ***"
      echo "*** If you are using the ext2 filesystem, running       ***"
      echo "*** 'e2fsck -v -y <partition>' might help.              ***"
      echo "***********************************************************"
      echo
      echo "Once you exit the single-user shell, the system will reboot."
      echo
      PS1="(Repair filesystem) \#"; export PS1
      sulogin
    else # With an error code of 2 or 3, reboot the machine automatically:
      echo
      echo "***********************************"
      echo "*** The filesystem was changed. ***"
      echo "*** The system will now reboot. ***"
      echo "***********************************"
      echo
    fi
    echo "Unmounting file systems."
    /sbin/umount -a -r
    /sbin/mount -n -o remount,ro /
    echo "Rebooting system."
    sleep 2
    reboot -f
  fi
So if you really don't want that you need to write /etc/fastboot and make it readable.

Anyway I just tried that:
Code:
UUID=cad3fb03-ebe8-4505-902c-d6d23e99bb54        /                ext4        defaults         0   0
and the machine booted OK (with a genuine Slackware huge kernel). So I'd explore the possibility of a misconfiguration of your huge kernel. Please note though that I don't mention an initrd in /etc/lilo.conf and don't know if that could conflict with the kernel. But I somehow doubt it as a conflict usually occurs when two drivers claim the same device and the wrong one wins.

Last edited by Didier Spaier; 01-15-2015 at 09:49 PM.
 
Old 01-15-2015, 10:53 PM   #11
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 142Reputation: 142
Well, I've gone with huge kernel. I copied huge kernel's config from installation cd and build kernel with it.
The only change I did in menuconfig - I added "-huge" string to kernel name. So it's a default huge kernel.
After that I built initrd for this kernel. I added few modules to initrd: ext4, usb_storage, ehci_hcd, xhci_hcd and set root to /dev/sda1. I saw that these modules was built and installed into initrd-tree (checked it).
When I trying to boot I see messages that those modules was loaded with insmod command.
After that, when it goes to mount root filesystem, I getting error.Initrd complains that /mnt/root not found and sda1 cannot be mounted hence. It drops me into shell. Being in shell, I checked initrd-tree, indeed there is no /mnt/root directory.
I created this directory and tried to mount sda1 there: still "no such file or directory".
When I exit shell, boot process tries to continue, but ends up with kernel panic.
 
Old 01-15-2015, 11:13 PM   #12
turtleli
Member
 
Registered: Aug 2012
Location: UK
Posts: 206

Rep: Reputation: Disabled
fstab isn't used for booting into the root filesystem when using an initramfs, the initramfs doesn't have access to it in the first place.

I believe the mkinitrd line should be
Code:
mkinitrd -c -k 3.10.17-cust -r UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0 -f ext4 -m usbhid:hid_generic:ext4 -u -o /boot/initrd.gz
and you should remove the root=/dev/sda1 from your grub.cfg.

Alternatively, if the necessary filesystem and SATA/PATA drivers are built into the kernel you can try using PARTUUID instead, which doesn't require a initramfs (I've tested this on my UEFI GPT system using a custom 3.14.28 kernel, EDIT: I don't know if this works for MBR systems).

Quote:
Originally Posted by Teufel View Post
After that, when it goes to mount root filesystem, I getting error.Initrd complains that /mnt/root not found and sda1 cannot be mounted hence. It drops me into shell. Being in shell, I checked initrd-tree, indeed there is no /mnt/root directory.
I created this directory and tried to mount sda1 there: still "no such file or directory".
When I exit shell, boot process tries to continue, but ends up with kernel panic.
Did you check what devices are present in /dev? Is /dev/disk present and if so, what does it contain?

Last edited by turtleli; 01-15-2015 at 11:17 PM.
 
Old 01-17-2015, 05:07 AM   #13
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 142Reputation: 142
As far as I understood, the problem occurs due to missing devices.
I completly removed all initrds and initrd-tree and started from the beginning.
Created new initrd and initrd-tree by running
Code:
mkinitrd -c -k 3.10.17-cust -r UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0 -f ext4 -m usbhid:hid_generic:ext4:ehci-hcd:usbcore:xhci-hcd -u -o /boot/initrd.gz
Checked initrd-tree for modules - they added to tree.
added the string
Code:
UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0 /mnt ext4 defaults 0 0
to /boot/initrd-tree/etc/fstab

Checked /boot/initrd-tree/dev directory for block devices, there are two devices: *sda and *sda1

After that I re-ran mkinitrd (without parameters) to apply changes to initrd.

On reboot I see that modules loaded (lsmod confirms it), however sda and sda1 devices are missing in /dev directory.
So there is nothing to mount and boot process stops with complains that device UUID=a7112bd0-a352-4dd7-8379-0515908c5dd0 not found.
I tried to run
Code:
udevadm trigger --action=add; udevadm settle
but doesn't help to add block devices to /dev.

Any idea, where can I get these devices?

Last edited by Teufel; 01-17-2015 at 05:09 AM.
 
Old 01-17-2015, 05:44 AM   #14
Paulo2
Member
 
Registered: Aug 2012
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 928

Rep: Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515
If you're trying to boot from a usb device maybe this could help
http://www.linuxquestions.org/questi...2/#post5041064
Modules list is different and there is a -w option to wait a fews seconds.
 
Old 01-17-2015, 09:12 AM   #15
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Original Poster
Rep: Reputation: 142Reputation: 142
Yes, ehci-pci module did the trick.
Though it's interesting, why my other USB systems booting without this module?
 
  


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
initramfs-tools-bin installation issue (Dependency problems) vignesh4sh Linux - Desktop 3 02-05-2013 01:54 AM
update-initramfs Locale Issue FizzerJE Linux - Software 0 07-28-2011 09:34 AM
Shell Scripting text file creation issue AiresTheBold Linux - Newbie 1 02-16-2011 09:27 AM
Raid5 creation issue, using fedora 4 DirtySanchez Linux - General 2 11-15-2005 04:10 AM
general user creation issue mehesque Linux - Newbie 2 10-17-2003 12:55 PM

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

All times are GMT -5. The time now is 06:04 PM.

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