Page 1 of 1

Run the very latest apps on old Puppies - pup_chroot

Posted: Sun 01 Jun 2014, 10:35
by ac2011
This might well only be of interest to me, but I've been playing around with getting newer apps to run in older Puppies. Mainly because I have Fluppy and Carolina which I've spent quite a long time setting up, and I don't necessarily want to go through the hassle of setting everything up again just for the occasional app that needs a newer GLIBCXX_whatever.

So I downloaded the Precise ISO, opened it, did an unsquashfs to unpack the main SFS file. Then went into that directory and set up some mount -o bind points to /sys /proc /dev /tmp /var and maybe some others, I forget now. [edit: just /dev /sys and /proc seems to suffice]

then did chroot /path/to/precise /usr/local/bin/rox

That got me into rox, though all the icons are broken (red triangles). Haven't worked that out yet, but it doesn't really matter, because it was enough to allow me to install Chrome 37 from a PET on this site, and then run it. I had to move some libs out of /usr/lib/seamonkey into /usr/lib first, but it works, as this screenshot shows.

So I'm running Flash 14, which is nice.

I had to tweak a few other things. Had to temporarily disable wireless in Fluppy and then run the connect wizard in Precise to get it online. Which makes sense, I suppose - can't share the same piece of hardware (or can you? I'll think some more about that).

I'm posting this from Chrome 37 in the chroot, on a laptop that's booted into Fluppy.

Also worked with newer Minetest 0.4.6, Gnumeric, Abiword and that's about all I've tested.

As I said, probably only of interest to me... but it's nice that I can potentially run newer apps without actually configuring everything anew when what I already have works perfectly in every other respect.

Obviously, don't do this on your main system or main save file. It's experimental and may break your computer, your data or the universe.

If anyone's interested, reply to this and I'll do my best to go through the steps in greater detail.

Edit: I have both the chrooted Seamonkey and the native Firefox running simultaneously and using the same wireless adapter for internet access. So the only remaining quirk seems to be broken icons, possibly GTK-related. Some programs complain about failure to handle .png files. But the programs I want to run seem to work fine.

Posted: Sun 01 Jun 2014, 13:52
by ac2011
A script I've just knocked together to make it easier to run apps in, say, Precise Puppy, while booted in a different Puppy.

Code: Select all

#!/bin/sh

# set this to where Precise has been extracted from its SFS, no trailing slash, e.g. "/mnt/sda2/precise"
PRECISE_LOCATION="/mnt/sda2/precise"

ALLDIRS=(root dev etc proc sys tmp var lib/modules lib/firmware lib/consolefonts lib/keymaps usr/lib/gtk-2.0 usr/share/themes)

for i in "${ALLDIRS[@]}"
	do
	[[ ! -d "$PRECISE_LOCATION/$i" ]] && mkdir "$PRECISE_LOCATION/$i"
	mount -o bind "/$i" "$PRECISE_LOCATION/$i"
done

# run the application
chroot $PRECISE_LOCATION "$@"

# these may fail if network adapter or other device has been used
for i in "${ALLDIRS[@]}"
	do
	umount "$PRECISE_LOCATION/$i"
done
Again, it works for me, might destroy your world. Use with care.

Edit: script improved to handle gtk-2.0 icons/images better. Again, YMMV.
Edit again: sharing root and themes should make apps look the same as in your native Puppy.

For applications that return to console quickly, some kind of PID watcher would be good to avoid umounting before it's finished. I'll look into that.

Posted: Sun 01 Jun 2014, 18:39
by watchdog
If you full install precise to a partition of internal hd, say sda2, and you run the following commands in your puppy:

Code: Select all

mkdir /mnt/dir
mount /dev/sda2 /mnt/dir
mount --bind /dev /mnt/dir/dev
mount --bind /proc /mnt/dir/proc
mount --bind /sys /mnt/dir/sys
chroot /mnt/dir
exec ...
exit
umount /mnt/dir/dev
umount /mnt/dir/proc
umount /mnt/dir/sys
umount /mnt/dir
you should do the trick to run a precise application. I have not tested it but the commands are the same of the thread about ubuntu's grub2 mbr repair:

