New IT forum
17 October 2019, 02:30:55 am *
Welcome, %1$s. Please login or register.

: PiHub now in stock.
 
Pages: [1]

Author Topic: Multistrapping Debian  (Read 14171 times)

IvanSanchez

  • Newbie
  • *
  • Posts: 19
Multistrapping Debian
« on: 16 May 2011, 02:18:29 pm »

Hi all,

I'm one of those people who pre-ordered the Dreamplug. But I didn't really like the default Ubuntu, so I tried the suggested way of intalling debian (uncompress a bunch of stuff, copy it, boot up). I didn't like that either (pre-seeded RSA keys, anyone?), so I turned to installing Debian by myself.

After a bit of research, I discovered that debootstrap is no longer recommended, and in its place, multistrap should be used. So I started to fiddle around with multistrap.

Multistrap is quite better than debootstrap, as it properly performs package configuration. The downside is that you have to manually run "dpkg --configure -a" on the first run. Which means you must have a JTAG to do that.

Fast-forward two weeks. I developed a script that:
- Performs a multistrap install of a basic Debian system
- Downloads and copies the newit kernel image & modules
- Sets up the roofs so it automatically and silently performs "dpkg --configure -a"
- Sets up DHCP on both eth0 and eth1
- Adds the tweaks for reducing disk writes
- Sets up a spawning console on the serial port

I've tried the script a lot of times, and I'm completely sure it works as expected. It's headless, so you can use it on a JTAG-less unit. Yes, I tested that.

Warnings

The script must run as root. You know you have to be careful when logging as root.

It assumes you have the second partition of the install media mounted on /media/disk. And it performs a "rm -rf /media/disk". Double-check your mount points before running the script. You have been warned.

Use only if you feel confident fiddling with partitions, and have a way to restore your plug. I'm confident it works, but  at this stage I'd rather be safe than sorry. [Insert standard "no guarantees" legal disclaimer here]

Use only if you have read the guides to installing another OS on the dreamplug. If you don't know what a rootfs is, or what a second partition is, you should stay out of this for now.

Notes

The Debian installation includes more than a basic system. You could install a basic-er Debian, but then you wouldn't have things like a DHCP client and a SSH server, which are quite important in a device like the plug.

This script might be suitable for generating a rootfs for the Guru or the Sheeva, but as I don't have either of those, I can't tell. Use extreme caution if you're going to try that, and double-check that the kernel will boot.

If you know your way around /etc/network/interfaces, you can assign the plug a static IP address when multistrapping the rootfs.

If you're running the resulting rootfs on a JTAG-less unit, wait for it to boot up (around one minute, be patient), and you should see the three LEDs blinking (who doesn't like blinking LEDs when installing an embedded device?). They will blink until all package configuration has been done (up to 5 minutes), then it will reboot. Now wait for another minute or two, and check your DHCP server logs.

Yes, I know, the script should prompt for the right install media in order to automatically mount it. That's on the TODO list.

Okay, I've read the warnings, now where is it?

Right over here -> http://ivan.sanchezortega.es/dreamplug


So, if you're fiddling with installing Debian on the plug, try it out. Any comments will be welcome, specially from people who have fiddled with debootstrap and other methods of installing another linux flavour on the plug.


Best,
Iván
Logged

elyobelyob

  • New IT customer
  • Newbie
  • *
  • Posts: 17
Re: Multistrapping Debian
« Reply #1 on: 19 June 2011, 03:08:15 pm »

Hi, many thanks for this .. am attempting to write this onto a spare internal sd card ... figured out that I needed multistrap installed on my netbook ubuntu system ... however am also having some issues ..

