<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="337139" data-post-id="337139">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lawik" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lawik/120/32028_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lawik
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Nerves Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>After a lot of fiddling to avoid needing to recompile for 45 minutes to modify the executable bit on init_sh I have switched root and have a shell inside my rootfs.img:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># exec switch_root /media/root/ /sbin/init_sh
======================= Running second /init
Starting second shell
# ls
var    tmp    srv    run    proc   mnt    lib64  etc    data   bin
usr    sys    sbin   root   opt    media  lib    dev    boot
# ls /dev
shm  pts  log
# mount -t devtmpfs -o rw none /dev
mount: permission denied (are you root?)
# whoami
sh: whoami: not found
# id -u
1000
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="337139" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/secure-boot-with-raspberry-pi-cm4-and-nerves/63160/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-337139" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="337139"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="337140" data-post-id="337140">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lawik" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lawik/120/32028_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lawik
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Nerves Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>While on original boot I am root:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">======================= Running init from rootfs_overlay
Waiting for /dev/mmcblk0p2...
[    2.682475] mmc0: new DDR MMC card at address 0001
[    2.688650] mmcblk0: mmc0:0001 8GTF4R 7.28 GiB 
[    2.695090]  mmcblk0: p1 p2 p3
[    2.698437] mmcblk0: mmc0:0001 8GTF4R 7.28 GiB
[    2.703218] mmcblk0boot0: mmc0:0001 8GTF4R 4.00 MiB 
[    2.708718] mmcblk0boot1: mmc0:0001 8GTF4R 4.00 MiB 
[    2.713954] mmcblk0rpmb: mmc0:0001 8GTF4R 512 KiB, chardev (246:0)
Mounting /dev/mmcblk0p2...
Mounted /media/root
# id -u
0
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="337140" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/secure-boot-with-raspberry-pi-cm4-and-nerves/63160/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-337140" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="337140"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
    <div class="postbit" id="337141" data-post-id="337141">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lawik" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lawik/120/32028_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lawik
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Nerves Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I probably should have been root when re-compressing the darned thing after editing it…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="337141" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/secure-boot-with-raspberry-pi-cm4-and-nerves/63160/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-337141" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="337141"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="337143" data-post-id="337143">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lawik" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lawik/120/32028_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lawik
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Nerves Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I got it!</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># exec switch_root /media/root/ /sbin/init_sh
======================= Running second /init
Starting second shell
# ls
var    tmp    srv    run    proc   mnt    lib64  etc    data   bin
usr    sys    sbin   root   opt    media  lib    dev    boot
# mount -t devtmpfs -o rw none /dev
# mount -t proc proc /proc
# mount -t sysfs sysfs /sys
# exec /sbin/init
[   40.991680] erlinit: Cannot mount /sys
[   41.009972] F2FS-fs (mmcblk0p3): Magic Mismatch, valid(0xf2f52010) - read(0xffffffff)
[   41.018038] F2FS-fs (mmcblk0p3): Can't find valid F2FS filesystem in 1th superblock
[   41.026147] F2FS-fs (mmcblk0p3): Magic Mismatch, valid(0xf2f52010) - read(0xffffffff)
[   41.034110] F2FS-fs (mmcblk0p3): Can't find valid F2FS filesystem in 2th superblock
[   41.042127] erlinit: Cannot mount /dev/mmcblk0p3 at /root: Invalid argument
erlinit: The shell will be launched on tty 'tty1'.
erlinit: If you would like the shell to be on this tty,
erlinit: configure erlinit with '-c ttyS0'.
erlinit: The hostname is 'nerves-72cf'.
</code></pre>
<p>Now to see if I can just script it without going through an interactive shell each time. Which seems to be a problem?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="337143" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/secure-boot-with-raspberry-pi-cm4-and-nerves/63160/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-337143" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="337143"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>