Forum

Full Version: Boot XBian from USB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
(8th May, 2013 11:20 PM)Fred Wrote: [ -> ]I use this command
I think you should at least exclude the place where your destination is mounted (normally /media or /mnt) to avoid a loop.

"-x" is the exclude for this purpose.

-x will not change filesystem. for root it means, it will 100% copy structure (/dev, /proc, /sys, /mnt ...) but will not descent into.
Thanks, didn't know that Smile.
Hey folks,

I'm trying to move my Xbian 1.0 Alpha5 installation to an USB HDD, too (300 GB, parallel ATA), but I'm running into the "Root partition /dev/sda2 missing" problem (with the disk formatted as swap, /, /home). Increasing the rootwait time in the init script up to 60s did not change anything. At some point, I plugged in a different hard drive instead (3 TB, SATA, obviously newer Wink). Since that one's a pure data disk (but with two partitions anyway), it of course didn't boot either; however, a different error showed up:
Code:
mount: mounting /dev/sda2 on /rootfs failed: Invalid argument
Mounting root partition /dev/sda2 failed
suggesting that the device file is present, but not ext4 formatted (whilch is true). So somehow, that HDD is recognized by mdev, while the one I want to use isn't, albeit the usb device shows up in the kernel messages.

init drops to a busybox shell in both cases. My keyboard somehow doesn't work there (maybe because it's a wireless model and the driver's not loaded yet?), but I hacked some code into init which confirmed /dev/sda* not being present. The drive shows up and automounts normally when running Xbian from the SD card. So, is there some incompatibility between mdev and the USB-HDD controller? Or could it be something like a malformed MBR? (Though I've reformatted several times with cfdisk and gparted.) Any ideas?

Thanks,
Taral
that means, your drive is found with help of later (after initramfs) installed kernel module.

when you boot with sdcard, can you post "lsmod" and "dmesg" ? (with drive attached of course)

normally I would guess scsi emulation for ata drives
Seems right:
Code:
Module                  Size  Used by
nfsd                  259835  2
bcm2708_wdog            3530  1
snd_bcm2835            13087  0
snd_pcm                77296  1 snd_bcm2835
snd_page_alloc          5196  1 snd_pcm
snd_timer              19974  1 snd_pcm
snd                    58448  3 snd_bcm2835,snd_timer,snd_pcm
joydev                  9340  0
evdev                   9489  2
hid_logitech            8468  0
ums_cypress             2666  0
Gotta be ums_cypress (and hid_logitech for the not-yet-working keyboard, I suppose). dmesg output is at http://pastebin.com/eVMkLxF5; I've condensed what I think may be relevant at http://pastebin.com/9BG0zLb6. With root=/dev/sda2, booting stops after recognizing the usb devices (last line is "Manufacturer: Logitech") before dropping to the shell, where ums_cypress indeed isn't loaded. Is there a way to load it earlier?
yes it is. unpack the initramfs.gz, locate ums_cypress under /lib/modules. copy it with exact the same parent paths to the dir where you unpacked initramfs.

while still in the dir where unpacked initramfs is, run "depmod -b ./"

unfortunately there is no mechanism build into the older initramfs to load modules prior rootfs mount. so you have to edit ./init and put "modprobe ums_cypress"

put it at line 31, just before "# check if new root partition exists".

then pack the initramfs.gz back and copy to /boot.

in the beta1 this will process will be auto based on content of /etc/modules. modules listed there will be copied to initramfs and loaded prior mounting of rootfs.
Absolutely terriffic! Thanks a lot, apart from that, everything worked out of the box, and now I can even boot from that old 1gb SD card I had lying around. Great work!
This thread has helped me a lot, but I still don't have it. I have a 3 TB external HDD with a 16GB partition from which I want to boot Xbian. I have moved all the files over using dd as instructed. I have verified that the partition mounts fine from within Xbian. I have changed the rootfs to point to the partition. In theory it should work, however when I try to boot into the HDD with the loglevel=10, the last log I see before it freezes is: [sda] Attached SCSI drive. So it looks like my drive is absolutely recognized but it wont mount, and I would expect to see the "mounting root partition failed" error rather than freezing. Any ideas?
Can you post your cmdline.txt?

Disable the splash screen at boot, and change tty2 in your cmdline.txt to tty1 if you haven't already.
Check the text on your screen while it is booting, see if you can find anything that seems wrong. Maybe post a screenshot here.
Thanks but I was able to fix it. I did some googling and it looks like a lot of people were having the same issue in Ubuntu due to a bug. I appended "nomodeset" to the end of my cmdline.txt and that fixed it. It's really weird because based on what I've read about nomodeset it has nothing to do with what I was experiencing.

UPDATE: Nevermind. This is not the solution. Worked for about 3 reboots and now its back to what it was.

Okay now I have it. I had to do what Fred did in his post - unpack the initramfs, edit the init file to increase the wait time, then repack th initramfs. I had thought that I could just put rootwait=50 in the cmdline.txt but this didn't do anything. Thanks Fred!
(10th Jun, 2013 05:07 AM)joofs Wrote: [ -> ]Okay now I have it. I had to do what Fred did in his post - unpack the initramfs, edit the init file to increase the wait time, then repack th initramfs. I had thought that I could just put rootwait=50 in the cmdline.txt but this didn't do anything. Thanks Fred!