http://www.murga-linux.com/puppy/viewtopic.php?t=85978

But why do not boot a precise usb stick?

Posted: Sun 01 Jun 2014, 21:05
by ac2011
Main reason for not booting a USB stick is it's faster/easier to integrate newer apps this way. I can just use my script - create a new icon on my desktop and then launch something like Chrome straight away. It appears as though it's part of my system, same look and feel, etc. Plus there's no need to configure anything.

Updated script below. This one doesn't automatically umount the bound directories, in case of concurrent access by different apps. Could/should probably create a separate script for that, to specifically umount to make the directory 'safe'.

I remember my old Nokia N810 had a chrooted full Debian install available, set up by a guy called qole. I might try to dig out the scripts for that.

Code: Select all

#!/bin/sh

# Small bit of cunning to run much newer Puppy apps in much older Puppies, using just the files extracted from the newer Puppy's SFS
# I've used Precise throughout, but you could use others.

# Alex, 2014

# At time of writing I haven't worked out the issue with some apps that use images failing to load, but as later Minetest and Google Chrome
# work, which were the main requirements for me, I'm not hugely concerned. I think it's a GtK issue.

# This assumes you've done something like mounted the Precise ISO in Fluppy, then do:
#
# unsquashfs /mnt/+mnt+sda2+precise-5.7.1.iso/puppy_precise_5.7.1.sfs
# mv squashfs-root precise
#
# You may need updated squashfs tools for older Puppies - I took them from Carolina to use in Fluppy.

# set this to where Precise SFS has been extracted, no trailing slash, e.g. "/mnt/sda2/precise"
PRECISE_LOCATION="/mnt/sda2/precise"

# list of directories to share with the host system. Do this sensibly and change/add more based on errors from apps that are run
ALLDIRS=(root dev etc proc sys tmp var lib/modules lib/firmware lib/consolefonts lib/keymaps usr/lib/gtk-2.0 usr/share/themes usr/share/fonts)

if [[ ! "$@" ]]
	then
	echo "Use this to run a chrooted app, with e.g. /usr/bin/seamonkey"
	exit
fi

for i in "${ALLDIRS[@]}"
	do
	if 	[[ ! `mount |grep "$PRECISE_LOCATION/$i "` ]]
		then
		[[ ! -d "$PRECISE_LOCATION/$i" ]] && mkdir "$PRECISE_LOCATION/$i"
		mount -o bind "/$i" "$PRECISE_LOCATION/$i"
	fi
done

# run the application
chroot $PRECISE_LOCATION "$@"

echo -e "\nRemember, the chroot remains mounted. Do NOT delete or\nmess about with $PRECISE_LOCATION until after a reboot.\n"

exit
# below here should probably be in its own script, to close the chroot safely


# could umount afterwards, but it's probably better to have a separate script to do that in case of concurrent access.
# However, should maybe warn the user to be careful not to delete anything that's mounted.

# these may fail if any chrooted apps are still open
for i in "${ALLDIRS[@]}"
	do
	umount "$PRECISE_LOCATION/$i"
done

Posted: Sun 01 Jun 2014, 21:46
by watchdog
I tested on my own and report here. The main problem is that puppy can't be full installed in a usb stick. So I formatted ext3 a usb stick and from a live of wary 5.3 copied to the usb stick the bin, etc, lib, opt, root, sbin, usr and var dirs. Then:

Code: Select all

mkdir /mnt/sdb1/dev
mkdir /mnt/sdb1/proc
mkdir /mnt/sdb1/sys
mkdir /mnt/sdb1/tmp
mkdir /mnt/sdb1/mnt
Then booted a live of puppy 4.3.2 and tried:

Code: Select all

mkdir /mnt/dir
mount /dev/sdb1 /mnt/dir
mount --bind /dev /mnt/dir/dev
mount --bind /proc /mnt/dir/proc
mount --bind /sys /mnt/dir/sys
chroot /mnt/dir
abiword
exit
umount /mnt/dir/dev
umount /mnt/dir/proc
umount /mnt/dir/sys
umount /mnt/dir
It did the trick. I attach pic. The same procedure did not work in a live of slacko 5.7: displaying problems.

