Chroot Tool from another OS (Advanced Users Only, Use at your own risk)

Post links to your 64bit module repos here. Repo maintainers are responsible for resolving any issues caused by their xzm's.
Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Chroot Tool from another OS (Advanced Users Only, Use at your own risk)

Post#1 by Testuser » 08 Nov 2022, 15:26

Find this Chroot tool from another OS very helpful.

Might help someone. :)

https://www.mediafire.com/file/bul5n5ik ... r.xzm/file
Last edited by Testuser on 10 Nov 2022, 17:21, edited 3 times in total.

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Chroot Tool from another OS

Post#2 by Testuser » 08 Nov 2022, 18:25

This helps in running apps and tools from other linux OS installed in another partition of our HDD (runs in Porteus). Helpded so much in creating xzm from another OS :good:

beny
Full of knowledge
Full of knowledge
Posts: 2092
Joined: 02 Jan 2011, 11:33
Location: italy

Chroot Tool from another OS

Post#3 by beny » 09 Nov 2022, 10:52

well if you use mksquashfs you can make all the packages you need without chroot and into all the systems that have squashfs software,i use chroot for upgrade packages into an img or when i have trouble with a bootloader,but thanks for the package.

gnintilgyes
Black ninja
Black ninja
Posts: 73
Joined: 14 Sep 2022, 17:52
Distribution: Debian

Chroot Tool from another OS

Post#4 by gnintilgyes » 09 Nov 2022, 17:32

This is just going to cause trouble. This should be categorized "for advanced users only." I think the OP should have written a disclaimer as part of his (her) first post.

How many people have complained "it refused to boot suddenly" or alike? Because they do weak junk like using "chroot helper" like this, and then "virtual box" becomes more attractive although it's not completely satisfactory. OTOH it might be why Arch is so popular, the "arch-root" is an egotistical name...

-> Oh well the one who is speaking here has never done a "chroot" yet, might do it for the first time ever while checking out Arch on my laptop not main one...

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Chroot Tool from another OS

Post#5 by Rava » 10 Nov 2022, 04:35

gnintilgyes wrote:
09 Nov 2022, 17:32
This is just going to cause trouble. This should be categorized "for advanced users only."
It could lead to trouble, but that is the case with some other programs as well. e.g. rm itself when used wrong can be disastrous.

But since it is script

Code: Select all

root@porteus:/Porteus_modules/Chroot-Rescue-MXBoot-Repair# file usr/local/bin/chroot-rescue*
usr/local/bin/chroot-rescue:        Bourne-Again shell script, ASCII text executable
usr/local/bin/chroot-rescue-scan:   Bourne-Again shell script, ASCII text executable
usr/local/bin/chroot-rescue-select: symbolic link to chroot-rescue-scan
one can look into its workings … like I currently do.
It is quite complex though… and for now I do agree with gnintilgyes , chroot-rescue looks like it is not a tool to be used lightly since using it wrong could damage a system.

Compared to what the module has in its usr/local/bin/ its usr/bin/ischroot and usr/bin/mx-boot-repair are both binaries.

And then there is this
usr/local/lib/cli-shell-utils/cli-shell-utils.bash

Code: Select all

#==============================================================================
# cli-shell-utils.bash
# An integrated collection of utilites for shell scripting.
# The .bash version uses $"..." for translation and another bashism in cmd().
#
# (C) 2016 -- 2019 Paul Banham <antiX@operamail.com>
# License: GPLv3 or later
#
# Note regarding reading command-line arguments and options:
#
# This is the oldest part of the code base.  Thie idea is to make it easy for
# programs that use this library to provide an easy, intuitive, and clear
# command line user interface.
#
#   SHORT_STACK               variable, list of single chars that stack
#   fatal(msg)                routine,  fatal([errnum] [errlabel] "error message")
#   takes_param(arg)          routine,  true if arg takes a value
#   eval_argument(arg, [val]) routine,  do whatever you want with $arg and $val
#==============================================================================
:magic:
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2092
Joined: 02 Jan 2011, 11:33
Location: italy

