LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Installing linux on external usb drive -> How about making a tutorial? (https://www.linuxquestions.org/questions/slackware-14/installing-linux-on-external-usb-drive-how-about-making-a-tutorial-365161/)

narson 09-20-2005 05:47 AM

Installing linux on external usb drive -> How about making a tutorial?
 
Hi

I'm writing with a question. Would it be possible to collect and make one solid tutorial for installing slackware on external usb drive?

I know there are many topics on it, but none gives straight answer how this should be done to work properly. I may be wrong and many will disagree, but I think this would be another good addition to slackware tutorials.

First of all I'm asking people, who managed to do it without pain and big problems, to write possibly clear and brief tutorials with every step descirbed in detail.

I'm not new in slackware, but since I got external usb drive I can't make it work, although I've read all posts related to installation on external usb drives...

...so I'm looking for a solid and described in detail procedure. As there are probably many people looking for solution like this, collecting all into one tutorial would be good idea.

I thought about tutorials for 2.4 and 2.6 kernels.

If you find it a worth attention, please write.

Thank you

drumz 09-20-2005 08:14 AM

What do you mean by "installing on an external USB hard drive?" I've got a really old computer with an 800MB hard drive and the CD-ROM doesn't work. I'm going to borrow my friend's USB to IDE cable and (try to) install Slackware on to the hard drive using my laptop. Is this what you're looking for?

narson 09-20-2005 08:28 AM

It is more less what you say. I want to make full installation of slackware on my external usb hdd na have it capable of booting from it. What is more I'd like it to use 2.4 series kernel rather than 2.6... an of course lilo as bootl loader.
I have mainboard that makes it possible to boot from usb devices and I want to make use of this feature.
That's my point.

Fluxx 09-20-2005 10:13 AM

I installed Slackware on a 1 GB USB flash drive with success and I am able to boot it with every notebook/pc which is able to boot from external USB drives. I am now in hurry but tonight I will be back to give a short how-to ...

Fluxx.

narson 09-20-2005 11:00 AM

@Fluxx
I'd be very grateful if you could do this, because I'm out of options...

Thanks

jimdaworm 09-20-2005 02:46 PM

I would love to see that too... I have a nice 1gb memory key handy :D

Fluxx 09-20-2005 02:50 PM

I did the following steps:

I installed Slackware with all my preferred software and the newest kernel to my harddisk. I use GRUB to boot Slackware with my intern harddisk.

To prepare the installation on a USB harddisk I created on the intern harddisk an initrd.gz, which contains the needed modules for USB/extern so that the root filesystem can be mounted and the boot process starts indeed from the USB disk.

Do this in a terminal as root:

cd /boot
mkinitrd -c -k 2.6.13 -m ehci-hcd:uhci-hcd:ohci-hcd:usb-storage <-- you insert here YOUR kernel-version 2.xy.xy and if your acpi doesn't work eventually needed ACPI-drivers (ac:fan:battery:button:container:processor:thermal)

Then you find the created initrd.gz in the directory /boot.

This initrd.gz I figured out in the following way, so that after loading the USB modules quite in the beginning of the boot process the system has enough time to initialize the connected USB drive.

Do this in a terminal as root:

cd /tmp
mkdir initrd-new
cd initrd-new
cp /boot/initrd.gz .
gunzip initrd.gz
mkdir work
mount -o loop initrd work
cd work
mcedit (or vi or vim or another texteditor) linuxrc

Now insert these lines in the opened linuxrc after line 69 before the line with "Initialize LVM":

echo "Detect and initialize USB drives ..."
sleep 10

Then save and close the file linuxrc and go on with:

cd ..
umount work
rm -R work
gzip -n9 initrd
cp initrd.gz /boot
cd ..
rm -R initrd-new

Close the terminal.

Now plug in your USB drive and format it with ext2/ext3 (if you choose reiserfs or xfs you have to add the needed modules to the initrd.gz so that the root filesystem can be mounted). Then mount it and open a terminal and type as root (now you copy your Slackware installation to the external USB drive):

cd /
cp --preserve -R /{boot,bin,dev,etc,home,lib,mnt,opt,root,sbin,usr,var} /mnt/sda1 <-- where your USB drive is mounted, here it is /mnt/sda1
cd /mnt/sda1
mkdir (proc,sys,tmp)

Then install GRUB (it must be installed on your harddisk) to your USB drive and write:

grub-install --root-directory=/mnt/sda1 /dev/sda

When finished the GRUB installation go on in the terminal as root:

cd /mnt/sda1/boot/grub
rm menu.lst <-- it is not a number 1 but a l
mcedit menu.lst (or vi or vim or another texteditor)

Here you insert the following or similar text:

color light-gray/blue
fallback 0
timeout 10
default 0
#
title Slackware
kernel /boot/vmlinuz root=0x801 ro vga=0x317 <-- 0x801 means the same as /dev/sda1
initrd /boot/initrd.gz
#

Save and close the file menu.lst.

Umount the USB drive and reboot.

Everything should work fine and Slackware should boot from external USB drive or harddisk.

I use kernel 2.6.13, I don't know if it will work with a 2.4.xy kernel. I use the generic kernel without any changes, I added only the ACPI modules to the initrd.gz, because this is a way to force hardware to a proper ACPI with fan, battery, lid and button.

Try it and I hope that I could write everything in a clear matter (English is not my mother language ...).

Fluxx.

P. S. If there is an error during loading GRUB after Stage 2 "Error 21" it is a BIOS problem on some notebooks/pcs. Then you can use "extlinux" if you use "ext2/3-filesystem" to boot the USB drive. It works fine for me on some notebooks.

narson 09-20-2005 05:01 PM

Thanks Fluxx! Thanks for your work. I like your howto and the way it is described.

Tomorrow I'll check it but will try with 2.4 kernel. ...otherwise 2.6 :)

Fluxx 09-21-2005 03:14 AM

Please take notice of a change in the file "menu.lst":

Instead of

root=/dev/sda1

write

root=0x801

because there may be an error message that the root filesystem can not be mounted on /dev/sda1.

I changed it in the original post.

Fluxx.

P. S. And you have to edit your /etc/fstab

/dev/sda1 / your_filesystem defaults 1 1 <--- instead of /dev/hda1, so that the right root partition will be mounted

at the USB drive and create a SWAP partition if needed.

narson 09-21-2005 12:12 PM

@Fluxx

Before making usb hard drive bootable I made a full slackware installation on that disk using default, bare.i kernel. I made initial configuration of all services and finished installation process without errors.

Today I tried your solution, but made some modifications since the only OS I have is on the usb drive I try to boot up :)