Posted: Sun 01 Jun 2014, 22:00
by ac2011
What are the errors you see? I saw loads of GtK errors which stopped some apps loading, especially those with xpm or png files in their interface. Then found this:

https://www.linuxquestions.org/question ... me-152870/

So doing this might fix the GtK issues, though might also modify the host system in unwanted ways, since /etc is also the real /etc at this point. So use with caution:

[chroot_script_name] /bin/bash
/usr/bin/gtk-query-immodules-2.0 >/etc/gtk-2.0/gtk.immodules
/usr/bin/gdk-pixbuf-query-loaders >/etc/gtk-2.0/gdk-pixbuf.loaders
/usr/bin/gdk-pixbuf-query-loaders >/usr/lib/i386-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
exit

That worked for me with Precise, so even rox works with no broken icons. No errors at all now. Bear in mind I've never even booted into Precise: this is just using the files extracted from the SFS.

simultaneous roxes

Posted: Sun 01 Jun 2014, 22:10
by ac2011
Two instances of Rox filer - one in Fluppy, one in Precise, both running in the Fluppy desktop.

a walkthrough

Posted: Mon 02 Jun 2014, 00:02
by ac2011
Here's my attempt at a step-by-step guide, though this is mostly from memory. Let's say you're running an old, Wary-based Puppy and you want to run Chrome 37 with Pepper Flash 14. Previously, not an option. But here's what to do.

0. Do this in a save file you can afford to lose! Always backup your data before trying new stuff like this.

1. Boot into your old Puppy as normal. If you don't already have it, download an ISO for a newer Puppy. I'm using precise-5.7.1.iso because it happened to be on my hard drive.

2. Open the ISO file in rox by clicking or double-clicking on it, depending on how your system is set up. It should mount and show you the contents.

3. Mount whatever hard drive partition has enough free space (about 500MB expanded for Precise, though that could be reduced later) by clicking on its drive icon. Let's say that's /mnt/sda2.

4. Open a terminal window and type this:

cd /mnt/sda2
unsquashfs /mnt/+mnt+sda5+precise-5.7.1.iso/puppy_precise_5.7.1.sfs

