Compare commits
No commits in common. "432fe563c39f5f1615f426a043edb439e2b35f96" and "5192e2b062f20d582918b5977b630f38514be48b" have entirely different histories.
432fe563c3
...
5192e2b062
37
README.md
37
README.md
|
@ -1,37 +0,0 @@
|
||||||
# How to pivot_root
|
|
||||||
1. Stop all uneeded services
|
|
||||||
`systemctl isolate rescue-ssh.target`
|
|
||||||
|
|
||||||
1. Create the new / on ramdisk
|
|
||||||
`mkdir /tmp/tmproot && mount none /tmp/tmproot -t tmpfs`
|
|
||||||
|
|
||||||
1. Create all the base directories
|
|
||||||
`mkdir /tmp/tmproot/{proc,sys,usr,var,run,oldroot,root}`
|
|
||||||
1. Copy the base symlink
|
|
||||||
`cp -ax /{bin,etc,mnt,sbin,lib} /tmp/tmproot/`
|
|
||||||
1. Copy /dev
|
|
||||||
`cp -a /dev /tmp/tmproot/dev`
|
|
||||||
|
|
||||||
1. Copy the libs for services
|
|
||||||
`lsof -Fn / | grep ^n/ | cut -c2- | sort -u | grep /usr | rsync --files-from=- / /tmp/tmproot/`
|
|
||||||
1. Copy other libs and binaries needed
|
|
||||||
|
|
||||||
`ldd /usr/bin/{wget,gzip,dd,mount,ls,cp,cat} | grep -o '/lib[^ ]*' | sed 's/^/\/usr/' | xargs -n1 readlink -f | rsync -v --files-from=- / /tmp/tmproot/`
|
|
||||||
|
|
||||||
`ldd /usr/bin/{wget,gzip,dd,mount,ls,cp,cat} | grep -o '/lib[^ ]*' | sed 's/^/\/usr/' | rsync -lv --files-from=- / /tmp/tmproot/`
|
|
||||||
|
|
||||||
`rsync -v /usr/bin/{wget,gzip,dd,mount,ls,cp,cat} /tmp/tmproot/usr/bin/`
|
|
||||||
|
|
||||||
|
|
||||||
systemctl switch-root /tmp/tmproot/
|
|
||||||
|
|
||||||
## OLLLD WAY NOT WORKING ANYMORE
|
|
||||||
`unshare -m`
|
|
||||||
`pivot_root /tmp/tmproot/ /tmp/tmproot/oldroot`
|
|
||||||
`mount none /proc -t proc`
|
|
||||||
`mount none /sys -t sysfs`
|
|
||||||
`mount none /dev/pts -t devpts`
|
|
||||||
|
|
||||||
Fuck I need sshd
|
|
||||||
|
|
||||||
`wget -O - https://github.com/YunoHost/arm-images/releases/download/v2020.10/internetcube_4.0.8_v2020.10_lime2.img.gz | gzip -cd | dd bs=1M oflag=direct status=progress of=/dev/mmcblk0`
|
|
30
Vagrantfile
vendored
30
Vagrantfile
vendored
|
@ -1,30 +0,0 @@
|
||||||
# -*- mode: ruby -*-
|
|
||||||
# vi: set ft=ruby :
|
|
||||||
|
|
||||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
|
||||||
# configures the configuration version (we support older styles for
|
|
||||||
# backwards compatibility). Please don't change it unless you know what
|
|
||||||
# you're doing.
|
|
||||||
#
|
|
||||||
# This script can test the internetcube image patching just do vagrant up
|
|
||||||
$script = <<SCRIPT
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
source /vagrant/yunocube.sh
|
|
||||||
mkdir -p /tmp/overlay
|
|
||||||
ln -s /vagrant /tmp/overlay/internetcube
|
|
||||||
InstallInternetCubeServices
|
|
||||||
|
|
||||||
SCRIPT
|
|
||||||
Vagrant.configure("2") do |config|
|
|
||||||
|
|
||||||
config.vm.box = "debian/buster64"
|
|
||||||
|
|
||||||
config.vm.provider :libvirt do |libvirt|
|
|
||||||
libvirt.memory = 2048
|
|
||||||
end
|
|
||||||
|
|
||||||
# config.vm.provision "shell" do |s|
|
|
||||||
# s.inline = $script
|
|
||||||
# end
|
|
||||||
end
|
|
20
exclude.list
20
exclude.list
|
@ -1,20 +0,0 @@
|
||||||
/dev/*
|
|
||||||
/run/*
|
|
||||||
/sys/*
|
|
||||||
/proc/*
|
|
||||||
/tmp/*
|
|
||||||
/var/tmp/*
|
|
||||||
/var/lib/apt/*
|
|
||||||
/var/lib/dpkg/*
|
|
||||||
/var/run/*
|
|
||||||
/var/cache/*
|
|
||||||
/boot/*
|
|
||||||
/usr/lib/modules/*
|
|
||||||
/usr/lib/python*
|
|
||||||
/usr/lib/*-linux-gnu/perl*
|
|
||||||
/usr/share/GeoIP*
|
|
||||||
/usr/share/man*
|
|
||||||
/usr/share/i18n*
|
|
||||||
/usr/share/perl*
|
|
||||||
/usr/share/doc*
|
|
||||||
/usr/share/locale*
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
sudo modprobe zram num_devices=4
|
|
||||||
echo 1G | sudo tee /sys/block/zram0/disksize
|
|
||||||
sudo mkfs.ext4 -m0 /dev/zram0
|
|
||||||
mkdir /tmp/sys
|
|
||||||
sudo mount /dev/zram0 /tmp/sys
|
|
||||||
sudo tar -cpSf - \
|
|
||||||
--acls --xattrs --selinux \
|
|
||||||
--exclude-from /vagrant/exclude.list \
|
|
||||||
/ |
|
|
||||||
sudo tar -xvf - \
|
|
||||||
--acls --xattrs --selinux \
|
|
||||||
-C /tmp/sys
|
|
||||||
sudo truncate -s0 /tmp/sys/etc/fstab
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo mkdir -p /sysroot
|
|
||||||
sudo mount --rbind /tmp/sys /sysroot
|
|
||||||
sudo touch /etc/initrd-release
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user