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

If it doesn't relate to Debian, but you still want to share it, please do it here

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

Postby bester69 » 2017-12-28 12:15

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
Last edited by bester69 on 2017-12-28 13:47, edited 1 time in total.
bester69 wrote:There is nothing to install in linux, from time to time i go to google searching for something fresh to install in linux, but, there is nothing
User avatar
bester69
 
Posts: 1066
Joined: 2015-04-02 13:15

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

Postby Head_on_a_Stick » 2017-12-28 12:43

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:
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 7453
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby Head_on_a_Stick » 2017-12-28 13:24

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'
Last edited by Head_on_a_Stick on 2017-12-28 14:37, edited 1 time in total.
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 7453
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby bester69 » 2017-12-28 14:01

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:
Last edited by bester69 on 2017-12-28 14:24, edited 1 time in total.
bester69 wrote:There is nothing to install in linux, from time to time i go to google searching for something fresh to install in linux, but, there is nothing
User avatar
bester69
 
Posts: 1066
Joined: 2015-04-02 13:15

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

Postby bester69 » 2017-12-28 14:24

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.
bester69 wrote:There is nothing to install in linux, from time to time i go to google searching for something fresh to install in linux, but, there is nothing
User avatar
bester69
 
Posts: 1066
Joined: 2015-04-02 13:15

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

Postby Head_on_a_Stick » 2018-01-01 14:05

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.
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 7453
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby wizard10000 » 2018-01-01 15:51

Looks like a lot of work :)

Although I'm a longtime minidlna fan I I just installed plexmediaserver on my home server (running Sid) over the weekend; Plex and Chrome are the only two non-Debian packages I have installed on any machine.

Plex' 64-bit Ubuntu package installed on Sid just fine; it has no dependencies but does use avahi. Since it has no dependencies it's not possible for a Plex upgrade to break Sid but a Sid upgrade could break Plex - although that's also unlikely.

If someone enables the Plex PPA and things break you get to keep the pieces but Plex' web client will tell you if there's an upgrade available so I can't see any real need for the PPA. Although the instructions say to apt the package in I decided to install with gdebi and poke around inside the package so I could see what Plex was offering to do to my system before it did it.

So far I'm really happy with the setup; it did take me two days' worth of fine-tuning to get everything on server and clients set up the way I wanted but it worked out of the box - and required opening a dev account with Opera so I could get the Plex client for my Samsung Blu-Ray player :mrgreen:
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1270
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

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

Postby Head_on_a_Stick » 2018-01-01 18:16

wizard10000 wrote:running Sid

Looks like a lot of work :mrgreen:
"Only the mediocre are always at their best." — Jean Giraudoux
User avatar
Head_on_a_Stick
 
Posts: 7453
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to Offtopic

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable