Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 26 Sep 2017, 03:33
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects
The debootstrapDebian within Puppy project
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 4 [53 Posts]   Goto page: 1, 2, 3, 4 Next
Author Message
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Thu 03 Aug 2017, 23:19    Post subject:  The debootstrapDebian within Puppy project  

Fred of DebianDog has recently started a project to script build a Stretch DebianDog on top of a base debootstrap build:

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

Using the method described in this debootstrapDebian first post you can also use the applications in Fred's build as described in link below:

http://www.murga-linux.com/puppy/viewtopic.php?p=964356#964356

You can use the same technique to chroot into a new woof-CE build for testing it from its host build system (or any other Linux):

http://www.murga-linux.com/puppy/viewtopic.php?p=966512#966512

8Aug2017: By the way, there is also arch-bootstrap, pacstrap, arch-chroot, and similar tools/methods for Arch Linux installs within another Linux such as Puppy. And a Python program for several distribution installs (image-bootstrap). I've also come across archstrap (via google):

http://www.murga-linux.com/puppy/viewtopic.php?p=963658#963658

James B of murga Puppy forum has also usefully provided how to run one OS inside another using a chroot:

http://www.lightofdawn.org/wiki/wiki.cgi/RunSlackoInFatdog

I recognised, however, that the official Debian debootstrap program/script can be used directly on Puppy Linux systems without needing to use it to thereafter build a DebianDog. I therefore decided to open this more general purpose project thread, since Debian's debootstrap build system has nothing to do with DebianDog per se, but is provided by Debian to be used on pretty much any Linux system including Puppy itself.

