LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-10-2015, 12:49 PM   #1
ExternalUse
LQ Newbie
 
Registered: Sep 2013
Posts: 16

Rep: Reputation: Disabled
initramfs - switch_root unable to load new rootfs


Hi, I am trying to use an initramfs to load my rootfs from the sd card. I have used buildroot to generate both the initramfs, and another rootfs.

My /init script looks like this for the initramfs:

Code:
#!/bin/sh
# devtmpfs does not get automounted for initramfs
/bin/mount -t devtmpfs devtmpfs /dev

/bin/mkdir /mnt/root
/bin/mount -r -t ext4 /dev/mmcblk0p2 /mnt/root

echo "Mounting proc, sys, dev"
/bin/mount -t proc proc /proc
/bin/mount -t sysfs sysfs /sys
/bin/mount -t tmpfs tmpfs /dev
echo "Mount finished"

if [[ -x "/mnt/root" ]]; then
    echo "Found real rootfs"
    echo "Remounting"
    /bin/mount --move /proc /mnt/root/proc
    /bin/mount --move /sys /mnt/root/sys
    /bin/mount --move /dev /mnt/root/dev
fi

if [[ -x "/mnt/root/sbin/init" ]]; then
    echo "Found INIT binary on new rootfs"
    exec /sbin/switch_root /mnt/root /mnt/root/sbin/init
fi

echo "FAILURE"
After boot, I get this error message:
Code:
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
Mounting proc, sys, dev
Mount finished
Found real rootfs
Remounting
Found INIT binary on new rootfs
switch_root: can't execute '/mnt/root/sbin/init': No such file or directory
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100

CPU: 0 PID: 1 Comm: switch_root Not tainted 3.10.0 #46
[<c0012090>] (unwind_backtrace+0x0/0xec) from [<c0010a04>] (show_stack+0x10/0x14)
[<c0010a04>] (show_stack+0x10/0x14) from [<c04720c8>] (panic+0x8c/0x1c8)
[<c04720c8>] (panic+0x8c/0x1c8) from [<c001f100>] (complete_and_exit+0x0/0x1c)
[<c001f100>] (complete_and_exit+0x0/0x1c) from [<00000001>] (0x1)
It doesn't make sense to me, since /mnt/root/sbin/init does indeed exist. To simplify things, I have skipped the exec part, and started a shell. Within that shell, I can verify that the mounting was done correctly, since I can run the binaries from the sd card which are all mounted on /mnt/root/bin.

Any idea what's going on?
 
Old 02-10-2015, 04:58 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Unfortunately you haven't left means for mods to contact you, so I'll ask you in this thread why you asked for its deletion?
We don't normally delete threads.

Cheers,
Tink
 
Old 02-11-2015, 08:51 AM   #3
ExternalUse
LQ Newbie
 
Registered: Sep 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Tinkster View Post
Unfortunately you haven't left means for mods to contact you, so I'll ask you in this thread why you asked for its deletion?
We don't normally delete threads.

Cheers,
Tink
Sorry about that, it seemed like a great idea, but I stopped playing with it. Didn't want to keep it open and waste people's time.
 
  


Reply

Tags
buildroot, initramfs, kernel



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
[SOLVED] What are the differences of rootfs and initramfs? ayyasprings Linux - Embedded & Single-board computer 1 11-26-2014 11:48 AM
questions on rootfs mouting and on initramfs functionning details heavymetalhero Linux - General 2 08-14-2012 05:02 AM
Unable to mount rootfs - just want a shell prompt will.larson Linux - Embedded & Single-board computer 5 02-24-2012 01:42 PM
[SOLVED] Creating initramfs as inbuilt to the kernel and as permanent rootfs ramalingampc2008 Linux - Software 5 11-17-2010 11:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:14 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