Chroot Tool from another OS

Post#6 by beny » 10 Nov 2022, 13:53

well i think that aufs system that is read only it have some trouble to run a chroot but in arch system in rw way you can use this:
cd /mnt/beny/
sudo mount -t proc /proc proc/
sudo mount --rbind /sys sys/
sudo mount --rbind /dev dev/
sudo chroot /mnt/beny /bin/bash
chroot work if you have the root account and only if you know where you have to modify system, like bootloader failure or upgrade the kernel....
ok this is for slackware system:
mount -o bind /proc /mnt/beny/proc
mount -o bind /sys /mnt/beny/sys
mount -o bind /dev /mnt/beny/dev
mount -o bind /tmp /mnt/beny/tmp
mount --bind /etc/resolv.conf /mnt/beny/etc/resolv.conf
chroot /mnt/beny /bin/bash -l

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Chroot Tool from another OS

Post#7 by Testuser » 10 Nov 2022, 17:19

I agree Chroot is a dangerous thing, but since it is not a GUI tool, I do not think a novice would damange their system with this cli tool. :)

Anyway, renaming post as for Advanced users.
beny wrote:
09 Nov 2022, 10:52
well if you use mksquashfs you can make all the packages you need without chroot and into all the systems that have squashfs software,
Beny, Thanks for the info. How can we do that. Any posts or link for that info in detail ? :)

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Chroot Tool from another OS (For Advanced Users Only, Use at your own risk)

Post#8 by Rava » 10 Nov 2022, 17:32

Testuser , I cannot tell you what beny can, but I could tell you how to use removepkg and installpkg on a certain folder, e.g. you extracted a module into that folder but want to remove program(s) from it and/or want to add other programs to that folder.

But probably you already know how that is done, if not tell me and I will tell you. :)
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2092
Joined: 02 Jan 2011, 11:33
Location: italy

Chroot Tool from another OS (For Advanced Users Only, Use at your own risk)

Post#9 by beny » 10 Nov 2022, 17:50

hi testuser if you have to change something into a package.xzm or if you have to build a package in the slackware way you have to unsquashfs the package into a directory change what you need and repack with mksquashfs name of the new package this is for all the distro that have squashfs you don't need to do this task in porteus, and for the slackware way is the same you have to build a source code when the build is complete you have to install in a fake directory in tmp like this:make install DESTDIR=/tmp/build cd into the directory, for slackware package build, you have to use this:
makepkg -l y -c n ../app-version-arch-tag.tgz and for the porteus as above the package.xzm isn't stripped so maybe is too heavy, slackware package you can make it only into a slackware system,but now with all the salix and salix extra or slakfinder and other repositories we have all the software ready to use for porteus5

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Chroot Tool from another OS (For Advanced Users Only, Use at your own risk)

Post#10 by Rava » 10 Nov 2022, 18:36

Here is my own how to alter an existing module.

Extract the module you want to alter into a new empty folder. Cave! Folder needs to be on a Linux filesystem.

cd into that folder on the Linux filesystem
mkdir the target folder
dir2xzm the module into the target folder

let's presume your Linux filesystem base folder be /mnt/sdb2/tmp
your created folder in that be my-test-module

Code: Select all

cd /mnt/sdb2/tmp
mkdir my-test-module
xzm2dir /path/to/module.xzm my-test-module
remove package:

Code: Select all

ROOT=my-test-module removepkg package-name
The package name is the name only, e.g. when you want to remove celluloid you type

Code: Select all

ROOT=my-test-module removepkg celluloid
and not
ROOT=my-test-module removepkg celluloid-0.21
and also not
ROOT=my-test-module removepkg celluloid-0.21-x86_64