What does Debian's debootstrap provide? It gives a method of building a base Debian (or Ubuntu) system (such as Stretch) within a folder on your running Puppy Linux or other Linux system (debootstrap is just a set of shell scripts whose only real dependency is wget). You don't need to build a DebianDog out of it (though you could modify Fred's mklive-stretch project script to do this if you wish - but that's an independent script which isn't needed here). Rather, the provided debootstrap is pure Debian; it's just debootstrap as provided straight from Debian afterall but attached here as a dotpet for Puppy use.

This thread is started with a view to that versatility of possibility since Puppy forum members may find alternative ways to build upon this official Debian-provided debootstrap facility.


How to use the provided debootstrap system:

EDIT 6Aug2017: Got Debian Stretch built and chroot running under Puppy Racy 5.5 (Racy kernel 3.0.66) now. I'll post image soon. I'll also try Puppy 4.3.1 since old kernel, but I have my doubts...! Note that to get a clean build under Racy (or Puppy Linux 4.3.1 for that matter, you must first remove /lib: from the LD_LIBRARY_PATH - no such complicated measure is needed for Slacko64 or tiny core linux). Details are given just before step 3 below.

The following example assumes being on a running Puppy Slacko64 ver 6.3.2 system but the method should work on most any recent Puppy. Note that the Puppy system must be already Internet-connected (wifi connection or ethernet will do - I only had a wifi connection on my Slacko64 system).

1. Install the attached debootstrap dotpet.

2. Make a directory on a Linux filesystem somewhere to hold your Debian build. Example is for Stretch (Fred recommends 2GB space in his project so I guess that is appropriate free space requirement here too):

Code:
mkdir -p stretch/chroot


I made the above on my /mnt/home ext4 harddrive partition, but you could use a Linux formatted usb if you preferred.

3. Change directory (cd) into dir stretch. On a few systems, at this stage, you may need to deal with a /lib in LD_LIBRARY_PATH issue that the debootstrap program doesn't like. Check details in this link before proceeding:

http://www.murga-linux.com/puppy/viewtopic.php?p=963323#963323

8Aug2017: Also code to fix from Fred (thanks) here:

http://www.murga-linux.com/puppy/viewtopic.php?p=963500#963500

On Slacko I didn't have that issue, however, and next just run the Debian debootstrap command:

Code:
debootstrap --arch=i386 --variant=minbase stretch chroot http://ftp.us.debian.org/debian/


Alternatively, for Ubuntu target (64-bit Xenial Xerus as example) see here:

http://www.murga-linux.com/puppy/viewtopic.php?p=963369#963369

Wait patiently and your 32-bit i386 Debian base system will then be built. Note that from Slacko64 I found you could alternatively build a 64-bit amd64 Debian base system by using --arch=amd64 in command above instead.

4. You now need to bind mount a few key system resources (you can of course put the following into a script - I just entered the commands manually). These are pretty standard commands for using a chroot, which I copied from Fred's example:

Code:

mount --bind /proc chroot/proc
mount --bind /dev chroot/dev
mount --bind /sys chroot/sys
mount -t devpts devpts chroot/dev/pts
cp /etc/resolv.conf chroot/etc/resolv.conf


or as Peebee suggests (thanks), the following one line alternative is easier for cutting and pasting into a terminal:

Code:
mount --bind /proc chroot/proc && mount --bind /dev chroot/dev && mount --bind /sys chroot/sys && mount -t devpts devpts chroot/dev/pts && cp /etc/resolv.conf chroot/etc/resolv.conf


Example script from jd7654 for starting and stopping you debootstrapDebian created system using above commands:

http://www.murga-linux.com/puppy/viewtopic.php?p=963780#963780

5. Now chroot into your debian filesystem (on your Puppy):

Code:
chroot chroot


6. In case it was needed, at this stage I also set and exported the LC_ALL environment variable using command:

Code:
export LC_ALL=C


7. FInally, to test debian was working (within my Puppy) I tried command:

Code:
apt-get update


and installed a first new application (the file command):

Code:
apt-get install file


You are now running a Debian system within your Puppy! Wink Yes, you can install X apps (I for example tried apt-get install synaptic, which worked fine though a big download...). How you use this system is up to you. Perhaps fork/modify Fred's mklive-stretch script or make your own addon scripts to build Debian-based systems of your own, or simply use debootstrap as above to play with Debian facilities from the comfort of your Puppy! Wink

USEFUL SCRIPT to start/chroot the debootstrapDebianSystem up whilst executing example X application:

Example script from Fred of DebianDog (fredx181) for starting up 'synaptic' once installed can be found in his post here:

http://www.murga-linux.com/puppy/viewtopic.php?p=963304#963304

Example script from jd7654 for starting and stopping you debootstrapDebian created system:

http://www.murga-linux.com/puppy/viewtopic.php?p=963780#963780

8. Cleaning up:

As AndresCS and then Fred mention below, it is important to clean up the bind mounts once you have finished playing with the chroot Debian system.

8a. You can exit out of the terminal you have chroot into using command:

Code:
exit


and then from any terminal you must umount the previous bind mounts by using commands:

8b.

Code:
umount chroot/proc
umount chroot/dev/pts
umount chroot/dev
umount chroot/sys


or as Peebee suggests, the following one line alternative is easier for cutting and pasting into a terminal:

Code:
umount chroot/proc && umount chroot/dev/pts && umount chroot/dev && umount chroot/sys


However, I should say that you don't 'need' to execute the 8b commands until you are ready and want to (just remember to do it when really finished)! If you enter command chroot chroot again (from inside stretch dir) then the previous bind mounts will still be available (and thus working) until such time as you do these 8b umount commands (after which you'd have to redo step 4 onwards to re-use your debootstrap Debian system. Note Fred's comments in post below though just so you are aware.

NOTE: This may or may not be obvious, but you CAN share the same debootstrap built Debian system between other Linuxes. For example, I sometimes boot into Slacko64 or into XenialPup or slitaz or into tiny core linux - I can use the same stretch/chroot debootstrap built Debian on any of them just by doing the same mount --bind commands followed by chroot chroot (or using a simple script to do that...) - you don't need to rebuild the debootstrap Debian system each time, it is always there once built... Smile See linked post below for some extra info about getting X apps to run from the debootstrapDebian when host is not a Pup (i.e. where host user is not 'root'); example in the post is for tiny core linux host where user is usually user tc:

http://www.murga-linux.com/puppy/viewtopic.php?p=963175#963175

wiak
debootstrap_1.0.89.pet
Description  dotpet of DebianStretchStable debootstrap program
pet

 Download 
Filename  debootstrap_1.0.89.pet 
Filesize  28.03 KB 
Downloaded  58 Time(s) 
UbuntuXenialRunningUnderSlacko64.png
 Description   Ubuntu 64bit Xenial running under Puppy Slacko64
 Filesize   96.96 KB
 Viewed   626 Time(s)

UbuntuXenialRunningUnderSlacko64.png

debootstrapDebianWheezyUnderPuppyLinux431.png
 Description   Debian Wheezy with Synaptics running under Pup 4.3.1
 Filesize   219.97 KB
 Viewed   640 Time(s)

debootstrapDebianWheezyUnderPuppyLinux431.png

debootstrapDebianStretchInPuppyRacy.png
 Description   Debian Stretch with Synaptics running in Puppy Racy 5.5
 Filesize   132.36 KB
 Viewed   708 Time(s)

debootstrapDebianStretchInPuppyRacy.png

slacko64debootstrap.png
 Description   Running Debian-official debootstrap on Puppy Slacko64
 Filesize   134.51 KB
 Viewed   1099 Time(s)

slacko64debootstrap.png


Last edited by wiak on Sun 03 Sep 2017, 20:18; edited 48 times in total
Back to top
View user's profile Send private message 
AndresC2

Joined: 08 Jul 2017
Posts: 25

PostPosted: Thu 03 Aug 2017, 23:47    Post subject:  

Hello Wiak! Smile

Cool I will try in puppy precise.

by the way..

When you finish type "exit" in terminal and later

you have Unmounting mount binds in chroot.

umount chroot/proc
umount chroot/dev/pts
umount chroot/dev
umount chroot/sys
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 2459
Location: holland

PostPosted: Fri 04 Aug 2017, 03:33    Post subject:  

Very nice !!

Just a quick note to follow up on what AndresC2 just wrote:
Code:
umount chroot/proc
umount chroot/dev/pts
umount chroot/dev
umount chroot/sys


Doing that after exiting the chroot is really important, should be in first post. (EDIT: Ok, I see you did add now)
Suppose you don't do it and try to remove the chroot directory, the system will crash (because of the mount "binds" to /dev /proc /sys/)

EDIT:
Quote:
debootstrap --arch=i386 --variant=minbase stretch chroot http://ftp.us.debian.org/debian/

Does that work, create 32-bit (i386) from 64 bit host system ?
I tried the other way around and it didn't work for me, btw.

Fred
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Fri 04 Aug 2017, 04:10    Post subject:  

fredx181 wrote:

Does that work, create 32-bit (i386) from 64 bit host system ?


Yes Fred, worked with either --arch=i386 or --arch=amd64 when using Slacko64 host system. For a 32-bit kernel host system I expect you cannot run an underlying 64-bit Debian, though I haven't myself tried that (ah, building 64-bit Debian via debootstrap on 32bit host is a different matter of course - I'll try that sometime, though you say that didn't work for you anyway - I'm almost surprised it didn't work - now I need to install a 32bit Puppy to give it a try! Wink ).

wiak
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Fri 04 Aug 2017, 05:06    Post subject:  

fredx181 wrote:

I tried the other way around and it didn't work for me, btw.

Fred


Well, as I say, on Slacko64 system I was able to build either a 32-bit Debian (--arch=i386) or 64-bit (--arch=amd64).

However, on Slacko32 system, when I tried to build a 64-bit Debian (--arch=amd64) everything went well until the very end when I got the following error messages as the last two reported lines:

Code:
W: Failure trying to run: chroot /initrd/mnt/dev_save/stretch/chroot mount -t proc proc /proc
W: See /initrd/mnt/dev_save/stretch/chroot/debootstrap/debootstrap.log for details


and the chroot chroot wouldn't work from Slacko32 with that built system. I did try then booting into Slacko64 and running that same chroot build but still wouldn't work, saying:

Code:
# mount --bind /proc chroot/proc
# mount --bind /dev chroot/dev 
# mount --bind /sys chroot/sys
# mount -t devpts devpts chroot/dev/pts
# echo -en "`cat /etc/resolv.conf`" > chroot/etc/resolv.conf
# chroot chroot
I have no name!@puppypc830:/# apt-get update
bash: apt-get: command not found


So looks like debootstrap can only build a 32bit Debian system on a 32bit host (However, the error messages almost seem trivial, so maybe way round it...? Meant to check the debootstrap.log contents, but forget, sorry - I'll try again with that some other time...), but can build either a 32bit or a 64bit Debian system on a 64bit host.

EDIT: have tried again and this time noted the debootstrap.log, which is:

Code:
chroot: can't execute 'mount': Exec format error
/initrd/mnt/dev_save/stretch/chroot/debootstrap/debootstrap.log (END)


However, I remain confused as to the issue, though perhaps the 32bit host system is trying to run 64bit mount command and hence the exec format error (but I'm just guessing)... Actually, on further thought, I believe that is probably what the problem is.

wiak

Last edited by wiak on Fri 04 Aug 2017, 05:58; edited 6 times in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Fri 04 Aug 2017, 05:33    Post subject:  

uploaded dotpet of debootstrap for version 1.0.89 from DebianStretch instead of the older one from Jessie (either seemed to work fine though).
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 2459
Location: holland

PostPosted: Fri 04 Aug 2017, 05:43    Post subject:  

wiak wrote:
So looks like debootstrap can only build a 32bit Debian system on a 32bit host, but can build either a 32bit or a 64bit Debian system on a 64bit host.


Yes, did a google search for it and couldn't find any (thought maybe there's some trick to make it work, to create 64-bit on 32-bit host)
Can confirm that using debootsrtap with --arch=i386 works on (probably any?) 64 bit host system.
Tested just now on Stretch Dog 64-bit

EDIT: I think something like this is also required to execute inside the chroot:
Quote:
echo "debian-live" > /etc/hostname


See more here, e.g for installing kernel etc...
http://willhaley.com/blog/create-a-custom-debian-live-environment/

EDIT2: sorry, above EDIT is in fact off-topic because the purpose here is not to build a live OS out of the chroot.

Fred

Last edited by fredx181 on Fri 04 Aug 2017, 19:04; edited 2 times in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Fri 04 Aug 2017, 05:56    Post subject:  

I included the debootstrap.log error messages in my post above. Don't know any fix for that build 64 bit Debian on 32 bit host situation though, but at least the other possibilities all work fine...
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Fri 04 Aug 2017, 06:20    Post subject:  

The unlikelihood of being able to directly build a 64bit target on a 32bit host situation, and the reason why not, is pretty much confiirmed in the following thread:

https://lists.debian.org/debian-user/2016/05/msg01044.html
Back to top
View user's profile Send private message 
perdido


Joined: 09 Dec 2013
Posts: 611
Location: Altair IV , Just north of Eeyore Junction.

PostPosted: Fri 04 Aug 2017, 13:50    Post subject:  

Hi wiak!
This has the possibility of developing into a project that could take puppy in a new direction.

Not just by being able to use this particular script in puppy but possibly applying it to a puppy build process?
(I know, pretty far down the road if possible)

Thanks for presenting this idea!

.

_________________
.
Back to top
View user's profile Send private message 
oui

Joined: 20 May 2005
Posts: 3022
Location: near Woof (Germany) :-) Acer Laptop emachines 2 GB RAM AMD64. franco-/germanophone, +/- anglophone

PostPosted: Fri 04 Aug 2017, 15:46    Post subject:  

a debootstrap-PUPPY (not Debian, not Dog) would be a dream Rolling Eyes !
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Fri 04 Aug 2017, 18:27    Post subject:  

perdido wrote:
Hi wiak!
This has the possibility of developing into a project that could take puppy in a new direction.

Not just by being able to use this particular script in puppy but possibly applying it to a puppy build process?
(I know, pretty far down the road if possible)

Thanks for presenting this idea!

.


Yes, it would be nice to see a more traditional Puppy being built (which in itself didn't use big apps from other distributions at all and so could be built as small as possible). And then the debootstrap Debian could be used (via chroot) with it (even as an sfs only loaded on demand - though for sfs case would need some kind of persistence mechanism since sfs is readonly) with it when wanting to bolt-on/use apps/facilities from Debian - seems to me would give advantage of both but bring back smaller more efficient Pup design. i.e. separate out Puppy from Debian and enjoy benefits of both as and when wanted from the same running system without needing reboot (a kind of virtualisation without adding the weight of virtualisation).

There is no need really to build a 'debian-based' or 'ubuntu-based' Pup. Just build any lean/mean Pup (or any tiny Linux distribution actually) and use an inbuilt chroot-jail debootstrap Debian/Ubuntu facility whenever you need access to huge distribution repositories. you end up getting all the advantages whilst generally avoiding the disadvantages. It's like using virtualisation (virtual machine) but without the resource overhead of running a virtual machine.

Alternatively (or in addition as a choice), as I think you are suggesting Perdido, new styles of Pup could be built via a build system based on an initial debootstrap Debian base. Come to think of it, it would be great to see the Pups and Dogs merging somehow in terms of build-system effort.

wiak

Last edited by wiak on Fri 04 Aug 2017, 20:33; edited 2 times in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Fri 04 Aug 2017, 19:40    Post subject: using same debootstrap Debian system
Subject description: between different host Linux systems...
 

NOTE: This may or may not be obvious, but you CAN share the same debootstrap built Debian system between other Linuxes. For example, I sometimes boot into Slacko64 or into XenialPup or slitaz or into tiny core linux - I can use the same stretch/chroot debootstrap built Debian on any of them just by doing the same mount --bind commands followed by chroot chroot (or using a simple script to do that...) - you don't need to rebuild the debootstrap Debian system each time, it is always there once built... Smile

So this debootstrapDebian chroot running method provides a great way to run a normally tiny pup linux system (even one just a few tens of MB in size, or less) in parallel with a large-as-you-like debootstrapDebian chroot jailed system for extra power when needed... Wink

wiak


EDIT: By the way, when I ran my Slacko created debootstrapDebian under my tiny core linux installation, I couldn't at first get X apps to run from the Debian folder (worked fine running Debian X apps under Slacko itself). Main problem seems to be that tiny core runs by default as user tc and the Debian system needed the .Xauthority file copied over from the /home/tc folder as follows:

In the chroot Debian system:

Code:
mkdir /home/tc/


In the normal tiny core system (from in the stretch dir) enter the command:

Code:
sudo cp /home/tc/.Xauthority chroot/home/tc/


X apps should now find X DISPLAY correctly. However, that .Xauthority changes every time you boot the main system so after any reboot you need to always do that cp command of the newest .Xauthority before trying to run X apps from your debootstrapDebian system. Note well that you don't need to cp any .Xauthority file when running your debootstrapDebian system from a Pup, such as for example Slacko. There is no problem anyway running X apps from the debootstrapDebian system when using a Pup as a host system. Presumably that's because you are running as user root in both the host Slacko system and also the Debian target. I.e. when host is a Pup you don't need to copy over any .Xauthority file!

Some further good information about this can be found here:

https://wiki.gentoo.org/wiki/Project:X86/Chroot_Guide

Look for the section: "Troubleshooting: Running X apps inside the chroot"

You can also find instructions in that guide for how to share a directory between both your host and target system (example given is for /tmp but you can mount -o bind any dir you want to share).
Back to top
View user's profile Send private message 
backi

Joined: 27 Feb 2011
Posts: 1262
Location: GERMANY

PostPosted: Sat 05 Aug 2017, 08:37    Post subject:  

Hi wiak ....everybody !

Although i do not understand too much about this Topic........sounds total fascinating .......

Could this be a revolutionary discovery??? A real game-changer ???? Idea Idea Idea
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 330
Location: not Bulgaria

PostPosted: Sat 05 Aug 2017, 09:14    Post subject:  

backi wrote:
Hi wiak ....everybody !

Although i do not understand too much about this Topic........sounds total fascinating .......

Could this be a revolutionary discovery??? A real game-changer ???? Idea Idea Idea


It's not so complicated actually backi. If you have a recent running Puppy connected to the internet you just need to try out steps 1 to 7 in the first post of this thread. If you did that you'd find you then had a working base Debian Stretch running inside a terminal of your Puppy (so, for example, apt-get install lxtask would work as a test).

wiak
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 4 [53 Posts]   Goto page: 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2414s ][ Queries: 12 (0.0227s) ][ GZIP on ]