..and so
First of all I didn't touch 2.6 kernel and did all on default 2.4(.31)

Because I cannot boot slackware even with default CD1, after booting into "installation mode" I just activate swap and initialize /dev/sda2 partition (the one with linux). Then I chroot to /mnt, where I have existing slackware installation mounted... and then I can do thing you mentioned in your posts.

Bootloader:
...since I couldn't make it work with lilo, I tried grub as you did and I found it more succesful solution for usb drives. In my case lilo was always terminated with "L" at boot time.

Finally going step by step through your howto I made it work, but... I got lots of messages telling me, that modules in initrd-tree aren't ELF files. Few people reported problem on similar topics and it turned out that modules in initrd.gz shouldn't exist as compressed (.gz) files. Running gunzip on each module in initrd-tree and repeating mkinitrd without params was a solution for that.

To make sure I ran grub-install one more time.

I finally got it boot up. Grub started without any problems and loaded kernel and initrd.gz. Everything went fine and usb devices where detected properly. This stage was finished with success.
After that, all standard services began to initiate. Until that moment everything was ok.
When I reached "Going multiuser..." a line below appeared:

/etc/rc.d/rc.inet1: /sbin/ifconfig Io 127.0.0.1

...and that's it. I'm stuck again :(

Any ideas? In slackware setup I set network to use dhcp and disabled all rc. 's available(shown) in one of the last stages of installation process.

Please help!

Fluxx 09-21-2005 03:10 PM

I don't understand your sentence

"disabled all rc."

Did you disable all rc.files in /etc/rc.d or what does it mean?

Fluxx.

narson 09-21-2005 03:23 PM

You're right, I may not be clear enough. One of the last stages of slackware installation is a dialog in which user selects the services to run after succesfull boot up, such as rc.inet, rc.pcmcia, rc.syslog and so on... So I choosen none from above and continued setup.
..and no, I didn't touch other scripts in /etc/rc.d. I made clean, standard installation, without any extras.

I boot up and simply everything freezes after the line I mentioned in previous post. :(

Fluxx 09-21-2005 04:04 PM

I think (I never did a Slackware 10.2 installation) that some important rc.files are not set +x so that they cannot start.

Just after your system stops booting the rc.syslog and the rc.hotplug would start to detect hardware. May be here is the problem. May be that rc.hotplug is running and stops because of a hardware problem. The output of dmesg or /var/log/messages could give more informations ...

Here a few lines of the output of my /var/log/messages:

...

Sep 21 22:43:11 slax logger: /etc/rc.d/rc.inet1: /sbin/dhcpcd -d -t 60 eth0
Sep 21 22:43:11 slax logger: /etc/rc.d/rc.inet1: /sbin/dhcpcd -d -t 60 eth0
Sep 21 22:43:12 slax dhcpcd[2641]: infinite IP address lease time. Exiting
Sep 21 22:43:12 slax dhcpcd[2644]: infinite IP address lease time. Exiting
Sep 21 22:43:12 slax logger: /etc/rc.d/rc.hotplug start (entering script)
Sep 21 22:43:13 slax modprobe: FATAL: Error inserting shpchp (/lib/modules/2.6.13/kernel/drivers/pci/hotplug/shpchp.ko): Operation not permitted
Sep 21 22:43:18 slax last message repeated 33 times
Sep 21 22:43:29 slax logger: /etc/rc.d/rc.hotplug start (exiting script)
Sep 21 22:44:04 slax kernel: NET: Registered protocol family 10
Sep 21 22:44:04 slax kernel: Disabled Privacy Extensions on device c0385400(lo)
Sep 21 22:44:04 slax kernel: IPv6 over IPv4 tunneling driver
Sep 21 22:44:07 slax dhcpcd[6178]: infinite IP address lease time. Exiting

...

Somewhere here your system stops.

But I have no answer why ...

Fluxx.

narson 09-22-2005 03:04 AM

@Fluxx
Hi

I chcecked my /var/log/messages but found nothing :/

Here are few lines of mine output:
...
Sep 21 17:59:19 cytrynka kernel: agpgart: AGP aperture is 64M @ 0xe0000000
Sep 21 17:59:19 cytrynka kernel: scsi1 : SCSI host adapter emulation for IDE ATAPI devices //I guess that after this line it goes multiuser
Sep 21 17:59:19 cytrynka logger: /etc/rc.d/rc.inet1: /sbin/ifconfig lo 127.0.0.1

..and that's it. System stops and nothing happens :( In installation I set my network to use dhcp (I have router dhcp-enabled) as in my win os.

After reading initrd.gz everything is detected properly. I enabled my eth interface in rc.modules and it was found either.

In comparison to yours I began to worry, that something must have gone wrong... As you can see I never reach the moment, where rc.hotplug is executed.
I'm stuck again :/
Since it's default/generic slackware installation, I can't simply find out what went wrong(!!!) :(

Fluxx 09-22-2005 04:14 AM

Did you disable "hotplug" when beeing asked during the installation process? This is my only idea to solve this problem at the moment ...

Fluxx.


All times are GMT -5. The time now is 05:07 AM.