new versions of gcc on Debian Linux

By: Adrian (a.delete@this.acm.org), September 21, 2022 4:42 am
Room: Moderated Discussions
Andrey (andrey.semashev.delete@this.gmail.com) on September 21, 2022 3:45 am wrote:
> Adrian (a.delete@this.acm.org) on September 20, 2022 8:44 pm wrote:
> > Andrey (andrey.semashev.delete@this.gmail.com) on September 20, 2022 9:35 am wrote:
> > > Adrian (a.delete@this.acm.org) on September 20, 2022 7:23 am wrote:
> > > >
> > > > I have never used Debian, but in many Linux distributions you can make a directory, mount there /proc, /sys
> > > > and /dev, chroot into it and install there the same Linux
> > > > distribution or another one, and also install there
> > > > whatever packages you want and test them or use them without modifying in any way your base system.
> > >
> > > It's not as simple as that. You need /etc, /bin, /usr and /var (at least major parts of them) to
> > > be able to run shell, basic shell tools like grep/sed/python/etc. and apt, which also requires network
> > > to work. Since you're going to install packages and you don't want to affect the host system, those
> > > directories must not be mounts but rather different copies or something like overlayfs.
> > >
> > > There is a pbuilder tool (or cowbuilder flavor of it) that prepares an environment image automatically,
> > > but it is better suited for building packages, not for interactive development.
> > >
> >
> >
> > In my experience, it is actually as simple as that.
> >
> > Maybe there are Linux distributions with weirder requirements, but on all that I
> > have used (I never use systemd), it is enough to do this sequence of commands:
> >
> >
> > mkdir /home/user/test_dir
> > cd /home/user/test_dir
> > mkdir dev etc root proc sys
> >
> > mount -t proc none proc
> > mount --rbind /sys sys
> > mount --rbind /dev dev
> > cp /etc/resolv.conf etc
> >
> > env -i HOME=/root TERM=$TERM /bin/chroot . bash -l
> >
> >
> > Copying resolv.conf from the host Linux system is enough to make networking work.
>
> Nope, doesn't work for me:
>
> /usr/sbin/chroot: failed to run command 'bash': No such file or directory
>
> As I said, bash needs to be runnable within the new root. Same with
> any other program you want to run in the chroot environment.
>


Sorry, maybe I was not clear enough.

Obviously, you cannot run anything from an empty directory.

I have said that you first need to install a Linux distribution in that directory.

With the Linux distributions that I normally use (e.g. Gentoo), an installation is done by extracting an archive with a bootstrap stage into the empty directory, which populates the directory with bash and the other executables required for performing an installation.

Then, from the chrooted environment the installation of the complete distribution from the Internet is done according to the procedure specific for that distibution, using the bootstrapping programs.


The point was that this distribution installed in that directory is completely independent of the host distribution, with which it shares no files. So you can install completely different compilers, libraries or any other applications, without any interference. You can install e.g. a Fedora Linux or an Arch Linux under a Gentoo host, or vice-versa.




















< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
new versions of gcc on Debian LinuxMichael S2022/09/19 10:28 AM
  new versions of gcc on Debian LinuxAndrey2022/09/19 02:08 PM
    new versions of gcc on Debian LinuxMichael S2022/09/19 02:45 PM
      new versions of gcc on Debian Linuxanon22022/09/19 03:51 PM
        new versions of gcc on Debian LinuxMichael S2022/09/20 02:05 AM
          new versions of gcc on Debian Linuxanon22022/09/20 02:55 AM
            new versions of gcc on Debian Linuxanon2022/09/20 12:06 PM
          new versions of gcc on Debian Linux-.-2022/09/20 07:02 AM
          new versions of gcc on Debian LinuxAdrian2022/09/20 07:23 AM
            new versions of gcc on Debian LinuxAndrey2022/09/20 09:35 AM
              new versions of gcc on Debian LinuxAdrian2022/09/20 08:44 PM
                new versions of gcc on Debian LinuxAndrey2022/09/21 03:45 AM
                  new versions of gcc on Debian LinuxAdrian2022/09/21 04:42 AM
          new versions of gcc on Debian LinuxMark C2022/09/20 08:15 AM
          new versions of gcc on Debian LinuxAndrey2022/09/20 09:46 AM
          new versions of gcc on Debian Linuxgoose2022/09/20 11:36 PM
      new versions of gcc on Debian LinuxAndrey2022/09/20 09:54 AM
        new versions of gcc on Debian Linuxnone2022/09/20 10:30 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell tangerine? ūüćä