Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 5286  / 1 Year ago, wed, january 4, 2023, 9:07:55

I'm trying to work out how to add a user to a separate filesystem, as described here, specifically point 5:
Add a local user and password for the user, then add the user to the adm and sudo groups.



I've read around chroot, but I don't believe this will work as the default command to run is /bin/bash, which would require the target fs to be binary compatible. In this case, the target filesystem is Armel so it's not compatible.


More From » chroot

 Answers
3

I found this page which explains exactly what I was trying to do to chroot into the target filesystem:



http://www.omappedia.com/wiki/OMAP_Ubuntu_Core#Chroot.27ing_into_the_Ubuntu_Core_Filesystem



It's then a simple case of running adduser ubuntu or similar.



Copied in case it goes dead:



Chroot'ing into the Ubuntu Core Filesystem



One solution to customize your Ubuntu Core Filesystem is to do it from the Linux PC. Using a 'chroot' is sometimes quite convinient as you can run commands as you normally do on the ARM target. Here are some quick steps to get running:



Chroot configuration on the Linux PC



Verify that on your Linux PC you have the 'qemu-user-static' Ubuntu package installed. This can be done with the following command line (on your Linux PC):



dpkg -l qemu-user-static


Have your SD Card mounted on your Linux PC and go to your rootfs Ubuntu Core folder, generally:



cd /media/rootfs


Copy the qemu for arm file:



cp /usr/bin/qemu-arm-static usr/bin/


If not done yet, have your network settings properly configured:



mv etc/resolv.conf etc/resolv.conf.saved
cp /etc/resolv.conf etc/resolv.conf


Then, mount sys, proc and dev:



for m in `echo 'sys dev proc'`; do sudo mount /$m ./$m -o bind; done


Finally, chroot into your target filesystem:



sudo LC_ALL=C chroot . /bin/bash


You are now in your 'chroot' which means you can run commands like if you were on your target ARM device.



Using the 'chroot'



The first step is to verify the network connection is fine. You can run:



apt-get update


You are now ready to install any new package in your Ubuntu Core Filesystem using APT tools.



Getting out of the 'chroot'



Un-mount the target filesystem:
Make sure your at the / target FS and run the following commands:



for m in `echo 'sys dev proc'`; do sudo umount ./$m; done


Go back to your original network settings:



mv etc/resolv.conf.saved etc/resolv.conf

[#34319] Friday, January 6, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tersle

Total Points: 342
Total Questions: 109
Total Answers: 99

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
tersle questions
Sat, Oct 23, 21, 00:33, 3 Years ago
Sat, Nov 20, 21, 09:58, 3 Years ago
Sun, Apr 17, 22, 23:01, 2 Years ago
Thu, May 11, 23, 22:57, 1 Year ago
;