You are not logged in.

#1 2016-01-01 18:30:37

kde35
Member
Registered: 2015-04-13
Posts: 71

No /sbin/init (/usr not mounted) after copying existing arch [Solved]

Hello, I followed the purple note in https://wiki.archlinux.org/index.php/In … Arch_Linux, and copied existing archlinux installation.  More precisely,

my old installation has

/dev/sda7               /               ext4            rw,relatime,barrier=1,data=ordered      0 1
/dev/sda8               /home           ext4            defaults        1 2
/dev/sda5               none            swap            defaults        0 0

in /etc/fstab, whereas new installation has

/dev/sda6               /               ext4            rw,relatime,barrier=1,data=ordered      0 1
/dev/sda1               /usr            ext4            rw,relatime,barrier=1,data=ordered      0 1
/dev/sda8               /home           ext4            defaults        1 2

/dev/sda5               none            swap            defaults        0 0

I simply copied directories /bin /boot /etc /lib /root /sbin /srv /usr /var using cp -ax from partition sda7 to partitions sda1 and sda6.

I then used

grub-mkconfig -o /boot/grub/grub.cfg

to create new grub2 configuration file (which contained some problem, so I edited it by hand) to end up with the following grub.cfg.

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="2"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos 
insmod ext2
set root='hd0,msdos7'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos7' --hint-bios=hd0,msdos7 --hint-efi=hd0,
msdos7 --hint-baremetal=ahci0,msdos7  f798255c-d4eb-4695-9de7-2bcbe76b2b2f
else
  search --no-floppy --fs-uuid --set=root f798255c-d4eb-4695-9de7-2bcbe76b2b2f
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-f798255
c-d4eb-4695-9de7-2bcbe76b2b2f' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos 
        insmod ext2
        set root='hd0,msdos7'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos7' --hint-bios=hd0,msdos7 --hint-
efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7  f798255c-d4eb-4695-9de7-2bcbe76b2b2f
        else
          search --no-floppy --fs-uuid --set=root f798255c-d4eb-4695-9de7-2bcbe76b2b2f
        fi
        echo    'Loading Linux linux ...'
        linux   /boot/vmlinuz-linux root=UUID=f798255c-d4eb-4695-9de7-2bcbe76b2b2f rw  quiet
      echo    'Loading initial ramdisk ...'
        initrd   /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-f798255c-d4eb-4695-9de7-2bcbe76b2b2f' {
        menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_optio
n 'gnulinux-linux-advanced-f798255c-d4eb-4695-9de7-2bcbe76b2b2f' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos 
                insmod ext2
                set root='hd0,msdos7'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos7' --hint-bios=hd0,msdos7
 --hint-efi=hd0,msdos7 --hint-baremetal=ahci0,msdos7  f798255c-d4eb-4695-9de7-2bcbe76b2b2f
                else
                  search --no-floppy --fs-uuid --set=root f798255c-d4eb-4695-9de7-2bcbe76b2b2f
                fi
                echo    'Loading Linux linux ...'
                linux   /boot/vmlinuz-linux root=UUID=f798255c-d4eb-4695-9de7-2bcbe76b2b2f rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd   /boot/initramfs-linux.img
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###

menuentry 'Arch (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-fb
61aa6d-2008-4326-9ff1-5619c8269c6f' {
load_video
        set gfxpayload=keep
        insmod gzio
insmod part_msdos 
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  --hint-bios=hd0,msdos6  --hint-baremetal=ahci0,msdos6  fb61aa6d-2008-43
26-9ff1-5619c8269c6f
        else
          search --no-floppy --fs-uuid --set=root fb61aa6d-2008-4326-9ff1-5619c8269c6f
        fi
        linux /boot/vmlinuz-linux root=UUID=fb61aa6d-2008-4326-9ff1-5619c8269c6f rw quiet
        initrd /boot/initramfs-linux.img
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/60_memtest86+ ###
### END /etc/grub.d/60_memtest86+ ###

In the above fb61aa6d-2008-4326-9ff1-5619c8269c6f corresponds to /dev/sda6  and f798255c-d4eb-4695-9de7-2bcbe76b2b2f to /dev/sda7.

When I tried to boot into the new installation, I got the notorious "root file system mounted but /sbin/init not found" error.  When I changed directory to new_root, I saw that
/dev/sda6 was mounted there,  but /dev/sda1 was not mounted (which is why /sbin/init couldn't be found, since /sbin is just a symlink to /usr/bin).  Would there be any solution to this problem?

Last edited by kde35 (2016-01-02 06:33:02)

Offline

#2 2016-01-01 19:43:41

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: No /sbin/init (/usr not mounted) after copying existing arch [Solved]

I believe you need to mount it using the fsck hook from your initrd environment.  See https://wiki.archlinux.org/index.php/Mkinitcpio#HOOKS


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2016-01-01 19:53:07

kde35
Member
Registered: 2015-04-13
Posts: 71

Re: No /sbin/init (/usr not mounted) after copying existing arch [Solved]

In short you mean that the initrd that I copied from the old installation (which doesn't have separated /usr partition) is not adequate for the new installation?  Thank you very much, I will
give several tries.

Offline

#4 2016-01-02 01:07:06

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: No /sbin/init (/usr not mounted) after copying existing arch [Solved]

There are a menu entries for Arch in that config, some of which are still the old one. Which one are you selecting?

Offline

#5 2016-01-02 06:41:38

kde35
Member
Registered: 2015-04-13
Posts: 71

Re: No /sbin/init (/usr not mounted) after copying existing arch [Solved]

I added usr shutdown and fsck hook, and now it boots fine.  Thank you very much.  However, fsck hook turned out to be there already, would it be a problem if it is included twice in initram?

Scimmia,  I was talking about the entry 2.

Offline

Board footer

Powered by FluxBB