Page 1 of 1

Kodi17.6(chroot sid) in stretch, works Great!!

Posted: 2017-12-28 12:15
by bester69
Im really delighted with Using debpotstrap and Chroot, Ive just installled kodi17.6 in debootstrap container buster/sid under stretch and it works perfect; Now i can take advantage of running sid's applications in stable like if they were native without messing the system.
- Ive testing kodi17.6 (it brings Mesa 17), and last audio/video codecs.

Ive created two debootstrap systems containes raw images;, one with jessie and one with buster, so I can run older and newer versions in stable. They just fill around 500M with empty base installation. Ive created two raw images of 2Gb each one so I can install at least two big applications for buster or jessie.

The followed steps are in resume the way I followed.:
___________________________________________________________

0. Get the debootstrap base installation (Buster example).
debootstrap buster ~/Download_buster http://debian.org

1. Create a raw image to put inside the debootstrap installation
dd if=/dev/zero of=/media/store/buster.img bs=100M count=20 (2Gb Image file)
mkfs.btrfs buster.wine
mount -t btrfs /media/store/buster.img /mnt
cd /mnt && btrfs subvolume create buster (create buster container subvolume)
umount /mnt && mount -t btrfs -o subvol=buster /media/store/buster.img /mnt
rsync -aAXv ~/Download_buster /mnt/buster

2. Add mount point of image debootsrap in fstab.
/media/store/buster.img /media/buster/ btrfs subvol=buster,defaults,noatime,space_cache,autodefrag 0 2

3. Create init snapshot from clean debootstrap installation so we can restore clean installation.
cd /media/buster && btrfs subvolume snapshot ./ init_snap

4. Binding system and chroot to debootstrap installation
imagePATH=/media/buster
echo /run /sys /proc /dev/pts /dev/shm /dev | xargs -n1 |sudo xargs -I{} umount $imagePATH/{} (Unmount all)
echo /dev /dev/shm /dev/pts /proc /sys /run | xargs -n1 |sudo xargs -I{} mount -o bind {} $imagePATH/{} (Mount all)

4.2 Installing kodi17.6 in buster.
4.2.1 Adding temporary (for kodi) sid repository source to sources.list
deb http://deb.debian.org/debian/ buster main contrib non-free
deb http://deb.debian.org/debian/ sid main contrib non-free
4.2.2 Install Kodi 17.6
sudo chroot $imagePATH && apt-get install kodi -t buster

5. Running chroot application; invoke script within chroot (script linux_app.sh).: :
sudo chroot $imagePATH /linux_app.sh $1 &
(running kodi) sudo chroot $imagePATH /linux_app.sh kodi &


6. In chroot, Mount data folders and runn App (script linux_app.sh).:
mount -t btrfs -o subvol=home /dev/sdaX /home
mount -t btrfs -o subvol=kodi /dev/sdaX /media/kodi
su myuser -c $1
sleep 2
su myuser -c "pkill -x $1"
su myuser -c "pkill -x $1 -9"
su myuser -c "exit"


:o :o

Re: Kodi17.6(chroot sid) in stretch, works Great!!

Posted: 2017-12-28 12:43
by Head_on_a_Stick
bester69 wrote:Now i can take advantage of running sid's applications in stable like if they were native without messing the system.
That's amazing!

Have you seen http://forums.debian.net/viewtopic.php?f=16&t=129390? :mrgreen:

Re: Kodi17.6(chroot sid) in stretch, works Great!!

Posted: 2017-12-28 13:24
by Head_on_a_Stick
Just FYI:
bester69 wrote:4. Binding system and chroot to debootstrap installation
imagePATH=/media/buster
echo /run /sys /proc /dev/pts /dev/shm /dev | xargs -n1 |sudo xargs -I{} umount $imagePATH/{} (Unmount all)
echo /dev /dev/shm /dev/pts /proc /sys /run | xargs -n1 |sudo xargs -I{} mount -o bind {} $imagePATH/{} (Mount all)
Try this instead of the first line:

