Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
Hi Chris, welcome to AU. To get quality answers, make sure you emphasize what your question exactly is. In this case, I assume you relate to the ARM / ARMEL architecture. –  Mateng Nov 19 '12 at 15:27
1  
Yes, as the target filesystem is ARMEL it's not possible to chroot into on an x86 system. I have got around this issue by mounting the filesystem on and ARMEL system and chrooting, but I wondered if there was a more direct approach? –  chris varnz Dec 14 '12 at 11:53

2 Answers 2

Perhaps, this will work (apart from your workaround: mounting the new filesystem it in an ARMEL system):

before doing chroot, do mount --bind the directories conntaining architecture-dependent binaries from your host system onto the corresponding pats in the new filesystem (/bin/, /sbin/, /lib/ -- perhaps this will suffice for adding a user; or /usr/* as well, if not), then chroot and run the commands. /etc/, /home/, and /var/ from the new filesystem will be modified.

share|improve this answer
    
Thanks for the answer, I found a similar approach only the other day which worked perfectly, I'll post in another answer. –  chris varnz Jan 16 '13 at 10:15
up vote 0 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.