Installing Slackware to loop file from EXISTING Slackware
I'm running Slackware on my laptop, I have created an ext3-formatted file to use as a loop device, and on this file I want to install Slackware.
How do I do it? I've got the Slackware CD's, but I can't find the 'setup' application. I think it's inside the isolinux/initrd.img file, but I can't mount it to see what's inside.
You can't really easily install from a running system. You should probaly just reboot with the installer CD, use losetup to associate your big file with the loop device and then mount the device and procedd more or less normally. Actually, I've worked out how to install from a running system using the regular installpkg, but you have to 'explode' the glibc package, edit the doinst.sh a little and repackage it so it correctly makes the links on your new ROOT partition.
There is another way which is pretty easy if you want to simply duplicate your running system. Look up the old instrucrions for zipslack and read about 'migrating' the install to a normal linux partition. Basically, you just need to mount the target parttion(file in your case) and copy over your running system *minus' the proc, sys and mount directories. Create them manually before or after copying everything else over. I've bben meaning for a long time to write PatV and tell him about the trick with the glibc doinst.sh as it still plays nicely with regular installations or upgrades and makes it really easy to install a new system without having to run the installer.
Thanks for your reply!
What I am trying to avoid is burn the installation CD's... But from what you say it seems that there's no other EASY way...
You want to install Slackware to a file on your comp with a preexisting linux?
you want to install slackware on your COMP without burning DVDs, use the usb-boot images provided in teh DVD
You can also mount the iso, copy the initrd into your /boot dire and create an entry in your lilo or grub cinfig file which will boot the installer that way. Then before running setup, use losetup to setup the iso as a loop device, then mount that and use the installation method for installing packages from an already mounted directory.
As I mentioned, you can also use the installpkg on your running system. Just mount the partition somewhere, for instance say you want to install to /dev/hda6.
Make a mount point:
mount /dev/hda5 /mnt/hda6
then mount the installer iso someplace and cd into the dir where the /a series of packages is.
Start by installing the aaa_base package (always using ROOT=)
ROOT=/mnt/hda6 installpkg aaa_base*.tgz
then the etc package:
ROOT=/mnt/hda6 installpkg etc*.tgz
Have a look to convince yourself it's working:
Then take a break and fix the glibc-solibs package you want to install. Copy it from the mounted iso into a convenient place, cd into the dir and then run:
Then cd into the /install directory and edit the doinst.sh like the onme below. I've left out most of the lines toward the end of the script which are for creating the links. You can copy and paste to make it easier. Just whack off the top of the script and paste the top part of the script below into the doinst.sh. Then save it and repackage the package. First remove the eisting glibc-solibs*.tgz, then just run makepkg to create the new package. Then install it to your new partition as above:
ROOT=/mnt/hda6 installpkg glibc-solibs*.tgz.
Then cd back into the directory where the /a series packages are and run
ROOT=/mnt/hda6 installpkg *.tgz and flollow by installing the other series or selected packages.
The only thing you must do to make that bootable is to copy or create an fstab there. Of course you are doing that all onto a partition image, but if you were able to cerate that and format it I'll assume you know how ot mount that instead of a real partition. It's still much easier to just copy over the initrd from the installer and create a boot entry for that, but I've tried to answer your original question. The glbc packages are the only ones that I know of that need to be fixed in order to succesfully install them from your running system. The only reason they need to be fixed is because otherwise installpkg will create the links on your running system instead of in the new ROOT partition(or image). The changes applied to the doinst.sh just change the way that the script decides what to do. The logic of the original script does one of two things: If the package is being installed by the installer it creates the links manually. If the package is being installed on a running system then there is an ldconfig present and so it is run to create the links. The changes simply make the script use a different logic to decide what to do. It will still work correctly in the two normal cases, but will also allow you to use installpkg with ROOT variable set and have the links created on the target instead of runnigng ldconfig which would create links to the new libs on your present system. If you also install the full glibc package remotely you'll need to do do the same trick with the doinst.sh.
gnashley, I like your method, but that's not the way I wanted to do it :-) I'll try that as last hope..!
However, I tried to install Slackware from CD, but I couldn't tell 'setup' to install to /dev/loop0, which is where I losetup'ed the image file to which I want to install Slackware. 'setup' only lists /dev/hda6 (which is where my current Slackware is) as installation target..
What can I do?
Thanks everybody for your help..!
IF you want to install to a file ... install using qemu ... read up on it ..
you will start qemu with cdrom as the slack dvd and harddisk as the image file you want to install to. Then on it should be really easy.
The fact is that I want to install Slackware to a file but I'm not going to boot it on my machine, but on another which doesn't have qemu. However, I'm not a virtual machine expert, so I don't know if the image that I generate with qemu is a normal ext2/3 image file or a special qemu file.
If I can use it as a normal image file, i.e. I can normally mount it with '-o loop', than that would be the perfect solution.
About the other problem, the fact that Slackware setup doesn't list /dev/loop0 as installation target, what could I do?
iirc, it generates a normal file which you can mount as a loop device. Just make sure you do not use any special stuff (like increase file size as more things are added etc. ).
If you really wanna have fun, use lquest from the 2.6.23 kernel!
I'm trying to install Slackware to a loop device also, so that I can then share out that file using iSCSI and do a diskless PXE boot from that iSCSI disk. I am booting from the CD and then mounting the partition with the loop file in it, then using losetup to create and cfdisk to partition it. I just have the one little problem of telling the Slackware installer to install to /dev/loop0p1. It seems like a waste to go to all the trouble of setting up QEMU when we just need to find the argument or edit the file that will let the Slack 'setup' script install to a nonstandard or non-autodetected location. I'll play around with it and let you know if I figure anything out.
I found something that said you could run
but this was from a very old version of Slack and apparently doesn't work anymore. Nor does
setup -root /mnt
work either, more's the pity.
The solution is to not use the installer and install the packages by hand.
mount /dev/hda1 /mnt2
losetup /dev/loop0 /mnt2/myfile.img
mount /dev/loop0 /mnt
mount /dev/hdb /mnt3
installpkg -root /mnt *.tgz
That gets the A package installed, repeat for your other package directories like AP, D, L, N, X, and XAP as desired.
Of course, I still have to set up a TFTP server and IET (iSCSI Enterprise Target) before I know if it worked, but I think this is the right track... the only downside is, no configuration will have been done, for the network, or an X window manager, timezone, etc. I wish there was a way to tell setup on the command line what device or directory to install to!
Guess what, 'setup' isn't a binary... it's just an ordinary shell script in /usr/lib/setup!
I found the magic line inside it. Apparently it just runs a 'probe' command and allows you to choose from any partitions of type 'Linux'. So right after the second probe line, I used 'nano' to insert another line into the script that said this:
echo "/dev/loop0" >> $TMP/SeTplist
Now when you run setup, /dev/loop0 shows up as an option! Woot!
I was too chicken to let setup format it though, lest it actually nuke my linux install at /dev/hda1. So I just ran an mkfs.ext2 beforehand and mounted it in /mnt, and then selected 'No, don't format it' in setup.
Install is progressing as I type this. 'df -h' shows my /dev/loop0 filesystem mounted in /mnt growing as the install runs. :)
This sure beats temporarily installing a physical hard drive in my diskless workstation to install Linux on, then installing that drive in my iSCSI target, then 'dd'ing the disk sectors into a file, then removing the drive again.
I know this is an old thread, but I just discovered another way to trick Slack's setup into installing where you want it to. In my case, I wanted to install TO NFS (not from NFS!) for a diskless NFS-Root install. The trick is to attach any handy block device, such as a USB flash drive (size does not matter, very small is just fine), and partition it and configure setup as if you were going to install to it (do not, however, format it -- you need an unformatted Linux partition). Then, when you get to the screen that asks if you want to do a "full" install, hit Ctrl-F2 for a second console. There, unmount the flash drive from /mnt, then mount wherever you really want things to install to(in my case, "mount -t nfs server:/export /mnt -o nolock"). Then flip back over to Ctrl-F1 and hit Continue in setup. Voila. :)
|All times are GMT -5. The time now is 08:17 PM.|