(Change the paths/names above for different versions of Puppy. If this fails then your Puppy's squashfs tools might be too old. Extract the ones in the attachment here and put them in /usr/sbin and then re-try.)

mv squashfs-root/ precise

5. Click or double-click on the ISO again to unmount it.

6. Copy the contents of my script above (the improved one) into a text editor, save it as /usr/local/bin/run_precise.sh and then type this:

chmod +x /usr/local/bin/run_precise.sh
/usr/local/bin/run_precise.sh /usr/bin/gnumeric

If this works, you'll see the gnumeric from Precise appear in your ancient Puppy's desktop.

7. Try some more programs. Some will throw GtK errors. See my solution in an earlier post.

8. Copy the Chrome 37 PET and any other dependencies into /root, then do this:

/usr/local/bin/run_precise.sh /usr/local/bin/rox

(it'll have red triangle icons unless you've done my GtK fix above)

Navigate to /root and double-click on the PET. It should install. When it's finished, close rox.

9. Chrome needs a little extra help to find libs, so do this:

/usr/local/bin/run_precise.sh /bin/bash
ln -s /usr/lib/seamonkey/lib* /usr/lib/
exit

10. Then run it...

/usr/local/bin/run_precise.sh /usr/bin/google-chrome-unstable

Chrome should appear and work fine with Pepper Flash 14.

This is still largely untested, but is working for me.

Note that I've shared /root and some other paths which means the application should share your GtK theme, icons and so on. But it also means that if you install new packages in Precise they may appear in your main Puppy's PPM too, which could be confusing. If you don't want it to happen, edit the script to remove root from the directory sharing section. You could just copy the relevant stuff from /root into the chroot root instead.

Always REBOOT before touching the chrooted system from outside (unless you know your way around umount). If you delete it while the directories are mounted, you run the risk of deleting important files from your *main* system too.

Hope this helps. Written in haste, so let me know if I've missed anything.

New improved script

Posted: Mon 02 Jun 2014, 05:04
by ac2011
New version of the script, with chroot umount included.

Code: Select all

#!/bin/sh

# Small bit of cunning to run much newer Puppy apps in much older Puppies, using just the files extracted from the newer Puppy's SFS
# I've used Precise throughout, but you could use others.

# Alex, 2014

# This assumes you've done something like mounted the Precise ISO in Fluppy, then done:
#
# cd /mnt/sda2
# unsquashfs /mnt/+mnt+sda2+precise-5.7.1.iso/puppy_precise_5.7.1.sfs
# mv squashfs-root/ precise
#
# You may need updated squashfs tools for older Puppies - I took them from Carolina to use in Fluppy.
#
# You could then manually delete the contents of any of the sub-directories that we'll be mounting on top of, but
# ONLY if the chroot isn't mounted, otherwise you'll delete the contents of the real system directories instead!

# set this to where Precise SFS has been extracted, no trailing slash, e.g. "/mnt/sda2/precise"
PRECISE_LOCATION="/mnt/sda2/precise"

# list of directories to share with the host system. Do this sensibly and change/add more based on errors from apps that are run.
# Note that if root is included, any apps installed in the chroot may also show up in the host system's PPM... there may be other issues too.
ALLDIRS=(root dev etc proc sys tmp var lib/modules lib/firmware lib/consolefonts lib/keymaps usr/lib/gtk-2.0 usr/share/themes usr/share/fonts)

# set this to 1 if you want to update the various GTK elements in /etc so that images and icons work properly (without it, you'll get red triangles
# in rox and most/all GTK apps will complain or fail). BUT as etc is mounted on the real /etc this *might* cause unwelcome effects in the host
# system, so use with care.
UPDATE_GTK=0

if [[ ! -d $PRECISE_LOCATION ]]
	then
	echo "Can't find the chroot. Read the script for info."
	exit
fi

if [[ ! "$@" ]]
	then
	echo -e "Use this to run a chrooted app, with e.g. /usr/bin/seamonkey\nOr call with -unmount_chroot as first argument to attempt dismount."
	exit
fi

unmount_chroot() {

	# unmount everything
	echo -e "\nAttempting to remove all mount-points from the chroot...\n"

	# these may fail if any chrooted apps are still open
	for i in "${ALLDIRS[@]}"
		do
		if 	[[ `mount |grep " $PRECISE_LOCATION/$i "` ]]
			then
			umount " $PRECISE_LOCATION/$i "
			if 	[[ `mount |grep " $PRECISE_LOCATION/$i "` ]]
				then
				not_unmounted="$not_unmounted\n$PRECISE_LOCATION/$i"
			fi
		fi
	done

	if [[ $not_unmounted ]]
		then
		echo -e "Problem! Couldn't unmount the following:\n\n$not_unmounted\n\nMaybe try again.\n"
		exit 1
	else
		echo -e "All mount points appear to have been successfully removed.\n$PRECISE_LOCATION is probably clean now, but be careful.\nA reboot is probably wise anyway.\n"
		exit 0
	fi
}

# are we unmounting?
if [[ "$1" == "-unmount_chroot" ]]
	then
	unmount_chroot
	exit
fi

echo -e "\nAttempting to run the chrooted application...\n"

# mount the important directories
for i in "${ALLDIRS[@]}"
	do
	if 	[[ ! `mount |grep " $PRECISE_LOCATION/$i "` ]]
		then
		[[ ! -d "$PRECISE_LOCATION/$i" ]] && mkdir "$PRECISE_LOCATION/$i"
		mount -o bind "/$i" "$PRECISE_LOCATION/$i"
	fi
done

if [[ $UPDATE_GTK ]]
	then
	# doing this once the host is loaded should fix the GtK/image errors, though might also modify the host system in unwanted ways, because
	# etc is probably mounted from /etc (see above). Taken from here: https://www.linuxquestions.org/questions/linux-software-2/gtk-errors-about-not-recognizing-png-after-yum-groupupdate-to-dev-version-of-gnome-152870/
	/usr/bin/gtk-query-immodules-2.0 >$PRECISE_LOCATION/etc/gtk-2.0/gtk.immodules 
	/usr/bin/gdk-pixbuf-query-loaders >$PRECISE_LOCATION/etc/gtk-2.0/gdk-pixbuf.loaders
	/usr/bin/gdk-pixbuf-query-loaders >$PRECISE_LOCATION/usr/lib/i386-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
fi

# run the application
chroot $PRECISE_LOCATION "$@"

# Warn the user...
echo -e "\nRemember, the chroot remains mounted. Do NOT delete or\nmess about with $PRECISE_LOCATION until after a reboot,\nunless you run this script with the -unmount_chroot argument.\n"

Posted: Mon 02 Jun 2014, 07:54
by watchdog
ac2011 wrote:What are the errors you see?
In slacko it is a little different. I found the way. For general information about chroot read for example:

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

In slacko worked:

Code: Select all

mkdir /mnt/dir
mount /dev/sdb1 /mnt/dir
mount --bind /dev /mnt/dir/dev
mount --bind /proc /mnt/dir/proc
mount --bind /sys /mnt/dir/sys
xhost +
mkdir /mnt/dir/tmp/.X11-unix
mount --bind /tmp/.X11-unix /mnt/dir/tmp/.X11-unix
chroot /mnt/dir
abiword
exit
umount /mnt/dir/dev
umount /mnt/dir/proc
umount /mnt/dir/sys
umount /mnt/dir/tmp/.X11-unix
umount /mnt/dir

Posted: Mon 02 Jun 2014, 08:57
by ac2011
watchdog wrote:
ac2011 wrote:What are the errors you see?
In slacko it is a little different. I found the way. For general information about chroot read for example:

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

In slacko worked:

Code: Select all

mkdir /mnt/dir
mount /dev/sdb1 /mnt/dir
mount --bind /dev /mnt/dir/dev
mount --bind /proc /mnt/dir/proc
mount --bind /sys /mnt/dir/sys
xhost +
mkdir /mnt/dir/tmp/.X11-unix
mount --bind /tmp/.X11-unix /mnt/dir/tmp/.X11-unix
chroot /mnt/dir
abiword
exit
umount /mnt/dir/dev
umount /mnt/dir/proc
umount /mnt/dir/sys
umount /mnt/dir/tmp/.X11-unix
umount /mnt/dir
Thanks, that's interesting. I've not come across xhost before.

By the way, you might find it easier to call the chroot with

Code: Select all

chroot /mnt/dir /usr/bin/abiword
instead of doing them on separate lines. The way you're calling it requires the system to load the chrooted bash (or equivalent) first, which increases the dependencies. Not a big issue, but another potential hurdle compared to just running the program you want to launch.

If enough people want it I might start putting together a general purpose script for running various different versions of Puppy all from within the environment of a single, older (or newer?) Puppy.

For me, extracting the contents of an SFS file to a directory is a lot less hassle than booting into a new distro and changing configurations, etc.

Why not have access to the latest Slacko and Precise programs from within your tried-and-trusted Lucid setup, for example...? No reboots, no multiple save files or reconfigurations. Just the Puppy you already know and love with some new shiny extras (and a bit less free disk space). Just a simple script and off you go.

Or, again, this might only be useful for me. In which case this thread is a good place to keep my notes. ;-)

