Changing deb package architecture

We have several PHP applications and libraries incorrectly packaged for i386 rather than all, which means they wont install to our nice new shiny AMD64 servers. Unfortunately we don’t have (or at least we can’t find) the original package sources, so we need to ‘frobble’ the packages and change the arch by hand!

Deb files are just an ar package so we must first extract it! (FYI ar is like tar, but for pirates .. 🙁 )

Shell

1

2

3

4

5

6

7

8

9

rus@absinthe:~/$mkdirphplibs

rus@absinthe:~/$mvphplibs_1.0-1_i386.debphplibs

rus@absinthe:~/$cdphplibs

rus@absinthe:~/phplibs$arxv phplibs_1.0-1_i386.deb

x-debian-binary

x-control.tar.gz

x-data.tar.gz

rus@absinthe:~/phplibs$ls

control.tar.gzdata.tar.gzphplibs_1.0-1_i386.debdebian-binary

The control.tar.gz is the one that contains all our precious arch information, so we must extract it!

Shell

1

2

3

rus@absinthe:~/phplibs$tar-xzf control.tar.gz

rus@absinthe:~/phplibs$ls

control control.tar.gzdata.tar.gzphplibs_1.0-1_i386.debdebian-binary md5sums

open up the control file and edit in the arch you want (in our case, all)

Shell

1

2

3

4

5

6

7

8

9

Package:phplibs

Version:1.0-2

Section:unknown

Priority:optional

Architecture:all

Installed-Size:12

Maintainer:rus<rus@internet.com>

Description:shared PHP libraries

Required system php libs

I’m going to increment the package version to -2 as well to signify that it’s just the packaging that has changed.

Hi, I'm Rus and after 10 years of Linux administration and software development, in September 2014 I quit my day job, sold all my stuff and moved to Thailand to live the good life.
My new website, http://www.ruspow.com shows how I'm making money online as well as what life can be like when you're not sat behind a desk and are free to make your own decisions!