Chroot Jail Xenial Ubuntu amd64

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
watchdog
Posts: 2021
Joined: Fri 28 Sep 2012, 18:04
Location: Italy

Chroot Jail Xenial Ubuntu amd64

#1 Post by watchdog »

I have done a full install of Ubuntu Xenial 16.04 amd64 on a 8 GB usb stick with 1 GB reserved swap partition on the same usb stick (for further and unknown use). I installed in ubuntu skypeforlinux and google hangouts (google talkplugin).

https://repo.skype.com/deb/pool/main/s/skypeforlinux/

https://www.google.com/tools/dlpage/hangoutplugin?hl=en

Then I have booted xenialpup64 on sda1 and inserted the ubuntu usb stick. After mounting the sdb1 usb stick I renamed in it /etc/resolv.conf (which is a symlink) as /etc/resolv.con.old and copied the current /etc/resolv.conf of my xenialpup64 in /mnt/sdb1/etc/resolv.conf. Then I prepared in /usr/local/bin the following selfexplained 3 scripts with execute permissions:

1- start-firefoxchroot:

Code: Select all

#!/bin/sh
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 firefox
2- start-skypeforlinuxchroot:

Code: Select all

#!/bin/sh
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 skypeforlinux
3- closechroot:

Code: Select all

#!/bin/sh
umount /mnt/sdb1/tmp/.X11-unix
umount /mnt/sdb1/sys
umount /mnt/sdb1/proc
killall dbus-launch
sleep 10
umount /mnt/sdb1/dev
umount /mnt/sdb1
xhost -
Executing the first script in xenialpup64, with the ubuntu usb stick inserted as sdb1, launches a chroot firefox where you can use google hangouts (login in gmail...). I use a chroot jail to run firefox with webrtc (probably needed by hangouts) because my base browser is palemoon. Executing the second script launches skypeforlinux-alpha. The chroot jail should be closed by running the third script but I am experimenting that the kernel continue to process the jail so it cannot be closed before shutdown or you have to wait before launching the script closechroot. I need some help to write the closechroot script. It somehow works for me.

Post Reply