[SOLVED] chroot on v 3.5 A=/usr/local/sbin/newroot

Arch based Porteus community project

Moderator: M. Eerie

aus9

[SOLVED] chroot on v 3.5 A=/usr/local/sbin/newroot

Post#1 by aus9 » 26 Nov 2015, 10:55

Hi

Just discovered I can't use relative sym links as they are find my real system (RAM drive) for an unpacked base XZM that I am attempting to mod.

https://wiki.archlinux.org/index.php/Change_root

offers 2 main methods AFAIK, which is better please and 2 more below

Using chroot or Using systemd-nspawn

At this stage I don't need any internet or run any gui app.....its command line interface only

Also mentions in this post
https://wiki.archlinux.org/index.php/Ch ... nvironment

Proot or Fakechroot


thanks for reading.
Last edited by aus9 on 27 Nov 2015, 00:52, edited 1 time in total.

aus9

Re: chroot which is better?

Post#2 by aus9 » 26 Nov 2015, 10:59

there appears to be a nice alternative here

Code: Select all

mkdir /mnt/arch
mount /dev/<device-or-partition-name> /mnt/arch
cd /mnt/arch
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
mount -t devpts pts dev/pts/
chroot . /bin/bash
https://shafeeqk.wordpress.com/2012/07/ ... ux-chroot/

so that makes it about 5 ways and counting

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3924
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Re: chroot which is better?

Post#3 by ncmprhnsbl » 26 Nov 2015, 23:49

ive only used the basic chroot on the wiki to recover my arch install(from archbang livecd and porteus once i think) a few times..
systemd-nspawn sounds slightly easier... fewer setup steps... :unknown:
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: chroot which is better?

Post#4 by brokenman » 27 Nov 2015, 00:09

And this is how I built Nemesis. All from a chroot (on any OS). systemd-nspawn looks very useful. Cheers.
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: [SOLVED] chroot which is better? A=systemd-nspawn

Post#5 by aus9 » 27 Nov 2015, 00:57

Yes you beat me to it. Just created my first successful sym link

for others to see a good result....in code box I use # to show output results

Code: Select all

cd $UNPACK
systemd-nspawn

# Spawning container squashfs-root on /tmp/squashfs-root.
# Press ^] three times within 1s to kill container.
# xargs: `/dev/null': No such file or directory
# Failed to connect to bus: No such file or directory

<do commands>

exit

# logout
# Container squashfs-root exited successfully

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: [SOLVED] chroot which is better? A=systemd-nspawn

Post#6 by brokenman » 27 Nov 2015, 02:13

On Nemesis simply unpack the 001-core module to a folder.
Copy your /etc/resolv.conf file into the folder
cd into the folder and type: systemd-nspawn

Now you are inside your chroot (container) in the root folder.
To exit type: logout

Works just like chroot but without having to remember all the commands.
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: [SOLVED] chroot which is better? A=systemd-nspawn

Post#7 by aus9 » 26 Jan 2016, 23:31

I am not sure systemd-nspawn is available now we have moved to openrc

Code: Select all

sudo pacman -S systemd-nspawn
error: target not found: systemd-nspawn

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: [SOLVED] chroot which is better? A=systemd-nspawn

Post#8 by brokenman » 26 Jan 2016, 23:46

Correct. Systemd is not available on Nemesis v3.4+.
I have a script I use called newroot instead. I may have left it in /usr/local.
How do i become super user?
Wear your underpants on the outside and put on a cape.

aus9

Re: [SOLVED] chroot which is better? A=systemd-nspawn

Post#9 by aus9 » 26 Jan 2016, 23:57

great its in the 001-core
/usr/local/sbin/newroot

Post Reply