cp: cannot stat `/tmp/multistrap_temp/aptcache/*': No such file or directory
Multistrapping...
./mk_dreamplug_rootfs: line 49: multistrap: command not found
Moving downloaded packages
cp: cannot stat `/media/disk/var/cache/apt/*': No such file or directory
Unpacking kernel modules...
tar: firmware: time stamp 2036-05-06 13:23:50 is 785193914.308517631 s in the future

Am guessing every line does something important ... have tried dos2unix on the files to see whether it was a encoding issue ..

Any help appreciated, although it is continuing to run right now ...

Regards
Logged

IvanSanchez

  • Newbie
  • *
  • Posts: 19
Re: Multistrapping Debian
« Reply #2 on: 19 June 2011, 03:24:30 pm »

./mk_dreamplug_rootfs: line 49: multistrap: command not found

a) Are you completely sure multistrap is correctly installed?

b) Are you running the script as root? By default, only root can run multistrap.
Logged

elyobelyob

  • New IT customer
  • Newbie
  • *
  • Posts: 17
Re: Multistrapping Debian
« Reply #3 on: 19 June 2011, 09:23:52 pm »

./mk_dreamplug_rootfs: line 49: multistrap: command not found

a) Are you completely sure multistrap is correctly installed?

b) Are you running the script as root? By default, only root can run multistrap.

100% multistrap

100% "sudo su"

It's something to do with the ` that seems to kill it ...

The dreamplug seemed to do a lot of flashing, but am concerned the first script lines failed.

Regards

Nick
Logged

IvanSanchez

  • Newbie
  • *
  • Posts: 19
Re: Multistrapping Debian
« Reply #4 on: 19 June 2011, 09:43:49 pm »

100% "sudo su"

Hhhmmm. And what happens if you run just "multistrap --help" as root?

It's something to do with the ` that seems to kill it ...

There are no backticks in the script as far as I know... :-/

The dreamplug seemed to do a lot of flashing, but am concerned the first script lines failed.

I'm quite surprised multistrap fails but the dreamplug boots up and runs the first-boot script. BTW, can you see the serial console output through a JTAG? If the plug is busy configuring .deb packages, then the multistrapping went allright.


P.S.: Updated the script and multistrap.conf to include libertas-firmware from non-free. It's useful to have that if you want to use WiFi :-)

Best,
Iván
« Last Edit: 19 June 2011, 09:46:24 pm by IvanSanchez »
Logged

elyobelyob

  • New IT customer
  • Newbie
  • *
  • Posts: 17
Re: Multistrapping Debian
« Reply #5 on: 19 June 2011, 09:52:37 pm »

Your solution is exactly what I required .. and without a jtag, perhaps don't have enough info!

I will say, I tried everything and after 6 beers, it all sort of worked better ;)

--

--2011-06-19 22:27:22--  http://www.newit.co.uk/kernels/Dreamplug/Dreamplug-prerelease/Modules.tar.gz
Resolving www.newit.co.uk... 69.175.23.91
Connecting to www.newit.co.uk|69.175.23.91|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

Multistrapping...
multistrap 2.1.6ubuntu3 using multistrap.conf
Using foreign architecture: armel
multistrap building armel multistrap on 'i386'
INF: Setting ./lib64 -> ./lib symbolic link.
Getting package lists: apt-get  -o Apt::Architecture=armel -o Dir::Etc::TrustedParts=/etc/apt/trusted.gpg.d -o Dir::Etc::Trusted=/etc/apt/trusted.gpg -o Apt::Get::AllowUnauthenticated=true -o Apt::Get::Download-Only=true -o Apt::Install-Recommends=false -o Dir=/media/disk/ -o Dir::Etc=/media/disk/etc/apt/ -o Dir::State=/media/disk/var/lib/apt/ -o Dir::State::Status=/media/disk/var/lib/dpkg/status -o Dir::Cache=/media/disk/var/cache/apt/ update
Ign http://ftp.de.debian.org stable InRelease
Get:1 http://ftp.de.debian.org stable Release.gpg [1,671 B]
Get:2 http://ftp.de.debian.org stable Release [79.8 kB]
Ign http://ftp.de.debian.org stable Release
Get:3 http://ftp.de.debian.org stable/main Sources [3,721 kB]
Get:4 http://ftp.de.debian.org stable/main armel Packages [6,424 kB]                                                       
Get:5 http://ftp.de.debian.org stable/main TranslationIndex [2,232 B]                                                     
Fetched 10.2 MB in 39s (261 kB/s)                                                                                         
Reading package lists... Done
W: GPG error: http://ftp.de.debian.org stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AED4B06F473041FA

--

Thanks for all your hard work!
Off to try my local dreamplug ...

Nick

Logged

sarikan

  • Newbie
  • *
  • Posts: 15
Re: Multistrapping Debian
« Reply #6 on: 28 July 2011, 02:52:26 pm »

Hi Ivan,
Could you please briefly comment on your concerns regarding the pre seeded RSA keys? How would this lead to a security issue?

Cheers
Seref
Logged

IvanSanchez

  • Newbie
  • *
  • Posts: 19
Re: Multistrapping Debian
« Reply #7 on: 28 July 2011, 11:09:06 pm »

Could you please briefly comment on your concerns regarding the pre seeded RSA keys? How would this lead to a security issue?

I haven't tried it out, but if the images have the same pre-gen'd key, that'd allow an attacker to sign the attacker's public key with the image private key, and gain immediate SSH access to any plug with the same image out there.
Logged

sarikan

  • Newbie
  • *
  • Posts: 15
Re: Multistrapping Debian
« Reply #8 on: 29 July 2011, 10:18:30 am »

This is more or less what I suspected, but I assume changing the private ssh keys would not be that much of a trouble, and that should resolve the issue would it not? I'm keen on properly evaluating the options for a new OS, so your input is really helpful at this point. Thanks!

Logged

xmichielx

  • Newbie
  • *
  • Posts: 8
Re: Multistrapping Debian
« Reply #9 on: 04 August 2011, 05:50:00 am »

Hi Ivan,

This way of installing debian sounds really promising!
Is there a howto of how i set this up ?
I got the dreamplug, jtag and an external 8 gb card if needed.

Thanks,

Michiel
Logged

xmichielx

  • Newbie
  • *
  • Posts: 8
Re: Multistrapping Debian
« Reply #10 on: 04 August 2011, 06:29:54 pm »

ok stupid me I just had to download the script and the conf and run it.
the /media/disk should that be mounted against /dev/mmcpc0p2 (the ext3 file system) ?

the /dev/mmcpc0p1 (fat32 partition) is emty and nothing is copied to that partition right? it keeps empty?

When I try to boot from the external sdcard I get:
scsi 0:0:0:1: Direct-Access     Generic  STORAGE DEVICE   9909 PQ: 0 ANSI: 0
sd 0:0:0:0: [sda] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB)
sd 0:0:0:1: Attached scsi generic sg1 type 0
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:1: [sdb] 16121856 512-byte logical blocks: (8.25 GB/7.68 GiB)
sd 0:0:0:1: [sdb] Write Protect is off
sd 0:0:0:1: [sdb] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1 sda2
sda: p2 size 3653412 exceeds device capacity, limited to end of disk
sd 0:0:0:1: [sdb] Assuming drive cache: write through
 sdb: sdb1 sdb2
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Attached SCSI removable disk
sd 0:0:0:1: [sdb] Assuming drive cache: write through
sd 0:0:0:1: [sdb] Attached SCSI removable disk
kjournald starting.  Commit interval 5 seconds
EXT3-fs (sdb2): using internal journal
EXT3-fs (sdb2): mounted filesystem with writeback data mode
VFS: Mounted root (ext3 filesystem) on device 8:18.
Freeing init memory: 140K
Kernel panic - not syncing: Attempted to kill init!
[<c00308a0>] (unwind_backtrace+0x0/0xe0) from [<c003df30>] (panic+0x54/0x134)
[<c003df30>] (panic+0x54/0x134) from [<c0041250>] (do_exit+0x70/0x650)
[<c0041250>] (do_exit+0x70/0x650) from [<c00418f0>] (do_group_exit+0xc0/0xf4)
[<c00418f0>] (do_group_exit+0xc0/0xf4) from [<c004d1a4>] (get_signal_to_deliver+0x3c8/0x428)
[<c004d1a4>] (get_signal_to_deliver+0x3c8/0x428) from [<c002dca4>] (do_notify_resume+0x70/0x61c)
[<c002dca4>] (do_notify_resume+0x70/0x61c) from [<c002ba88>] (work_pending+0x1c/0x20)


Do you know what I am doing wrong?
Logged

IvanSanchez

  • Newbie
  • *
  • Posts: 19
Re: Multistrapping Debian
« Reply #11 on: 05 August 2011, 12:39:52 am »

ok stupid me I just had to download the script and the conf and run it.
the /media/disk should that be mounted against /dev/mmcpc0p2 (the ext3 file system) ?

Yup, that's right. First partition holds the kernel, second partition holds the root filesystem. However, I've seen the dreamplug referring to the intermal SD card as /dev/sda, not as /dev/mmcpc0p.

the /dev/mmcpc0p1 (fat32 partition) is emty and nothing is copied to that partition right? it keeps empty?

Hhhmmm, the kernel image (uImage) goes in there. Somehow the script does not check for the fat particion and skips this step.

If you copy the corresponding uImage to that partition, it should boot as usual.
Logged

xmichielx

  • Newbie
  • *
  • Posts: 8
Re: Multistrapping Debian
« Reply #12 on: 05 August 2011, 09:17:11 am »

Hi Ivan,

Thanks for your kind help :)
I am a little bit confused:

'Yup, that's right. First partition holds the kernel, second partition holds the root filesystem. However, I've seen the dreamplug referring to the intermal SD card as /dev/sda, not as /dev/mmcpc0p'

I am doing the multistrap and everything from my Ubuntu 10.10 laptop should I run everything from a booted dreamplug with ubuntu 9.04?
Logged
Pages: [1]
 
 

Powered by MySQL Powered by PHP SMF 2.0.10 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!