(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=43632379

这篇 Hacker News 讨论帖围绕 Linux 中的 `chroot` 技术展开,起因是一篇文章称赞了 `chroot` 的多功能性。用户分享了使用 `chroot` 完成诸如磁盘配置和针对特定库版本构建软件的案例。 一些评论者表达了对 `chroot` 更现代、更健壮的替代方案的需求,有人建议使用 FreeBSD 的 jails,`systemd-nspawn` 或 LXC 等作为潜在的解决方案。`chroot` 的不足之处与 Docker 等容器化技术形成了对比,尽管有人反对 Docker 的复杂性。 讨论还涉及到通过 `qemu-user` 和 `binfmt` 使用 `chroot` 来处理异构 CPU 架构,并提到了 Arch Linux 和 Manjaro 等发行版中围绕 `chroot` 的包装脚本在配置新安装系统时的便利性。还提到了一个名为 `proot-docker` 的项目,旨在利用 `proot` 和 `skopeo` 简化 Docker 的工作流程。

相关文章
  • chroot技术——Linux系统的瑞士军刀 2025-04-09
  • (评论) 2023-10-30
  • (评论) 2024-01-14
  • (评论) 2024-01-01
  • (评论) 2024-07-27

  • 原文
    Hacker News new | past | comments | ask | show | jobs | submit login
    The chroot Technique – a Swiss army multitool for Linux systems (livesys.se)
    16 points by mariuz 47 minutes ago | hide | past | favorite | 14 comments










    Currently working on scripts to provision a drive outside of the machine it’s meant to go on using chroot. I’ve so far accidentally unmounted /dev/pts several times from the host system and running docker inside the chroot caused a hard lock. Fun stuff.


    Haha, learned this technique while installing Void Linux


    Ah - my attempt at doing this was almost there, except for the few bits that kept erroring out because I didn't mount the proc,dev,etc. mountpoints correctly :) Something to give another whirl on. At the time, I wanted something simple without docker to store everything development-related using different libraries. This is where debootstrap+chroot comes in - to build against various versions of libraries in Debian (if I remember correctly - it's been awhile.)


    I actually wish that instead of docker & etc we had just gotten a better chroot... Or maybe just a new kernel syscall that is chroot()++.


    what would "better chroot" do?


    Working on proot-docker, a bash script on top of skopeo and proot:

    https://github.com/mtseet/proot-docker

    We need more people to improve it!



    Come to FreeBSD, we have just that - jails.


    Pids and cgroups all the way down (also why the wise greybeards rejected docker)


    Isn't LXC more or less an unsupervised chroot in an isolated process?


    systemd-nspawn is probably what you want.


    With qemu-user and binfmt you can even chroot into foreign CPU architectures, which is a handy thing to have when you mount your phone's eMMC to fix a hacking session gone wrong.

    Though these days you may want to look into things like systemd-nspawn instead of plain chroot.



    The arch linux install has a little wrapper around chroot, used to configure the installed system without booting it.

    https://wiki.archlinux.org/title/Installation_guide#Chroot



    Manjaro has the same, I'd assume inherited from arch and modified.

    I just wish the script could figure out a BTRFS drive without me manually mounting volumes :(



    Gentoo’s stage3 would like to say a word






    Join us for AI Startup School this June 16-17 in San Francisco!


    Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



    Search:
    联系我们 contact @ memedata.com