• Re: [gentoo-user] chroot: on update I got "mount: /proc: mount failed:

    From Michael@21:1/5 to All on Wed Jul 17 20:50:17 2024
    Hi Vitaly,

    On Wednesday, 17 July 2024 18:08:08 BST Vitaly Zdanevich wrote:
    Hi, I did a chroot according to https://wiki.gentoo.org/index.php?title=Chroot

    My script in the chroot folder:

    ```
    mount --rbind /dev dev
    mount --make-rslave dev
    mount -t proc /proc proc
    mount --rbind /sys sys
    mount --make-rslave sys
    mount --rbind /tmp tmp
    mount --bind /run run

    mount -o bind /var/db/repos/ var/db/repos/

    chroot . /bin/bash

    ```
    [snip ...]

    The wiki and the Handbook, explain you need to have a mountpoint for the file system in which you are trying to chroot.

    For example, the wiki page states:

    mkdir /mnt/mychroot <== this is the mountpoint
    cd /mnt/mychroot

    or if you are trying to chroot on an existing installation on some block device, e.g. say it is partition /dev/sdb3, you would run:

    mkdir /mnt/mychroot
    mount /dev/sdb3 /mnt/mychroot

    Consequently, the mount commands after you mount the OS partition and before you chroot become:

    cd /mnt/mychroot
    mount --rbind /dev /mnt/mychroot/dev
    mount --make-rslave /mnt/mychroot/dev
    mount -t proc /proc /mnt/mychroot/proc
    mount --rbind /sys /mnt/mychroot/sys
    mount --make-rslave /mnt/mychroot/sys
    mount --rbind /tmp /mnt/mychroot/tmp
    rmount --bind /run /mnt/mychroot/run

    After the above you can chroot into the mounted filesystem:

    chroot /mnt/mychroot /bin/bash


    The same approach is followed in the Handbook for a new installation:

    https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/ Base#Mounting_the_necessary_filesystems

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCAAdFiEEXqhvaVh2ERicA8Ceseqq9sKVZxkFAmaYIHkACgkQseqq9sKV ZxmBPQ//V465gusXFbgIGPfoMiL27/djQCdCLhQnUni/qGfSjSgV6uVNydvsxDMJ BPWUZjEmKlddOBrbdXiKH+Z1X8v4j623DfS5Qz71g7XsebZiQFXT4KkiR4dF72cv qd8xXJkHn5mLG84k/Mk1Pjwgh9Zg2TB4pw0xbs6PeTaZ6rgU7qCcdEFVj9tdIWVF 7wXjUKI8enQ98TJJkGAr253HzK/+pU0598S/okfomO/z7vb7BZYUN/9gP3yC2gcQ Ob5vO3pm/JpqgfmGefEF+cvktkhT1UsuG5UHkenja6wQ+XZrXh3Nzm2ExnudF7oi /ADB0k+eQdf4xkCHLfMloaY6OkjzhfSrOCFmMpBUNNxkF91vd1MzupyYv4EnIE0P ORtmKhbsok8E4H67Mg3JZEA/Is9KDZgPcbok6yflWjP29GaptvSt327kpz0N3RL6 TdRLKl0qPALaW8TfizBLBvB0q4453eRU6IBF5Or/X6esNMqX85Y5I5M/06JYVaeK TwYZYqXBlAE3Yi3o5gRfz1THDnkRcnbZBXzAuij3ZQM4Gj5FvFhGQAw+wyA0mB2b wPRjNqQH124njzRt8HJlpGyVzN1ZbGMBtY3OHnBAYHLpFrHAsYemGzwcNqjh0uT3 hQ10atJUN+QrbmBF/gGgQ4JH39iZ1WUxVSdSbtN/gC8Kl2PefpE=
    =Zt2/
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)