rootwait[=XX] is indeed available from beta1. so after you install beta1, you will have to "hack" again, but rootwait=50 in cmdline.txt will be enough and unpacking/editing initramfs/init will not be needed.

mk
I have successfully booted Xbian off of a USB.

However, be aware there is (or was) an issue on reboot if you have another USB drive attached - i.e your movies and music.

For some reason, the boot process cannot determine the correct USB drive to boot from and hangs. Even though your boot drive is on /dev/sda (and setup in the cmdline.txt) and your movies are on /dev/sdb it gets "confused" and hangs.

Maybe this has changed in Alpha5 12.2 as I haven't tried it since 12.1

When working, I didn't notice any difference in speed between a SDHC class 10 and a USB drive or flash USB of the same specifications. So any performance extras are eliminated with a class 10 SD card. Saying that in normal usage a class 4 works just as well unless you intend any high IO onto the SD card.

As Xbian has never used the allocated swapfile (in my experience) there is going to limited IO to the SD card.

The MAIN reason I would want to use a USB drive or Flash is that the plastic separators around the connectors on a SDHC card are prone to break with continual removal and remounting (I have two failed ones from over extraction and insertion.)

I don't know how a USB drive can help with OC!
(12th Feb, 2013 03:07 AM)CurlyMo Wrote: [ -> ]The easiest way is:
- Install XBian img to your SD card
- Boot xbian
- Login to shell with ssh
- dd if=/dev/mmcblk0p2 of=/dev/sda2
- Change /boot/cmdline.txt

This only copies the /root partition to your USB drive.

I hate to ask noob questions but I have searched all over and cannot find an answer on my own. I installed Xbian to my SD card using the installer and booted xbian. I then ssh into xbian and typed "sudo dd if=/dev/mmcblk0p2 of=/dev/sda1" to copy the root partition to the usb drive. This is the message I got back:
xbian@xbian ~ $ sudo dd if=/dev/mmcblk0p2 of=/dev/sda1
[sudo] password for xbian:
dd: writing to `/dev/sda1': No space left on device
15140417+0 records in
15140416+0 records out
7751892992 bytes (7.8 GB) copied, 2195.49 s, 3.5 MB/s

Was the copy not successful?

Secondly, how do I change the /boot/cmdline.txt? I know I'm supposed to change the dev/mmcblk0p2 to /dev/sda1 but I can't figure out how. I thought I needed to do nano /boot/cmdline.txt but I don't see the text that I need to change.

Again, this is very new to me so forgive my questions that are probably very basic to you. Please dumb down your responses so I can easily figure out what I need to do.

Thanks,
Dave
(12th Jul, 2013 01:25 PM)daveski3 Wrote: [ -> ]
(12th Feb, 2013 03:07 AM)CurlyMo Wrote: [ -> ]The easiest way is:
- Install XBian img to your SD card
- Boot xbian
- Login to shell with ssh
- dd if=/dev/mmcblk0p2 of=/dev/sda2
- Change /boot/cmdline.txt

This only copies the /root partition to your USB drive.

I hate to ask noob questions but I have searched all over and cannot find an answer on my own. I installed Xbian to my SD card using the installer and booted xbian. I then ssh into xbian and typed "sudo dd if=/dev/mmcblk0p2 of=/dev/sda1" to copy the root partition to the usb drive. This is the message I got back:
xbian@xbian ~ $ sudo dd if=/dev/mmcblk0p2 of=/dev/sda1
[sudo] password for xbian:
dd: writing to `/dev/sda1': No space left on device
15140417+0 records in
15140416+0 records out
7751892992 bytes (7.8 GB) copied, 2195.49 s, 3.5 MB/s

Was the copy not successful?

Secondly, how do I change the /boot/cmdline.txt? I know I'm supposed to change the dev/mmcblk0p2 to /dev/sda1 but I can't figure out how. I thought I needed to do nano /boot/cmdline.txt but I don't see the text that I need to change.

Again, this is very new to me so forgive my questions that are probably very basic to you. Please dumb down your responses so I can easily figure out what I need to do.

Thanks,
Dave


1) are you sure you have enough space on the device you trying to move?
2) anything you would like to edit on /boot partition you have to mount it 1st since Beta release so use
Code:
mount /boot
****1) are you sure you have enough space on the device you trying to move?
2) anything you would like to edit on /boot partition you have to mount it 1st since Beta release so use****

I have an 8GB SD card and the USB stick is also 8GB

When I entered mount/boot and then nano /boot/cmdline.txt this it the text that shows up in the editor:

"sdhci-bcm2708.sync_after_dma=0 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=xbian-root-btrfs rootfsopts=subvol=root/@,noatime,compress=lzo,thread_pool=1,space_cache,autodefr$todefrag rootfstype=btrfs rootwait=10 smsc95xx.turbo_mode=N elevator=noop nohdparm splash logo.nologo quiet loglevel=0 noswap mod_scsi.scan=async"

I don't see any lines that have /dev/mmcblk0p2 or /dev/sda1
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Reference URL's