LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - Installation (https://www.linuxquestions.org/questions/slackware-installation-40/)
-   -   Install Slackware to a folder using chroot? (https://www.linuxquestions.org/questions/slackware-installation-40/install-slackware-to-a-folder-using-chroot-825598/)

linus72 08-11-2010 12:53 PM

Install Slackware to a folder using chroot?
 
Is it possible to somehow install Slackware from DVD to a folder on hdd
somehow using chroot?

I can say take a debian livecd, unsquashfs the filesystem, chroot into that folder and remaster it quickly
Can I somehow do the same with Slackware?
thx

tlowk 08-11-2010 03:17 PM

the slackwaretool installpkg has the option '--root' for this, so if you install the required package like that it will be close. but to start it you probably need to use bindmounts for stuff like sysfs, proc, and maybe dev.

I don't know there exists a tool for this. There are on the other hand diskimages for UML (user-mode-linux) that you could mount via the loop option and get the content of that one.

Probably you need to avoid starting stuff like udev in the slackware system since the system that contains the chroot will already have this running.

just my thoughts, I never tried to run slackware on another system in a chroot.

linus72 08-13-2010 06:55 AM

OK
I may have some progress
first; I copy data from Slack livecd to folder on hdd
I have a full slackware install to sda1 and am gonna copy livecd to folder "minimal" on that hdd slackware partition

gonna copy everything to /target/minimal
mount partition example sda1
Code:

mount /dev/sda1 /target
mkdir -p /target/minimal

Code:

cp -R --preserve /bin /target/minimal
cp -R --preserve /boot /target/minimal
cp -R --preserve /dev /target/minimal
cp -R --preserve /etc /target/minimal
cp -R --preserve /home /target/minimal
cp -R --preserve /lib /target/minimal
cp -R --preserve /opt /target/minimal
cp -R --preserve /root /target/minimal
cp -R --preserve /sbin /target/minimal
cp -R --preserve /srv /target/minimal
cp -R --preserve /usr /target/minimal
cp -R --preserve /var /target/minimal

now gotta make other folders there

Code:

mkdir -p /target/minimal/media
mkdir -p /target/minimal/mnt
mkdir -p /target/minimal/opt
mkdir -p /target/minimal/proc
mkdir -p /target/minimal/sys
mkdir -p /target/minimal/tmp

now chroot into filesystem and start Xnest

Code:

mount --bind /dev/ /target/minimal/dev
mount -t proc none /target/minimal/proc
mount -t sysfs none /target/minimal/sys
mount -t devpts none /target/minimal/dev/pts

export HOME=/root
export LC_ALL=C

chroot /target/minimal

have Xnest installed and start it

Code:

Xnest -ac :2 &
env DISPLAY=":2" startfluxbox &

now, how do i get dbus/hal going before I start Xnest?
any ideas?
thx

ChrisAbela 08-19-2010 02:59 PM

Quote:

now, how do i get dbus/hal going
Xen is your friend

slac-in-the-box 09-10-2010 03:13 PM

chroot
 
I've installed slackware in a chroot before, but I went about it differently:

Instead of copying all the directories and making directories, I let installpkg do it... I just navigated to a directory containing the slackware sets, and then would use installpkg command:

Code:

installpkg --root /chrootarget a/*.txz ap/*.txz d/*.txz k/*.txz l/*.txz n/*.txz x/*.txz xap/*.txz
The first package of the "a" set of packages (aaa_base) creates the /etc, /bin, /sbin, and other needed directories when it is installed...

Sometimes I have some directories on their own partitions (I put /tmp, /var, and /home on their own partitions, because /tmp and /var grow with log files and data, and I don't want them to grow so much that there is no space left on my root partiton; and I keep /home separate so I can back up user data efficiently)... in this situation, I have to manually create /var, /tmp, and /home in the /chrootarget directory, and then manually mount the partitions on those directories before proceeding with the installpkg command.

When installpkg is finished, I bind the system's running directories to their corresponding directories in the chroot with the mount command:

mount -o bind /proc /chrootarget/proc
mount -o bind /sys /chrootarget/sys
mount -o bind /dev /chrootarget/dev

After that I can chroot:

chroot /chrootarget /bin/bash


And I then do things like set root password, add users, setup permissions in /etc/group, configure xorg if necessary, etc.

I have had to install slackware this way on devices with broken cd drives and other obstacles to standard installation, and in the end, I rebooted, and one of the rc scripts sets up the encryption keys for the first time. If you were never planning to boot the system into slackware, but always be running in chroot, then you might need to run what was in those rc scripts manually (i.e. ssh keygen, etc.)

ChrisAbela 09-13-2010 09:34 AM

Yes.

Given the simplicity with which Slackware is built, the possibilities on how you may install are many. It shows why a Graphic installer and a fancy package manager would get in your way.

Alien Bob 09-14-2010 04:21 AM

Quote:

Originally Posted by slac-in-the-box (Post 4093831)
I've installed slackware in a chroot before, but I went about it differently:

Instead of copying all the directories and making directories, I let installpkg do it... I just navigated to a directory containing the slackware sets, and then would use installpkg command:

Code:

installpkg --root /chrootarget a/*.txz ap/*.txz d/*.txz k/*.txz l/*.txz n/*.txz x/*.txz xap/*.txz

This is exactly how I install Slackware in it's own chroot (a fast and useful method for building clean packages if you do not want to mess with virtual machines).

A few notes before you start a shell in the new chroot (by running "chroot /your_chroot bash -l" instead of actually booting onto your fresh install):
  • you will have to create a etc/fstab file in the chroot manually since you did not use the Slackware setup to have that file created for you
  • When getting the error in a freshly installed chroot: "D-Bus library appears to be incorrectly set up; failed to read machine uuid" , that is because in your chroot the scriipt "rc.messagebus" has not been started, so it has never executed the line
    Code:

    /usr/bin/dbus-uuidgen --ensure
    which populates the file "/var/lib/dbus/machine-id" with a new UUID.
    Copying that file "/var/lib/dbus/machine-id" from the Linux host into the chroot solves the dbus error.

Eric

alekow 09-29-2010 05:10 PM

Quote:

Originally Posted by slac-in-the-box (Post 4093831)
I've installed slackware in a chroot before, but I went about it differently:

Instead of copying all the directories and making directories, I let installpkg do it... I just navigated to a directory containing the slackware sets, and then would use installpkg command:

Code:

installpkg --root /chrootarget a/*.txz ap/*.txz d/*.txz k/*.txz l/*.txz n/*.txz x/*.txz xap/*.txz

Shouldn't it be
Code:

installpkg --root /chrootarget a/*.t?z ap/*.t?z d/*.t?z k/*.t?z l/*.t?z n/*.t?z x/*.t?z xap/*.t?z
?

There are still few tgz packages in the installation directories.

Alien Bob 09-30-2010 02:47 AM

Exactly. The .tgz packages which would be missed by the original command, are essential to Slackware's proper functioning.

Eric


All times are GMT -5. The time now is 08:22 PM.