This shows you the differences between two versions of the page.
chroot [2017/02/20 20:44] |
chroot [2022/04/16 12:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | It looks that UbuntU get along AndroiD looks like the same MotorolA chroot HacK : | ||
+ | |||
+ | http://techcrunch.com/2012/02/21/canonical-announces-ubuntu-for-android/ | ||
+ | |||
+ | time to resurect HildoN too | ||
+ | |||
+ | |||
+ | ==== TODO ==== | ||
+ | |||
+ | * http://talk.maemo.org/showthread.php?p=1205129#post1205129# HarmattaN | ||
+ | * http://talk.maemo.org/showthread.php?p=1066889#post1066889 | ||
+ | |||
+ | |||
+ | ==== HARMATTAN ==== | ||
+ | |||
+ | * FeedBack : http://talk.maemo.org/showthread.php?p=1207809#post1207809 | ||
+ | |||
+ | |||
+ | scp ~/sudo_1.6.8p12-4osso28+0m6_armel.deb user@tel:/home/user/mnt/local/ | ||
+ | scp yavor-debian-lite.img.ext4 user@tel:/home/user/mnt/local/ | ||
+ | d=/home/user/mnt/local/ | ||
+ | wget -nc http://www.robertocolistete.net/MaemoMeeGo/EasyDebian/xmimd.sh | ||
+ | wget -nc http://qole.org/files/harmattan/HarmChom.tgz | ||
+ | |||
+ | devel-su # RooT | ||
+ | AEGIS_FIXED_ORIGIN=com.nokia.maemo dpkg -i /home/user/mnt/local/sudo_1.6.8p12-4osso28\+0m6_armel.deb | ||
+ | apt-get install xmimd # 1.0-0~rzr3 | ||
+ | mkdir -p /usr/local/opt | ||
+ | cd /usr/local/opt/ | ||
+ | tar xvfz $d/HarmChom.tgz | ||
+ | pwd=/usr/local/opt/HarmChom/src/ | ||
+ | cd $pwd | ||
+ | find . -type f | while read t ; do ln -s ${pwd}/$t /$t ; done | ||
+ | #ln: /./home/user/.chroot: File exists | ||
+ | #ln: /./etc/init/ssh.conf: File exists | ||
+ | #ln: /./etc/ssh/sshd_config: File exists | ||
+ | |||
+ | echo 'IMGFILE=/home/user/mnt/local/yavor-debian-lite.img.ext4' | tee /home/user/.chroot | ||
+ | mkdir -p /.debian | ||
+ | exit | ||
+ | # /bin/qchroot: line 145: blkid: not found | ||
+ | # /bin/qchroot: line 167: chroot: not found # error if not using sudo as user | ||
+ | sudo debian | ||
+ | |||
+ | dpkg-reconfigure tzdata | ||
+ | passwd | ||
+ | smbpasswd | ||
+ | htpasswd /etc/nginx/htaccess root | ||
+ | xephwm-id | ||
+ | # have fun now | ||
+ | ~/xmimd.sh | ||
+ | # closechroot | ||
+ | |||
+ | |||
+ | WiP : | ||
+ | |||
+ | apt-cache rdepends libhildon-1-0 | ||
+ | apt-get install hildon-desktop tasks-hildon | ||
+ | |||
+ | killall Xephyr | ||
+ | update-alternatives --config x-session-manager | ||
+ | update-alternatives --config x-window-manager | ||
+ | diff -u /usr/bin/xephwm~ /usr/bin/xephwm | ||
+ | #| +[ "x$WMEXEC" != x ] || WMEXEC="start-hildon" | ||
+ | |||
+ | |||
+ | * http://talk.maemo.org/showthread.php?t=82114&page=17 | ||
+ | * http://talk.maemo.org/attachment.php?attachmentid=25489&d=1332087322# SuDo | ||
+ | |||
+ | ==== ENV ==== | ||
+ | |||
+ | sudo cat /proc/$(pgrep gnome-session)/environ | tr '\0' '\n' > /tmp/env.txt | ||
+ | su -l $USER | ||
+ | cat /tmp/env.txt | sed -e "s|\(.*\)=\(.*\)|export \1='\2'|g" > /tmp/env.sh && . /tmp/env.sh | ||
+ | |||
+ | ==== mount bind === | ||
+ | |||
+ | sudo=sudo | ||
+ | l=$(cat /proc/mounts | sed -e "s|[^ ]* \([^ ]*\) .*|\1|g" | sort | uniq | grep -v '^/$') | ||
+ | l="dev dev/pts sys proc" | ||
+ | for t in $l ; do $sudo mkdir -p ./$t && $sudo mount --bind /$t ./$t ; done | ||
+ | $sudo chroot . | ||
+ | |||
+ | echo "nameserver 8.8.8.8" | tee -a ./etc/resolv.conf | ||
+ | |||
+ | d=/mnt/sda6/ | ||
+ | for t in $l ; do umount $d/$t ; done | ||
+ | |||
+ | <code> | ||
+ | /proc | ||
+ | /var/run | ||
+ | /var/lock | ||
+ | /dev | ||
+ | /dev/shm | ||
+ | /dev/pts | ||
+ | /lib/modules/2.6.22-14-386/volatile | ||
+ | /sys/kernel/security | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ==== debian ==== | ||
+ | |||
+ | * http://talk.maemo.org/showthread.php?t=16121# MaemO n8x0 DiablO NiT | ||
+ | |||
+ | invoke-rc.d: WARNING: invoke-rc.d called during shutdown sequence | ||
+ | invoke-rc.d: enabling safe mode: initscript policy layer disabled | ||
+ | |||
+ | |||
+ | debboostrap | ||
+ | |||
+ | gpg --keyserver pgpkeys.mit.edu --recv-key 2D230C5F | ||
+ | gpg -a --export 2D230C5F | apt-key add - | ||
+ | |||
+ | |||
+ | ==== UBUNTU ==== | ||
+ | |||
+ | * http://ports.ubuntu.com/pool/main/x/xorg-server/?C=M;O=D | ||
+ | * http://packages.qa.debian.org/xserver-xephyr | ||
+ | |||
+ | wget -nc http://ftp.us.debian.org/debian/pool/main/a/audit/libaudit0_1.7.18-1.1_armhf.deb | ||
+ | wget -nc http://ftp.us.debian.org/debian/pool/main/x/xorg-server/xserver-common_1.11.4-1_all.deb | ||
+ | wget -nc http://ftp.us.debian.org/debian/pool/main/x/xorg-server/xserver-xephyr_1.11.4-1_armhf.deb | ||
+ | dpkg -i *.deb | ||
+ | |||
+ | sudo cp /etc/mtab /home/ubuntu/etc/ | ||
+ | xephwm startactive | ||
+ | |||
+ | * https://launchpad.net/ubuntu/+source/plasma-mobile | ||
+ | |||
+ | @TaG: #UbuntU KdE | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== GRUB ==== | ||
+ | |||
+ | Before chroot : | ||
+ | |||
+ | cp -rfa /boot/grub /boot/grub.mine | ||
+ | |||
+ | # grub-install /dev/sda8 | ||
+ | Searching for GRUB installation directory ... found: /boot/grub | ||
+ | The file /boot/grub/stage2 not read correctly. | ||
+ | |||
+ | @TaG: #GruB | ||
+ | |||
+ | ==== debootstrap ubuntu 64 bits ==== | ||
+ | |||
+ | * http://www.thegeekstuff.com/2010/01/debootstrap-minimal-debian-ubuntu-installation/# DebBootstrap | ||
+ | * http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/?C=M;O=D | ||
+ | * http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.10ubuntu3_all.deb | ||
+ | * https://help.ubuntu.com/8.10/installation-guide/amd64/linux-upgrade.html# ObsoletE | ||
+ | |||
+ | |||
+ | # cat /etc/lsb-release:DISTRIB_CODENAME=trusty | ||
+ | |||
+ | sudo aptitude install cdebootstrap | ||
+ | sudo mkfs.ext3 -L altsys /dev/sda7 | ||
+ | mount /dev/sda7 /mnt/ ; cd /mnt | ||
+ | # | ||
+ | export ARCH=$(uname -m) | ||
+ | export DISTRIB_CODENAME=xenial | ||
+ | url=http://archive.ubuntu.com/ubuntu | ||
+ | cdebootstrap --arch "$ARCH" "${DISTRIB_CODENAME}" . $url | ||
+ | |||
+ | chroot /mnt/ | ||
+ | chroot: cannot run command `/bin/bash': Exec format error | ||
+ | |||
+ | |||
+ | apt-get install etc-keeper | ||
+ | apt-get install sudo zile aptitude | ||
+ | sudo apt-get install localepurge | ||
+ | |||
+ | |||
+ | ==== install ubuntu from debian === | ||
+ | |||
+ | wget https://launchpad.net/ubuntu/+archive/primary/+files/debian-archive-keyring_2014.3_all.deb | ||
+ | wget https://launchpad.net/ubuntu/+archive/primary/+files/ubuntu-keyring_2012.05.19_all.deb | ||
+ | wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.81ubuntu2.1_all.deb | ||
+ | |||
+ | debootstrap --arch i386 xenial . http://archive.ubuntu.com/ubuntu # real 6m44.656s | ||
+ | |||
+ | ChRoot | ||
+ | apt-get install git # etckeeper screen nano | ||
+ | LANG=en_US.UTF-8 | ||
+ | echo "LANG=$LANG" >> /etc/default/locale | ||
+ | echo 'UTC' >> /etc/timezone | ||
+ | locale-gen $LANG | ||
+ | dpkg-reconfigure -f non-interactive tzdata | ||
+ | apt-get install language-pack-en-base | ||
+ | apt-get install grub-pc linux-image linux-image-4.4.0-21-generic | ||
+ | echo "pbe" > /etc/hosts | ||
+ | apt-get install openssh-server | ||
+ | echo "auto eth0" >> /etc/network/interfaces | ||
+ | echo "iface eth0 inet dhcp" >> /etc/network/interfaces | ||
+ | # passwd | ||
+ | |||
+ | echo "$rootfs auto defaults 0 1" >> /etc/fstab | ||
+ | |||
+ | |||
+ | * https://help.ubuntu.com/community/Installation/FromLinux#Debootstrap | ||
+ | |||
+ | |||
+ | ==== debbootstap foreign ==== | ||
+ | |||
+ | <code> | ||
+ | url=http://ftp.fr.debian.org/debian | ||
+ | suite=stable | ||
+ | suite=lenny | ||
+ | arch=armel | ||
+ | p=rootfs | ||
+ | |||
+ | mkdir -p "$p" && cd "$p" | ||
+ | time sudo /usr/sbin/debootstrap --foreign --arch=$arch $suite . $url && sudo tar cvfz ../$p-$suite-$arch.tar.gz . # 80MB | ||
+ | # TODO: rm ./var/cache/apt/archives/*.deb, locales , fix apt | ||
+ | |||
+ | return | ||
+ | |||
+ | cd /local | ||
+ | mkdir -p rootfs-$suite-$arch && cd rootfs-$suite-$arch | ||
+ | scp rzr@192.168.0.54:/tmp/rootfs-$suite-$arch.tar.gz ./rootfs.tar.gz | ||
+ | time tar xvfz rootfs.tar.gz # 2min | ||
+ | |||
+ | t="proc" | ||
+ | l="proc dev dev/pts sys" | ||
+ | for t in $l ; do mount --bind /$t ./$t ; done | ||
+ | chroot . /debootstrap/debootstrap --second-stage | ||
+ | # FATAL: kernel too old # etch # 2.6.16.16-arm1 | ||
+ | |||
+ | cat<<EOF > ./etc/apt/sources.list | ||
+ | deb http://ftp.fr.debian.org/debian stable main contribs non-free | ||
+ | EOF | ||
+ | |||
+ | #TODO: add .. | ||
+ | |||
+ | chroot . | ||
+ | |||
+ | apt-get install git-core | ||
+ | </code> | ||
+ | |||
+ | @tag: [[raid]] [[ArmV5]] | ||
+ | |||
+ | |||
+ | ===== ARM ===== | ||
+ | |||
+ | mkdir -p ../rootfs-$arch-$suite ; /usr/sbin/debootstrap --arch $arch $suite ../rootfs-$arch-$suite http://ftp.fr.debian.org/debian | ||
+ | |||
+ | ==== Debian ==== | ||
+ | |||
+ | on [[raid]] I use lenny, with a couple of scripts : | ||
+ | |||
+ | <code> | ||
+ | |||
+ | cd / | ||
+ | cp etc/init.d/rcS etc/init.d/rcS.mine | ||
+ | cp etc/init.d/rcS etc/init.d/rcS.orig | ||
+ | ln -fs rcS.orig etc/init.d/rcS | ||
+ | ln -fs rcS.mine etc/init.d/rcS | ||
+ | |||
+ | |||
+ | ln -fs ../local/init.d/rcS etc/init.d/rcS | ||
+ | diff -u etc/init.d/rcS.orig etc/init.d/rcS | ||
+ | --- etc/init.d/rcS.orig 2008-07-04 06:08:59.000000000 +0000 | ||
+ | +++ etc/init.d/rcS 2011-07-23 19:18:54.638529000 +0000 | ||
+ | @@ -107,5 +107,10 @@ | ||
+ | do | ||
+ | exec_sh ${cmd} | ||
+ | done | ||
+ | +i | ||
+ | + | ||
+ | +#{ http://rzr.online.fr/q/chroot | ||
+ | +. /etc/local/init.d/on_rcs_local.sh | ||
+ | +#} http://rzr.online.fr/q/chroot | ||
+ | |||
+ | /usr/local/bin/share_delete.sh & | ||
+ | |||
+ | |||
+ | more ./etc/local/init.d/on_rcs_local.sh | ||
+ | |||
+ | more .//rootfs/etc/local/chrootfs.sh | ||
+ | |||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | #! /bin/sh | ||
+ | # file://etc/local/chrootfs.sh | ||
+ | # URL: http://rzr.online.fr/q/chroot | ||
+ | |||
+ | chrootfs_() | ||
+ | { | ||
+ | cd / | ||
+ | t="proc" | ||
+ | l="proc dev dev/pts sys" | ||
+ | t="parent" | ||
+ | cd /rootfs | ||
+ | mkdir -p $t && mount --bind /$t ./$t | ||
+ | for t in $l ; do mount --bind /$t ./$t ; done | ||
+ | shell=./etc/local/init.sh | ||
+ | chroot . $shell | ||
+ | } | ||
+ | |||
+ | |||
+ | main_() | ||
+ | { | ||
+ | log=/tmp/chrootfs.txt | ||
+ | echo "#{ $0 $@ [$$]" | tee -a $log | ||
+ | date 2>&1 | tee -a $log | ||
+ | chrootfs_ $@ 2>&1 | tee -a $log | ||
+ | date 2>&1 | tee -a $log | ||
+ | echo "#} $0 $@ $! [$$]" | tee -a $log | ||
+ | } | ||
+ | |||
+ | |||
+ | main_ $@ | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ===== MISC ===== | ||
+ | |||
+ | * http://www.unixwiz.net/techtips/chroot-practices.html | ||
+ | |||
+ | |||
+ | ===== MORE ===== | ||
+ | |||
+ | @TaG: LxC [[USB]] [[Boot]] [[Live]] [[Grub]] [[nas]] [[raid]] [[bind]] [[rootfs]] DeBootStrap ChRoot MounT | ||
+ | |||
+ | <html> | ||
+ | <iframe width="420" height="315" src="http://www.youtube.com/embed/cyIxDO2vpco" frameborder="0" allowfullscreen></iframe> | ||
+ | </html> | ||
+ | |||
+ | |||
+ | <html> | ||
+ | <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="288" id="viddler_engadget_4,073"><param name="movie" value="//www.viddler.com/player/644c9ce0/"/><param name="allowScriptAccess" value="always"/><param name="allowNetworking" value="all"/><param name="allowFullScreen"value="true"/><param name="flashVars" value="f=1&openURL=104903938&autoplay=f&loop=false&nologo=false&hd=false"/><embed src="//www.viddler.com/player/644c9ce0/" width="437" height="288" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" allowNetworking="all" name="viddler_engadget_4,073" flashVars="f=1&openURL=104903938&autoplay=f&loop=false&nologo=false&hd=false"></embed></object> | ||
+ | </html> | ||
+ | |||