title: switch_root busybox init problems?
body: <p>I'm in an embedded linux environment with busybox. I've read through <a href="https://unix.stackexchange.com/questions/5032/trouble-getting-busybox-switch-root-to-work">several</a> <a href="https://stackoverflow.com/questions/24083712/launching-linux-from-busybox-pivot-root-or-switch-root-or">posts</a> trying to learn how to use <a href="http://manpages.courier-mta.org/htmlman8/switch_root.8.html" rel="nofollow noreferrer">switch_root</a>. I tried this:</p>
  
  <pre><code>exec switch_root -c /dev/console /mnt/newroot /bin/busybox init
  </code></pre>
  
  <p>The <code>switch_root</code> help prints and I am presented with a new login:</p>
  
  <pre><code>[root@buildroot ~]# exec switch_root -c /dev/console /mnt/newroot /bin/busybox init
  BusyBox v1.21.0 (2015-04-24 18:14:40 MDT) multi-call binary.
  busybox init
  Usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT [ARGS]root /bin/busybox in
  
  Free initramfs and switch to another root fs:
  chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,
  execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.
  
          -c DEV  Reopen stdio to DEV after switch
  
  
  Welcome to Buildroot
  buildroot login:
  </code></pre>
  
  <p>When I login, <strong>newroot</strong> has not been loaded, old one is still there. Is this because I am running this command directly from command line and not from some kind of init script?</p>
  
  <p>I read in this article and found they perform other steps before running <code>switch_root</code>:</p>
  
  <pre><code>mount --move /sys /newroot/sys
  mount --move /proc /newroot/proc
  mount --move /dev /newroot/dev
  </code></pre>
  
  <p>First off, this confuses me. Why would I want to run these commands before running <code>switch_root</code>? Does <code>switch_root</code> not do this for me? </p>
  
  <p>Anyways, I went ahead and tried running them first and then running my <code>switch_root</code> command. However, this hoses things up entirely:</p>
  
  <pre><code>[root@buildroot /]# switch_root -c /dev/console /mnt/newroot /bin/busybox init
  BusyBox v1.21.0 (2015-04-24 18:14:40 MDT) multi-call binary.
  
  Usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT [ARGS]
  
  Free initramfs and switch to another root fs:
  chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,
  execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.
  
          -c DEV  Reopen stdio to DEV after switch
  
  can't open /dev/ttyS0: No such file or directoryole /mnt/newroot /bin/busybox init
  can't open /dev/ttyS0: No such file or directory
  can't open /dev/ttyS0: No such file or directory
  can't open /dev/ttyS0: No such file or directory
  can't open /dev/ttyS0: No such file or directory
  can't open /dev/ttyS0: No such file or directory
  can't open /dev/ttyS0: No such file or directory
  ... message continues to repeat ...
  </code></pre>
  
  <p>So it looks like because I've moved the mount for dev that when my init runs and trys to put the getty on my serial port it can't find it? Confusion........</p>
  
  <p>Am I missing something fundamental about <code>switch_root</code> here? Or some simply command line modifications required?</p>