Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on debootstrap. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/debootstrap.e> # or at <http://angg.twu.net/e/debootstrap.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.apt-cacher-ng» (to "apt-cacher-ng") # «.machinectl» (to "machinectl") # «.systemd-container» (to "systemd-container") # «.debootstrap» (to "debootstrap") # «.debootstrap-tar» (to "debootstrap-tar") # «.nspawn.conf» (to "nspawn.conf") # «.delete-all» (to "delete-all") # «.run-debootstrap» (to "run-debootstrap") # «.create-debian0.tar» (to "create-debian0.tar") # «.unpack-debian0.tar» (to "unpack-debian0.tar") # «.debian-basic-setup» (to "debian-basic-setup") # «.2024may28-a» (to "2024may28-a") # «.ssh-X» (to "ssh-X") # «.authorized_keys» (to "authorized_keys") # «.install-other-distro» (to "install-other-distro") ##### # # apt-cacher-ng # 2024may23 # ##### # «apt-cacher-ng» (to ".apt-cacher-ng") # (find-status "apt-cacher-ng") # (find-vldifile "apt-cacher-ng.list") # (find-udfile "apt-cacher-ng/") # (find-man "8 acngfs") # (find-man "8 apt-cacher-ng") # (find-fline "~/LOGS/2024may23.emacs" "install apt-cacher-ng") # (find-fline "~/LOGS/2024may23.emacs" "apt-cacher-ng gets upset if you download too much") # (find-fline "/etc/apt-cacher-ng/") # (find-fline "/etc/apt-cacher-ng/acng.conf" "CacheDir: /var/cache/apt-cacher-ng") # (find-fline "/etc/apt-cacher-ng/acng.conf" "Port:3142") # (code-c-d "aptngcache" "/var/cache/apt-cacher-ng/") # (find-aptngcachefile "") # (find-aptngcachesh "find * | sort") # (find-aptngcachesh "du -ch") <twb> edrx: if you do this >>1 time, I strongly recommend "apt install apt-cacher-ng" on the host, then --aptopt='Acquire::http::Proxy "http://localhost:3142"' <edrx> twb: in <https://0x0.st/XZXZ.txt>, what do the errors like "502 Connection closed [IP: ::1 3142]" mean? 1) apt-cacher-ng not running and so not listening on the port 3142, or 2) apt-cacher-ng worked in some cases and gave errors in the other cases, or 3) something else? ##### # # systemd-container (contains machinectl) # 2024may26 # ##### # «systemd-container» (to ".systemd-container") # (find-status "systemd-container") # (find-vldifile "systemd-container.list") # (find-udfile "systemd-container/") # (find-man "1 machinectl") # (find-man "1 portablectl") # (find-man "1 systemd-dissect") # (find-man "1 systemd-nspawn") # (find-man "5 systemd.nspawn") # (find-man "8 systemd-machined") # (find-man "8 systemd-machined.service") # (find-man "8 systemd-portabled") # (find-man "8 systemd-portabled.service") # (find-fline "~/LOGS/2024may23.emacs" "systemd-nspawn / machinectl") # (find-fline "$ASROOT/var/lib/" "machines") # (find-fline "$ASROOT/var/lib/machines/") ##### # # machinectl # 2024may26 # ##### # «machinectl» (to ".machinectl") # (find-status "systemd-container") # (find-vldifile "systemd-container.list") # (find-vldifile "systemd-container.list" "/bin/machinectl") # (find-udfile "systemd-container/") # (find-sh "machinectl --help") # (find-man "1 machinectl") # (find-man "1 machinectl" " list") # (find-man "1 machinectl" " list-images") # (find-man "1 machinectl" " image-status [NAME...]") # (find-man "1 machinectl" " show-image [NAME...]") # (find-man "1 machinectl" " poweroff NAME...") # (find-man "1 machinectl" " poweroff NAME..." "Use stop as" "alias") # (find-man "1 machinectl" " shell [[NAME@]NAME [PATH [ARGUMENTS...]]]") # (find-fline "$ASROOT/var/lib/" "machines") # (find-fline "$ASROOT/var/lib/machines/") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) machinectl list machinectl list --all machinectl list-images machinectl list-images --all sudo machinectl start debian machinectl image-status debian machinectl show-image debian sudo machinectl shell edrx@debian ls -lAF /home/edrx/ exit sudo machinectl stop debian sudo machinectl stop debian machinectl list * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo machinectl export-tar debian /tmp/debian0.tar laf -h /tmp/debian.tar ##### # # debootstrap # 2024may23 # ##### # «debootstrap» (to ".debootstrap") # (find-status "debootstrap") # (find-vldifile "debootstrap.list") # (find-udfile "debootstrap/") # (find-status "systemd-container") # (find-vldifile "systemd-container.list") # (find-vldifile "systemd-container.list" "systemd-nspawn") # (find-udfile "systemd-container/") # https://wiki.debian.org/nspawn # https://wiki.debian.org/nspawn#Host_Preparation # https://wiki.debian.org/nspawn#Host_Preparation echo ... >/etc/sysctl.d/nspawn.conf # https://wiki.debian.org/nspawn#Creating_a_Debian_Container # https://wiki.debian.org/nspawn#Creating_a_Debian_Container debootstrap # https://wiki.debian.org/nspawn#Creating_a_Debian_Container systemd-nspawn -D # https://wiki.debian.org/nspawn#Creating_a_Debian_Container set root password # https://wiki.debian.org/nspawn#Booting_a_Container # https://wiki.debian.org/nspawn#Booting_a_Container systemd-nspawn --boot -U -D # https://wiki.debian.org/nspawn#Checking_the_status_of_containers # https://wiki.debian.org/nspawn#Logging_into_a_Container # https://wiki.debian.org/nspawn#Stopping_a_Container # (find-fline "~/LOGS/2024may23.emacs" "systemd-nspawn / machinectl") It is recommended that host has unprivileged user namespaces enabled - this is the debian default but some consider it a security risk. It is needed to support the -U option # (find-fline "/var/lib/" "machines") # (find-fline "$ASROOT/var/lib/machines/") # (find-fline "$ASROOT/var/lib/machines/debian/") ##### # # Create a container with debootstrap, then export-tar it and import-tar it # 2024may26 # ##### # «debootstrap-tar» (to ".debootstrap-tar") # (find-man "8 debootstrap") # (find-man "1 machinectl") ** «nspawn.conf» (to ".nspawn.conf") ** See: https://wiki.debian.org/nspawn#Host_Preparation ** * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo bash echo 'kernel.unprivileged_userns_clone=1' > /etc/sysctl.d/nspawn.conf systemctl restart systemd-sysctl.service exit ** «delete-all» (to ".delete-all") ** debootstrap -> /var/lib/machines/debian/ ** <-> /var/lib/machines/debian0.tar ** * (eepitch-shell3) * (eepitch-kill) * (eepitch-shell3) sudo ls -lAF /var/lib/machines/ sudo du -ch /var/lib/machines/ sudo rm -Rf /var/lib/machines/ ** «run-debootstrap» (to ".run-debootstrap") ** Create a /var/lib/machines/debian/ with debootstrap. ** This takes several minutes. ** sudo debootstrap \ --include=systemd,dbus,sudo,openssh-server,psmisc,xauth,xterm \ stable /var/lib/machines/debian ** «create-debian0.tar» (to ".create-debian0.tar") ** Save /var/lib/machines/debian/ into debian0.tar. ** This is very quick. sudo ls -lAFh /var/lib/machines/ sudo du -ch /var/lib/machines/ sudo machinectl export-tar debian /var/lib/machines/debian0.tar sudo ls -lAFh /var/lib/machines/ ** «unpack-debian0.tar» (to ".unpack-debian0.tar") ** Restore /var/lib/machines/debian/ from debian0.tar. ** This is very quick. sudo rm -Rf /var/lib/machines/debian/ sudo ls -lAFh /var/lib/machines/ sudo machinectl import-tar /var/lib/machines/debian0.tar debian sudo ls -lAFh /var/lib/machines/ sudo du -ch /var/lib/machines/debian/ ##### # # Basic setups on /var/lib/machines/debian/ # 2024may26 # ##### # «debian-basic-setup» (to ".debian-basic-setup") # (find-angg ".emacs.templates" "find-machinectl-tar-links") # (find-machinectl-tar-links "debian" "0") * (eepitch-shell3) * (eepitch-kill) * (eepitch-shell3) sudo systemd-nspawn -D /var/lib/machines/debian -U --machine debian # apt-get install -y lua5.1 # apt-get install -y xterm # apt-get install -y openssh-client openssh-server # apt-get install -y sudo apt-get install -y psmisc apt-get install -y xauth echo "edrx/edrx/Eduardo Ochs/////Y/" | tr / '\n' | adduser edrx ls -lAF /etc/sudoers echo ' # Edrx: # (find-es "sudo") User_Alias FULLTIMERS = edrx, aleph, beth FULLTIMERS ALL = NOPASSWD: ALL ' | tee -a /etc/sudoers ls -lAF /etc/sudoers mkdir -p /home/edrx/.ssh/ mkdir -p /root/.ssh/ ** * (kill-new (find-sh0 "cat ~/.ssh/id_rsa.pub")) ** Insert below, run, then undo ** echo '' > /home/edrx/.ssh/authorized_keys echo '' > /root/.ssh/authorized_keys chmod 600 /home/edrx/.ssh/authorized_keys chmod 700 /home/edrx/.ssh/ chmod 600 /root/.ssh/authorized_keys chmod 700 /root/.ssh/ chown -Rv edrx:edrx /home/edrx/.ssh/ cat /etc/hosts echo '127.0.1.1 scylla' | tee -a /etc/hosts echo '127.0.1.1 debian' | tee -a /etc/hosts cat /etc/hosts cd /etc/ssh/ sudo ssh-keygen -A touch /root/.Xauthority touch /home/edrx/.Xauthority chown edrx:edrx /home/edrx/.Xauthority mkdir -p /run/sshd ; ps ax | grep ssh /usr/sbin/sshd -p 4444 ; ps ax | grep ssh /usr/sbin/sshd -p 4444 ; ps ax | grep ssh # (find-fline "/scp:root@localhost#4444:/etc/ssh/sshd_config") killall sshd ; ps ax | grep ssh exit # (find-fline "~/.ssh/known_hosts") ssh-keygen -f "/home/edrx/.ssh/known_hosts" -R "[localhost]:4444" # (find-machinectl-tar-links "debian" "1") # (find-machinectl-tar-links "debian" "2") ##### # # 2024may28-a # 2024may28 # ##### # «2024may28-a» (to ".2024may28-a") # (find-efunction 'find-debootstrap1-links) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-es "debootstrap" "unpack-debian0.tar") # (find-es "debootstrap" "run-debootstrap") # (find-asrootfile "/var/lib/machines/") sudo rm -Rf /var/lib/machines/debian/ sudo ls -lAFh /var/lib/machines/ sudo machinectl import-tar /var/lib/machines/debian0.tar debian sudo ls -lAFh /var/lib/machines/ sudo du -ch /var/lib/machines/debian/ # (find-es "debootstrap" "debian-basic-setup") # (find-debootstrap1-links) sudo systemd-nspawn -D /var/lib/machines/debian -U --machine debian apt-get install -y systemd dbus sudo openssh-server psmisc xauth xterm * (eepitch-password-prompt 'yes) * (eepitch-password-prompt 'no) * (find-debootstrap1-links) exit sudo ls -lAFh /var/lib/machines/ sudo du -ch /var/lib/machines/ sudo machinectl export-tar debian /var/lib/machines/debian1.tar sudo ls -lAFh /var/lib/machines/ * (find-3EE '(eepitch-shell) '(eepitch-shell2)) * (find-3ee '(eepitch-shell) '(eepitch-shell2)) * (eepitch-shell) * (eepitch-shell2) sudo systemd-nspawn -D /var/lib/machines/debian -U --machine debian mkdir /run/sshd /usr/sbin/sshd -p 4444 -d * * (eepitch-shell) # (find-fline "/scp:root@localhost#4444:/etc/ssh/sshd_config") # (find-fline "/scp:root@localhost#4444:") # (find-fline "/scp:edrx@localhost#4444:") ##### # # ssh-X # 2024may26 # ##### # «ssh-X» (to ".ssh-X") * (find-3EE '(eepitch-shell2) '(eepitch-subdebian-sshd)) * (find-3ee '(eepitch-shell2) '(eepitch-subdebian-sshd)) * (eepitch-shell2) * (eepitch-subdebian-sshd) * (eepitch-subdebian-sshd) * (eepitch-kill) * (eepitch-subdebian-sshd) machinectl list sudo machinectl stop debian sudo machinectl stop debian machinectl list sudo systemd-nspawn -D /var/lib/machines/debian -U --machine debian mkdir -p /run/sshd ; ps ax | grep ssh /usr/sbin/sshd -p 4444 ; ps ax | grep ssh /usr/sbin/sshd -p 4444 ; ps ax | grep ssh killall sshd ; ps ax | grep ssh exit sudo machinectl stop debian sudo machinectl stop debian sudo machinectl terminate debian machinectl list * (find-3ee '(eepitch-shell2) '(eepitch-subdebian-sshd)) * (eepitch-shell2) * (eepitch-kill) * (eepitch-shell2) ssh -X -p 4444 edrx@localhost xterm & exit * (eepitch-subdebian) * (eepitch-kill) * (eepitch-subdebian) xterm & exit # (find-fline "/scp:edrx@localhost#4444:") # (find-fline "/scp:root@localhost#4444:") # (find-fline "/scp:root@localhost#4444:/root/") # (find-fline "/scp:root@localhost#4444:/home/edrx/") # (find-subdebianfile "") # (find-subdebianrfile "") ##### # # Ssh without password # 2024may26 # ##### # «authorized_keys» (to ".authorized_keys") # (find-es "linode" "rsyncs" "authorized_keys") # (find-fline "/scp:root@linode:/root/" ".ssh") # (find-fline "/scp:root@linode:/root/.ssh/") # (find-fline "/scp:root@linode:/root/.ssh/authorized_keys") # (find-fline "/scp:root@linode:/home/edrx/" ".ssh") # (find-fline "/scp:root@linode:/home/edrx/.ssh/") # (find-fline "/scp:root@linode:/home/edrx/.ssh/authorized_keys") * (eepitch-subdebian) * (eepitch-kill) * (eepitch-subdebian) * (eepitch-shell2) * (eepitch-kill) * (eepitch-shell2) * (eepitch-shell2) * (eepitch-kill) * (eepitch-shell2) ssh -p 4444 edrx@localhost # (find-file "/ssh:root@localhost#4444:") # (find-file "/scp:root@localhost#4444:") # (find-file "/ssh:edrx@localhost#4444:") # (find-file "/scp:edrx@localhost#4444:") # https://www.garron.me/en/linux/sshd-no-hostkeys-available-exiting.html cd /etc/ssh/ sudo ssh-keygen -A sudo /etc/init.d/ssh start * (find-3ee '(eepitch-shell2) '(eepitch-shell3)) * (eepitch-password-prompt 'yes) * (eepitch-password-prompt 'no) * (eepitch-shell2) ssh-keygen -f "/home/edrx/.ssh/known_hosts" -R "[localhost]:4444" ssh -X -p 4444 edrx@localhost yes edrx xterm & exit * (eepitch-shell3) /usr/sbin/sshd -p 4444 ; ps ax | grep ssh killall sshd ; ps ax | grep ssh exit * (eepitch-shell3) * (eepitch-kill) * (eepitch-shell3) machinectl list sudo machinectl start debian machinectl list sudo machinectl login debian ls -lAF /home/edrx/ sudo machinectl top debian mkdir -p /run/sshd ; ps ax | grep ssh /usr/sbin/sshd -p 4444 ; ps ax | grep ssh /usr/sbin/sshd -p 4444 ; ps ax | grep ssh # (find-fline "/scp:edrx@localhost#4444:") # (find-fline "/scp:edrx@localhost:") killall sshd ; ps ax | grep ssh * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo machinectl stop debian machinectl list ps ax | grep ssh sudo /usr/sbin/sshd ; ps ax | grep ssh * (eepitch-shell2) * (eepitch-kill) * (eepitch-shell2) ssh -X -p 4444 edrx@localhost ssh /usr/sbin/sshd -p 4444 ; ps ax | grep ssh sudo machinectl start debian sudo systemctl stop systemd-nspawn@debian (find-fline "/scp:edrx@localhost#4444:") (find-fline "/scp:root@localhost#4444:") (code-c-d "subdebianr" "/scp:root@localhost#4444:") # (find-esgrep "grep --color -nH -e debootstrap *.e") # (find-es "debrepository" "debootstrap") # (find-es "debrepository" "debootstrap-2018") # (find-status "debootstrap") # (find-vldifile "debootstrap.list") # (find-udfile "debootstrap/") # (find-man "8 debootstrap") # (find-man "8 debootstrap" "--no-check-gpg") # (find-udfile "debootstrap/README.Debian") # (find-fline "/usr/lib/debootstrap/") ##### # # Using debootstrap to install another distro # 2019apr21 # ##### # «install-other-distro» (to ".install-other-distro") # Hints from klys from #grub... <edrx> hi all. I am using a ThinkPad T400 with LibreBoot, and with a single partition with Trisquel that got some bugs with time (long story). I am trying to shrink that partition and create a Debian partition in the rest of the HD, but I'm stumbling on several difficulties - please advise =( <edrx> First: I've been able to read the contents of the flash memory to inspect its grub config, but flashrom says that it may be dangerous to try to overwrite the flash memory. My script to read the flash and the relevant part of the (verbose) output are here: <edrx> http://angg.twu.net/e/libreboot.e.html#libreboot-util <edrx> Second: I downloaded an ISO of an Debian install CD and dd'ed it to a pen drive, following this: https://www.debian.org/CD/faq/#write-usb <edrx> but when I insert that pen drive and boot into libreboot then SOME things break... <klys> trisquel has a kernel, no? <klys> I am accustomed to using debian with custom kernel <edrx> I can run the option 'Search ISOLINUX menu (USB) [u]' in the grub from libreboot. The background image changes, which indicates that it is able to access the pen drive... but TAB completion on device names now freezes grub... <edrx> klys: yes, it's a debian derivative <klys> in that case, perhaps the best way to install will be: debootstrap <klys> granted, you seem to need some help with your new kernel <edrx> yep, that looks good, but does that work well to install a different distro? <klys> yes <klys> I've used it to install old and new debians <edrx> ooooooo =) <edrx> did you keep notes of what you did, or do you have a link that explains how to use that to install a different distro? (I'm googling for that) <klys> so, debootstrap --arch=amd64 stretch /mnt https://mirrors.edge.kernel.org/debian <klys> or buster if you want a frozen stable <edrx> one second, I'm trying to take notes in an organized way... I'll show them to you in a second <klys> it seems buster isn't quite released yet; when it is, jessie will go here: http://archive.debian.org/debian <klys> one option that i've used on some debootstrap commands was: --no-check-gpg # https://www.debian.org/releases/ # The current stable distribution of Debian is version 9, codenamed # stretch. It was initially released as version 9 on June 17th, 2017 # and its latest update, version 9.8, was released on February 16th, # 2019. # The current testing distribution is buster. # (find-man "8 debootstrap") # (find-man "8 debootstrap" "--arch=ARCH") # (find-man "8 debootstrap" "SUITE TARGET [MIRROR [SCRIPT]]") debootstrap --arch=amd64 stretch /mnt debootstrap --arch=amd64 stretch /mnt https://mirrors.edge.kernel.org/debian # Local Variables: # coding: utf-8-unix # End: