dragora-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dragora-users] Getting Dragora 2.2 Running on a USB Drive


From: Matias Fonzo
Subject: Re: [Dragora-users] Getting Dragora 2.2 Running on a USB Drive
Date: Tue, 17 Apr 2018 19:15:55 -0300

Hello,

On Tue, 17 Apr 2018 01:45:09 -0400
David Friedman <address@hidden> wrote:

> Just wanted to share my experience getting Dragora 2.2
> running on a USB drive.

Welcome!

> So I don't have a specific question but figured maybe this could
> be useful to other people who might be trying to do the same
> thing or something similar.

Probably.

> It might come up in some searches.

Your method differs from
http://dragora.org/repo.fsl/doc/trunk/www/dragora2/guides/bootableusb.md

I don't know if you have tried it before.

> I used the same approach as I had done with CRUX back in
> September of 2016.
> 
> https://lists.crux.nu/pipermail/crux/2016-September/005188.html
> 
> I didn't really know exactly how to do it, but bumped around a
> bit and eventually got it going.
> 
> Getting Dragora onto the USB drive went smoothly. I let it
> know the partition to install to and so the Dragora files were
> copied there.
> 
> I didn't have Dragora install GRUB as I already had GRUB set up
> when I installed OpenSUSE on another partition.
> 
> So then when I tried to use GRUB to boot that parition it failed,
> as it couldn't access it.
> 
> So to get it to work I first tried using the busybox (v1.22.1)
> and other files that I used for CRUX. I created the initramfs
> with cpio and let GRUB know where to find the initramfs file on
> the partition.  Once I got a shell I figured I could try to mount
> the relevant partition.
> 
> When I booted it up though it didn't work. There seemed to be
> some kind of incompatibility between the kernel and busybox.
> 
> So then I tried using the busybox (v1.19.4) and other files from
> the Dragora installation USB thumb drive.
> 
> I again created the initramfs using cpio. In the case of the CRUX
> initramfs for the CRUX installation system it turns out that init
> is a shell script, but in the case of Dragora init is a symbolic
> link and so in Dragora installation startup processing is done in
> /etc/rc.d/rc.S which then draws from /etc/profile.
> 
> For making my initramfs I tried commenting out most of the lines
> of code in /etc/rc.d/rc.S.
> 
> I guess I was just looking for a minimal initialization so that I
> could mount the relevant partition and then do switch_root as I
> had with CRUX.
> 
> I think I commented out everything. It still booted up and I got
> a shell. I was also still able to mount the relevant partition
> (unlike with CRUX I didn't need to compile into the kernel
> modules for reading a USB drive).
> 
> But then there wasn't any switch_root in the version of busybox
> (v1.19.4) for Dragora 2.2.
> 
> I thought that maybe chroot would have similar functionality so I
> tried that:
> 
> exec /sbin/chroot /newroot /sbin/init
> 
> But it didn't work.
> 
> So I tried downloading a more recent version of busybox from the
> busybox site. (v1.21.1).
> 
> I could see that that version has switch_root when I ran it in
> openSUSE, and when I tried it in the initramfs it still booted up
> fine and I got a shell prompt.
> 
> I wasn't sure what setup I needed before doing the switch_root. I
> tried going with very little, but it didn't work.
> 
> So I tried going with a setup similar to CRUX where init is a shell
> script instead of a symbolic link as in the Dragora installation.
> 
> In the init file as a shell script I put in basically the same
> processing as had been in the Dragora /etc/rc.d/rc.S (although
> for my particular setup I didn't do anything with RAID or LVM as
> I don't have those).
> 
> After doing that setup I then mount the relevant partition.
> 
> Then I undo all of that setup which was done prior to the
> mounting step.
> 
> Then I do the switch_root which goes to the init on the Dragora
> partition.
> 
> (I can include the init shell script that I currently have to
> boot Dragora at the end of this email, so of course, one would
> need to modify it for another particular setup)
> 
> There was one more wrinkle to work out.
> 
> When I did the installation it turned out that the USB drive was
> /dev/sdc. The thumb drive was /dev/sdb and the hard drive itself
> was /dev/sda.
> 
> When it booted it looked for /dev/sdc which didn't exist because
> there was no thumb drive and the USB drive was /dev/sdb.
> 
> All I had to do was change /etc/fstab so that it was /dev/sdb
> instead of /dev/sdc.
> 
> I was able to get Xfce running and it seems to run pretty
> fast. With the focus on simplicity I figured that might be the
> case.
> 
> So right now I'm composing this email in Gmail using IceCat
> running on Dragora.
> 
> David Friedman
> 
> P.S. Here is the init script.
> 
> I do not think I need all of those sleeps, but I put them in
> there in the course of testing.
> 
> This came about from taking different parts from
> Dragora and also from CRUX.
> 
> 
> #!/bin/bash
> #
> #
> 
> mkdir -p /bbin
> 
> /bin/busybox --install -s /bbin
> 
> PATH=/bbin:/bin:/sbin
> export PATH
> 
> echo "Mounting proc..."
> mount -t proc proc /proc
> sleep 2
> echo "Mounting sys..."
> mount -t sysfs sysfs /sys
> sleep 2
> 
> echo "Mounting tmpfs..."
> mount -vn -t tmpfs tmpfs /run -o mode=0755
> sleep 2
> 
> echo "Mounting devtmpfs..."
> mount -vn -t devtmpfs devtmpfs /dev
> sleep 2
> 
> echo "Mounting devpts..."
> mkdir -p --mode=0755 /dev/pts
> mount -vn -t devpts devpts /dev/pts -o mode=0620,gid=4
> sleep 2
> 
> echo "Starting udev daemon:  /sbin/udevd --daemon"
> udevd --daemon
> sleep 2
> 
> udevadm trigger --type=subsystems
> udevadm trigger --type=devices
> 
> 
> rm -f /etc/mtab*
> ln -s /proc/mounts /etc/mtab
> 
> 
> echo "Now about to attempt mount of /dev/sdb2..."
> sleep 3
> mkdir /newroot
> mount /dev/sdb2 /newroot
> sleep 1
> 
> echo "Stopping udev daemon..."
> udevadm control --exit
> sleep 1
> 
> echo "Unmounting devpts..."
> umount /dev/pts
> sleep 1
> 
> echo "Unmounting devtmpfs..."
> umount /dev
> sleep 1
> 
> echo "Unmounting tmpfs..."
> umount /run
> sleep 1
> 
> echo "Unmounting sys..."
> umount /sys
> sleep 1
> 
> echo "Unmounting proc..."
> umount /proc
> sleep 1
> 
> 
> echo "Now doing switch_root..."
> 
> exec /bbin/switch_root /newroot  /sbin/init
> 
> echo "Something went wrong...going to a shell..."
> 
> exec /bin/bash
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]