Code: Select all

sudo umount -R "${imagePATH}"
And this for the second line:

Code: Select all

for i in 'proc' 'sys' 'dev' 'dev/pts' 'dev/shm'; do sudo mount --bind /"${i}" "${imagePATH}/${i}"; done
That calls a single command (`mount`) and lets the shell do all the work; your version calls three extra commands, which is much less efficient.

Also, see https://mywiki.wooledge.org/Quotes

So

Code: Select all

imagePATH=/media/buster
Should if fact be:

Code: Select all

imagePATH='/media/buster'
And maybe this overall structure would be more "correct":

Code: Select all

imagepath='/media/buster'
sudo umount -R "${imagepath}"
for i in 'run' 'proc' 'sys' 'dev' 'dev/pts' 'dev/shm'; do sudo mount --bind /"${i}" "${imagepath}/${i}"; done
EDIT: added 'run'

Re: Kodi17.6(chroot sid) in stretch, works Great!!

Posted: 2017-12-28 14:01
by bester69
Head_on_a_Stick wrote:
bester69 wrote:Now i can take advantage of running sid's applications in stable like if they were native without messing the system.
That's amazing!

Have you seen http://forums.debian.net/viewtopic.php?f=16&t=129390? :mrgreen:
hehehe, Its all invented, isnt it? :) I like to explore my own creativity..

Thanks for your input Head, I didnt know about systemd-nspawn, I will note it down in my notebook, and take it a look eventually.. bit a bit we keep learning linux solutions. :wink:

Re: Kodi17.6(chroot sid) in stretch, works Great!!

Posted: 2017-12-28 14:24
by bester69
Head_on_a_Stick wrote:Just FYI:
Try this instead of the first line:

Code: Select all

sudo umount -R "${imagePATH}"
I will keep this learning, thanks.

by the way, your correction are great, and i really apreciate them, but i'll stay in mode easy... :mrgreen:

thanks.

Re: Kodi17.6(chroot sid) in stretch, works Great!!

Posted: 2018-01-01 14:05
by Head_on_a_Stick
Just used this method in my Alpine Linux system, I see no reason why it won't work in Debian :)

Running shiny new **** from an Arch Linux chroot

First, download an Arch Linux bootstrap image and unpack it in a working directory (and clean up afterwards):

Code: Select all

curl -O https://mirrors.kernel.org/archlinux/iso/latest/archlinux-bootstrap-2018.01.01-x86_64.tar.gz
tar xzf archlinux-bootstrap-2018.01.01-x86_64.tar.gz && rm archlinux-bootstrap-2018.01.01-x86_64.tar.gz
This unpacks to ~/chroot/root.x86_64 and we now need to un-comment a mirror so that pacman will work:

Code: Select all

sed -i '/evowise/s/^#//' root.x86_64/etc/pacman.d/mirrorlist
Next, bind mount the API filesystems and chroot in:

Code: Select all

for i in proc sys dev run; do sudo mount --rbind /$i root.x86_64/$i; done
sudo chroot root.x86_64 /bin/bash
From the chroot shell, we can bootstrap pacman and install our package (denoted by "foo" in this example):

Code: Select all

pacman-key --init
pacman-key --populate archlinux
pacman -Syu foo
Once that is done, use `exit` (or <Ctrl>+d) to exit the chroot.

Finally, run the application ("foo" in this example) from the Debian host using the `chroot` command, like this (I've added DISPLAY=:0 to allow "foo" access to the graphical desktop):

Code: Select all

sudo chroot ~/chroot/root.x86_64 /bin/su -c 'DISPLAY=:0 foo'
Most programs won't need the API stuff mounted to run so that should still work once you unbind them.

A new user can be created to run the chroot programs if preferred, it's probably simplest to select the same UID & GID as the host user.

Re: Kodi17.6(chroot sid) in stretch, works Great!!

Posted: 2018-01-01 18:16
by Head_on_a_Stick
wizard10000 wrote:running Sid
Looks like a lot of work :mrgreen: