# [SOLVED][initramfs] freeze after initrd load

## ade05fr

Hie everyone

as mentionned in the news profile, i have change my boot loading process. I have followed the documentation from here https://wiki.gentoo.org/wiki/Early_Userspace_Mounting and 

the initrd file is correctly loaded but after that my laptop freeze and the init sequence does no longer start.

Why ?the init file from /usr/src/initramfs/init is exactly the same

thanks for ur help

----------

## Goverp

Try adding 

```
nod /dev/console 644 0 0 c 5 1
```

 to your initramfs_list, or set 

```
CONFIG_DEVTMPFS_MOUNT=y
```

 in your kernel config.

I suffered this problem some time back, and I think it was because busybox had nowhere to mount its console.

----------

## ade05fr

i have modify the initram_list file but its still the same...

----------

## Goverp

Do you get any console output after the initramfs loads?

When I had problems like this, I changed the init script to call rescue_shell immediately after mounting devtmpfs.  Then I could use the console to look around and work out what was wrong.  Try that; if you can't get the rescue_shell to work, your problem is with the console device.

----------

## ade05fr

i dont have any console output 

in fact i have modified the init script to define when i have the freeze its in the last line 

```
exec switch_root /mnt/root /sbin/init
```

i dont know if the problem is related to /mnt/root or /sbin/init.

any ideas ?

thanks

----------

## Goverp

switch_root is a program in busybox.  It's purpose is to delete the contents of your current file system (that is, the stuff loaded into memory from your initramfs), change the rootfs to (in your case) /mnt/root, which should be your real filesystem root, and finally call /sbin/init (which should be the init stuff you used before you had an initramfs) and exit.

Possible causes of error: /mnt/root isn't properly mounted, or is the wrong file system; /sbin/init within your new root filesystem is wrong, or something else your setup needs isn't mounted or started (such as mdadm, lvm, luks, etc.).

Getting to this stage, use the rescue_shell and check what is mounted at /mnt/root, and look at /mnt/root/sbin/init ( which is what will be /sbin/init) and see if there's something missing.  I guess as the cause of all this is you have a separate /usr, so check also that /mnt/root/usr is right. and for any other file systems you intend to have mounted.

----------

## ade05fr

I have followed your advices and i have noticed a few things 

1/ In rescue_shell i have checked /mnt/root and everything seems ok

2/ the /usr which is mounted at the beginning does not contain any directories or file !!

here is the code used to mount /usr 

```

# space separated list of mountpoints that ...

mountpoints="/usr"

# ... we want to find in /etc/fstab ...

ln -s /mnt/root/etc/fstab /etc/fstab

# ... to check filesystems and mount our devices.

for m in $mountpoints ; do

    check_filesystem $m

    echo "Mounting $m"

    # mount the device and ...

    mount $m || rescue_shell "Error while mounting $m"

    # ... move the tree to its final location

    mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"

done

```

3/ in the /dev i have only console nothing else (no tty, null or sdax) it seems that console ha been create through the /usr/src/linux/scripts/gen_initramfs_list.sh script

```

localhost linux # grep dev scripts/gen_initramfs_list.sh 

      dir /dev 0755 0 0

      nod /dev/console 0600 0 0 c 5 1

```

in conclusion i really thing something is missing but i dont know wich file/directory

any ideas ?

thanks

----------

## Goverp

If /mnt/root/usr is empty, it looks like the mount $m for /usr is failing, though that ought to produce a message in rescue_shell. 

If I understand correctly, the mount would fail if there's no mount point in the initial directory tree - i.e. no /usr.  I'm not sure if mount move requires the target, /mnt/root/usr to not exist.  You can check all these by entering the rescue_shell and trying the commands manually.

Sorry I can't be more directly helpful; I use a hand-rolled initramfs with a rather shorter init script (but not on the notebook I'm writing this on).  I'll try to remember to post the stuff I use when I switch machines!

----------

## ade05fr

Hi 

i finally created an initramfs file through kernel.

Apparently there si some missing files, modules and other libs.

now im on systemd and everything seems to work fine

thanks for ur replies

----------

## Goverp

Glad you solved it.  I didn't post my initramfs setup, as I realized it wouldn't help.  Mine doesn't have separate /usr, and it's the fsck handling that complicates the script you were using.

----------