Add packages the same way, either by again doing a xzm2dir into the same target folder when you have the program as module, or when you have it as package do it this way:

Code: Select all

ROOT=my-test-module installpkg WHATEVER.txz
Sometimes files remain that are put into a module but have not been part of the original package, so removepkg doesn't know about these and thus will not remove these.

You can do the following finding these files:

Cave! we move into my-test-module first - thus the reference of the "." path means the current folder, which now is /mnt/sdb2/tmp/my-test-module :

Code: Select all

cd my-test-module
and then find files and folders that are named after a package you want deleted completely, let's stick with the above example or removing celluloid:

Code: Select all

find . -name '*celluloid*' -exec ls -lo {} \;
When you are satisfied which what the ls -lo {} tells you, you do the actual delete with this line:

Code: Select all

find . -name '*celluloid*' -exec rm -vf {} \;
After removing what you want removed and adding what you want added, do this:

Code: Select all

cd /mnt/sdb2/tmp
dir2xzm my-test-module my-test-module.xzm
then activate and thus test your my-test-module.xzm

HTH!
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2092
Joined: 02 Jan 2011, 11:33
Location: italy

Chroot Tool from another OS (For Advanced Users Only, Use at your own risk)

Post#11 by beny » 10 Nov 2022, 19:01

when i have to repack a module into a directory do not cd into it but mksquashfs the whole directory dir2xzm is for porteus only i can't use outside i have used now for the file:///mnt/sdg1/porteus/modules/exail/db-5.3.28-5-x86_64.xzm that have a different location of libs

Code: Select all

  mksquashfs /root/db-5.3.28-5 /root/db-5.3.28-5-x86_64.xzm
Parallel mksquashfs: Using 6 processors
Creating 4.0 filesystem on /root/db-5.3.28-5-x86_64.xzm, block size 131072.
[============================================================-] 77/77 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 131072
        compressed data, compressed metadata, compressed fragments,
        compressed xattrs, compressed ids
        duplicates are removed
Filesystem size 2359.16 Kbytes (2.30 Mbytes)
        35.93% of uncompressed filesystem size (6565.83 Kbytes)
Inode table size 602 bytes (0.59 Kbytes)
        33.56% of uncompressed inode table size (1794 bytes)
Directory table size 602 bytes (0.59 Kbytes)
        59.78% of uncompressed directory table size (1007 bytes)
Number of duplicate files found 0
Number of inodes 49
Number of files 34
Number of fragments 8
Number of symbolic links 6
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 9
Number of hard-links 0
Number of ids (unique uids + gids) 1
Number of uids 1
        root (0)
Number of gids 1
        root (0)
root@porteus:~# 
                                                                                     

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Chroot Tool from another OS (For Advanced Users Only, Use at your own risk)

Post#12 by Testuser » 11 Nov 2022, 12:33

Beny, thanks for that info of squashfs with other Distros, I will try that.

Thanks Rava for your instructions of removing packages from large xzm, will make a note of that.
:)

beny
Full of knowledge
Full of knowledge
Posts: 2092
Joined: 02 Jan 2011, 11:33
Location: italy

Chroot Tool from another OS (For Advanced Users Only, Use at your own risk)

Post#13 by beny » 11 Nov 2022, 13:26

hi testuser, supposing you have to upgrade a package inside extra package you have to unsquashfs it and rename 002-extra,the Rava advice is right ROOT=/dev/sdx/002-extra upgradepkg --install-new and you packages name you can upgrade and install a new packages into the 002-extra directory when you are ready well i use this....mksquashfs 002-extra 002-extra.xzm, btw do not mix package from slackware 15 and current,and getmod work with merge option to download and build software pmod if i remember well not, download package one by one,but is ok now porteus is complete and very powerfull.

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Chroot Tool from another OS (Advanced Users Only, Use at your own risk)

Post#14 by Testuser » 14 Nov 2022, 17:15

Sure Beny, noted :)

Post Reply