Reply here anyone who wants to see this developed more.

Posted: Wed 04 Jun 2014, 18:06
by sc0ttman
yeah this is an interesting thread... i like the idea .. i run old pups myself... i wanted to run some stuff from a recent ubuntu based pup (or at aleast test it), so this is a good way...

a complete, final script would be great.. one that works from most pups, old and new ... maybe a mix of the two approaches above?

Posted: Wed 04 Jun 2014, 20:21
by ac2011
sc0ttman wrote:yeah this is an interesting thread... i like the idea .. i run old pups myself... i wanted to run some stuff from a recent ubuntu based pup (or at aleast test it), so this is a good way...

a complete, final script would be great.. one that works from most pups, old and new ... maybe a mix of the two approaches above?
OK - I've been working on this for my own purposes anyway. Attached is a newer version of what I'm calling 'pup_chroot' for now.

This one is different: it mounts the 'guest' Puppy's main SFS in the unionfs filesystem, which means that when it's unmounted, any changes are stored within your normal save file. I've removed the mount link to root as it was causing too many complications, but this way it has persistence.

On my system I've also archived the changes so I can take them out of my save file when not needed, but that might be an extra layer of complication, so leave $PERSISTENT_ARCHIVE empty if you don't want that (and if you don't have 7za installed).

This means that all you need is the main SFS and you can run applications compiled for that Puppy. If you're running an older Puppy you will need the updated squashfs tools (see earlier post) to unpack the SFS and then repack it in a gzip format your older Puppy will understand, but still it means you can run Precise apps with just a 180MB SFS file.

There are limitations (read the script) and it won't magically give you super OpenGL performance if your main Puppy doesn't have it, for example, but for running apps from newer Puppies it's great. I created a chrome.desktop file that calls my script with /usr/bin/google-chrome-unstable so it appears in my Internet menu and works fine.

I'd appreciate testing, bug reports, etc. I've only tried this with Precise so far, so let me know how you get on with others. I'll try to update it if I get enough feedback.

This uses Shinobar's sfs_load script, available elsewhere on this forum. If that causes problems in older Puppies, you could just mount the SFS permanently and remove those parts of the script.

Read the script before use! And please, only test with a save file you can afford to wipe. I haven't lost anything yet, but there's potential for things to go wrong.

Posted: Thu 05 Jun 2014, 13:04
by watchdog
I focused on how to run in wary 5.3 the latest firefox without glibc upgrade using a chroot to a precise 5.7.1 with latest firefox installed. I have not skills in scripting but I wrote a simple bash script working in a live of wary 5.3. Boot precise and install firefox. Copy bin, etc, lib, opt, root, sbin, usr and var dirs to an ext3 formatted usb-stick (but you can also use a dir in /mnt/home or sda1 if you are in a live). Then create dev, proc, sys, tmp, tmp/.X11-unix, mnt dirs into the usb stick. Now boot a live of wary 5.3 and run the following script with the sdb1 usb stick inserted:

Code: Select all

#!/bin/sh
export LC_ALL=C
mkdir /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1
mount --bind /dev /mnt/sdb1/dev
mount --bind /proc /mnt/sdb1/proc
mount --bind /sys /mnt/sdb1/sys
xhost +
mount --bind /tmp/.X11-unix /mnt/sdb1/tmp/.X11-unix
chroot /mnt/sdb1 /usr/bin/firefox
umount /mnt/sdb1/proc
umount /mnt/sdb1/sys
umount /mnt/sdb1/tmp/.X11-unix
killall dbus-launch
sleep 10
umount /mnt/sdb1/dev
umount /mnt/sdb1
xhost -
As you can see I had trouble unmounting the usb stick after using the precise's firefox. /mnt/sdb1/dev could not be unmounted: killing the dbus-launch process did the trick. It works but for usual use I'll prefer the glibc upgrade way. Chroot method can be developed by the guys who want experimenting this way.

Posted: Sat 28 Jun 2014, 16:09
by heywoodj
Well this is interesting. By following the instructions, I am now running Precise 5.7.1 apps from a cheat frugal Slacko 5.3.1, including connecting using PupDial(yes, dial-up ) from Precise.

Do you think Wine could be run this way? The reason I ask is that I've been running an older Windows version of Firefox through Wine so as to be able to watch Netflix (http://www.murga-linux.com/puppy/viewtopic.php?t=93969), but there was interest in booting from removable media (USB/SD card) to accomplish the same thing.

The catch seems to be Wine needs to run in an ext4 partition to be able to get the components to be happy to watch Netflix, and at least in USB flash drives, ext4 won't boot.

So I was thinking booting in a ext2 or 3 partition on the flash drive, and have all the Wine stuff on a ext4, and using your method of chrooting to access and run Wine (and Firefox, etc).

I could see the potential problem of accidentally unmounting the chrooted filesystem. Any ways to circumvent that problem?

Posted: Sat 28 Jun 2014, 20:20
by ac2011
Interesting. I'd say give it a try. I can't think of any reason why Wine shouldn't work as it's pretty well behaved.

As for accidentally unmounting the filesystem, if I try to unmount a drive that's being used, Puppy throws up an error offering to kill the active processes that are using it, so that's probably good protection.