Installing apt (package manager)

114 views
Skip to first unread message

Michael

unread,
Oct 17, 2008, 4:25:06 PM10/17/08
to linuxstamp
I am getting close to having things set up the way I want:

1) boot from dataflash from kernel with unionfs baked in
2) kernel has initramfs integrated with busybox with dpkg baked in
3) startup script mounts SD card and uses unionfs to dynamically
extend boot filesystem onto SD card

My goal is to get apt (specifically apt-get) working, so that I can
easily and dynamically install and remove packages from the extended
memory on the SD card. The hurdle is getting 'apt' itself installed
(somewhat of a chicken-and-egg type of thing).

Using the dpkg and wget support built into busybox I can fetch debian/
arm packages, and use dpkg -i to try to install them. For the 'apt'
package, this means:

get and attempt to install 'apt': needs libc6
get and attempt to install 'libc6': need tzdata
get and attempt to install 'tzdata': error on postinst script (error
as show below):

# dpkg -i tzdata_2007k-1etch1_all.deb
Unpacking tzdata (from tzdata_2007k-1etch1_all.deb)...
Setting up tzdata (2007k-1etch1)...
sh: /var/lib/dpkg/info/tzdata.postinst: not found
dpkg: postinst failure.. set status to what?
# ls -l /var/lib/dpkg/info/tzdata.postinst
-rwxr-xr-x 1 root root 2292 Oct 17 20:14 /var/lib/dpkg/
info/tzdata.postinst
#

When I examine the script, it looks pretty garden-variety, but it does
start with the common:

#!/bin/bash

Is this a problem with busybox shell script support?

In general, should I just change strategy and manually unpack the .deb
archives and stick the various libraries where they should go (at
least to get apt working)?

Suggestions welcome!

- Michael

Paul Thomas

unread,
Oct 17, 2008, 4:52:31 PM10/17/08
to linux...@googlegroups.com
Michael,

You have to keep in mind that there are currently 2 root file systems
that you can easily use with the Linuxstamp. The minimal one that just
has libraries, busybox & dropbear or the debian file system. The
advantage of the minimal one is that it will fit in the dataflash with
the kernel (as you've done). The advantage of the debian system is
that you have the full debian environment including "apt-get".

The #!/bin/bash should be fine with busybox, but I think it will be a
lot of work to get "apt-get" working with the minimal system.

thanks,
Paul

Michael

unread,
Oct 17, 2008, 5:18:58 PM10/17/08
to linuxstamp
I like the idea of booting from dataflash for a couple of reasons,
starting with reliability. I want to reserve the SD card for my
applications and 'non-essential' stuff, knowing that I can reset the
system to a working state with basic functionality again at any time
just by swapping SD cards or reformatting one.

It does look like the /bin/bash thing is the root of my current
travails. I guess I will see how painful it is to get bash
installed...

- Michael

Paul Thomas

unread,
Oct 17, 2008, 5:30:42 PM10/17/08
to linux...@googlegroups.com
busybox should have a bash version. have you tried changing the init
line to #!/bin/sh?

thanks,
Paul

Michael

unread,
Oct 17, 2008, 5:39:53 PM10/17/08
to linuxstamp
Busybox apparently integrates something called 'ash' which is mostly
compatible with bash. If I was a bit smarter with Linux, I could
probably fool busybox into using its 'ash' support to field requests
for /bin/bash and it would likely work. I tried a symlink, but you
can't symlink to a symlink (I think), it just defererences the target
(busybox), so /bin/bash ends up becoming '/bin/busybox bash' instead
of '/bin/ash - > /bin/busybox ash' like I want. And '/bin/busybox
bash' of course isn't supported.

Maybe I can fool it with a /bin/ash script named /bin/bash. Hmm....

/bin/bash:

#/bin/ash
/bin/busybox ash $1 $2 $3 $4

Or something...

- Michael

Paul Thomas

unread,
Oct 17, 2008, 6:00:15 PM10/17/08
to linux...@googlegroups.com
Can you change the script? or does it have to work as /bin/bash?

thanks,
Paul

Michael

unread,
Oct 17, 2008, 6:22:42 PM10/17/08
to linuxstamp
I could change this one script (with some contortions), but if the apt-
get system assumes that bash is available for pre and post-install
scripting, then I have only postponed the problem. I have collected
all the gorp that bash depends on and may try to install that boatload
if my script hack doesn't work out (no time to test it today).

- Michael

Paul Thomas

unread,
Oct 17, 2008, 6:29:42 PM10/17/08
to linux...@googlegroups.com
Have you tried to cross-compile bash?

Michael

unread,
Oct 18, 2008, 9:17:55 AM10/18/08
to linuxstamp
I didn't think I needed to. All the necessary .deb packages are
available in arm flavors from the debian package repository.

- Michael

Michael

unread,
Oct 27, 2008, 4:52:37 PM10/27/08
to linuxstamp
If anyone is interested in the end result of my (mostly successful)
experiment, here is what I ended up with:

1) Gave up on getting the 'real' apt-get running - just too many
dependencies! So...
2) Enabled dpkg / dpkg-deb support in busybox.
3) Found out that some .deb packages hard-code /bin/bash in their
preinst / postinst scripts. So...
4) Unable to get 'real' bash installed as there are way too many
dependencies. So...
5) Successfully fooled the scripts into running /bin/ash via a /bin/
bash executable that is really a /bin/ash script:

/bin/bash:

#!/bin/ash
busybox ash $1 $2 $3 $4 $5 $6 $7 $8 $9

6) Found out that some .deb preinst / postinst scripts require
parameters to be passed to the scripts, which busybox dpkg did not
do. So...
7) Hacked busybox dpkg implementation to pass the required parameters
to the scripts.

The net is that I have a very functional dpkg / dpkg-deb system now
which works for a lot of standard .deb packages (the arm varieties of
course). This has allowed me to pursue my next venture, getting
pppd / chat working (that is a work in progress). My goal is to get
pppd / chat dial support working from a Dataflash boot.
Bwahahahah....

- Michael

Geeta

unread,
Mar 22, 2018, 7:08:13 AM3/22/18
to linuxstamp
Hello Michael,
Can you share your busybox with dpkg enabled.
Thanks.
Geeta

Michael Nagy

unread,
Mar 22, 2018, 9:53:15 AM3/22/18
to linux...@googlegroups.com
Hi Geeta - wow, that is a blast from the past!  Unfortunately, it was so long ago that I don't have any of the relevant bits kicking around any more.  Good luck with whatever you are working on!

- Michael

--
You received this message because you are subscribed to the Google Groups "linuxstamp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linuxstamp+unsubscribe@googlegroups.com.
To post to this group, send email to linux...@googlegroups.com.
Visit this group at https://groups.google.com/group/linuxstamp.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages