opkg malformed package error

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
akra
DD-WRT Novice


Joined: 12 Feb 2022
Posts: 8

PostPosted: Sun Feb 13, 2022 17:37    Post subject: opkg malformed package error Reply with quote
Hello everyone.

First off, I would not be here had I not googled this error extensively already, I also hope this is the right board for it.

So, I am trying to install additional self created packages onto my DD-WRT running on a Netgear R7000 for a research project. I installed Entware on a USB.

For that purpose I am creating the ipk by hand, as, theoretically, this should not be very hard.

However, I am continuously running into the following error, with no additional debug info:

Code:

Collected errors:
 * pkg_init_from_file: Malformed package file helloworld-package_3.0.arm_cortex-a9.ipk.


This is my file tree:
Code:

helloworld-package
|-- control
|-- data
|   `-- opt
|       |-- bin
|       |   `-- helloworld.sh
|       `-- etc
|           `-- init.d
|               `-- helloworld
`-- debian-binary

5 directories, 4 files


This is my control file
Code:

Files: data/opt/bin/helloworld.sh data/opt/etc/init.d/helloworld
Package: helloworld-package
Version: 3.0
Depends: sh
Source: package/system/helloworld-package
SourceName: helloworld_package
Maintainer: maintainer@maintainer.tld
License: GPL-2.0-only
Section: base
SourceDateEpoch: 1611926981
Architecture: arm_cortex-a9
Description:  This is an example hello world IPK package



And this is the script I am packaging the ipk with
Code:

#!/bin/sh

basedir='/opt/root/helloworld-package'
#/home/user/Desktop/examples/helloworld-package'

cd $basedir/
tar -czf control.tar.gz ./control

cd $basedir/data
tar -czf ../data.tar.gz ./*

packagename="helloworld-package_3.0.arm_cortex-a9.ipk"

cd $basedir

ar r $packagename debian-binary data.tar.gz control.tar.gz

# clean up
mv $packagename ..
rm ./data.tar.gz ./control.tar.gz

echo "finished building ipk"


I am not completely sure if the control file must be in its own folder CONTROL or not, since all tutorials in the internet are saying it needs to be, but when I unpack an official package, it is not.

Any help would be greatly appreciated, I really have no idea what is going wrong.
Sponsor
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6445
Location: UK, London, just across the river..

PostPosted: Mon Feb 14, 2022 17:12    Post subject: Reply with quote
hmmm the only thing that comes to my mind is if you have the correct Entware....

this is the correct for R7000

cd /opt (click enter)
wget http://bin.entware.net/armv7sf-k3.2/installer/generic.sh (click enter)
sh generic.sh (click enter)

this is the wrong one, no meter its for Broadcom, its not for dual core router
cd /opt (click enter)
wget http://bin.entware.net/mipselsf-k3.4/installer/generic.sh (click enter)
sh generic.sh (click enter)

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
akra
DD-WRT Novice


Joined: 12 Feb 2022
Posts: 8

PostPosted: Mon Feb 14, 2022 19:22    Post subject: Reply with quote
Alozaros wrote:
hmmm the only thing that comes to my mind is if you have the correct Entware....

this is the correct for R7000

cd /opt (click enter)
wget http://bin.entware.net/armv7sf-k3.2/installer/generic.sh (click enter)
sh generic.sh (click enter)

this is the wrong one, no meter its for Broadcom, its not for dual core router
cd /opt (click enter)
wget http://bin.entware.net/mipselsf-k3.4/installer/generic.sh (click enter)
sh generic.sh (click enter)


Yeah the armv7sf-k3.2/installer/generic.sh is the one I downloaded.

I can install official packages, so the install should not be broken at least. For example the remind package. Downloaded from https://bin.entware.net/armv7sf-k3.2/Packages.html
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14242
Location: Texas, USA

PostPosted: Tue Feb 15, 2022 1:12    Post subject: Re: opkg malformed package error Reply with quote
Some people skip the meat of the OP:
akra wrote:
So, I am trying to install additional self created packages onto my DD-WRT running on a Netgear R7000 for a research project. I installed Entware on a USB.

For that purpose I am creating the ipk by hand, as, theoretically, this should not be very hard.

What exactly are you using to create these packages?

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
akra
DD-WRT Novice


Joined: 12 Feb 2022
Posts: 8

PostPosted: Tue Feb 15, 2022 7:12    Post subject: Re: opkg malformed package error Reply with quote
kernel-panic69 wrote:
Some people skip the meat of the OP:
akra wrote:
So, I am trying to install additional self created packages onto my DD-WRT running on a Netgear R7000 for a research project. I installed Entware on a USB.

For that purpose I am creating the ipk by hand, as, theoretically, this should not be very hard.

What exactly are you using to create these packages?


For creating the packages I am using the shell script in my initial post. This basically first creates the archives control.tar.gz, data.tar.gz and then puts the archives and debian-binary into the .ipk with the command ar. I have also tried using tar for the final .ipk, but no difference.
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14242
Location: Texas, USA

PostPosted: Tue Feb 15, 2022 14:05    Post subject: Reply with quote
Your .ipk files should contain pre-compiled (cross-compiled) binaries for the platform on which they are intended to be installed AFAIK...
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 373

PostPosted: Thu Feb 17, 2022 3:20    Post subject: Reply with quote
This tweaked script works for me:
Code:
#!/bin/sh

basedir='/opt/root/helloworld-package'
#/home/user/Desktop/examples/helloworld-package'

cd $basedir/
mkdir tmp
cd $basedir/control
tar -czf ../tmp/control.tar.gz ./*

cd $basedir/data
tar -czf ../tmp/data.tar.gz ./*

packagename="helloworld-package_3.0.arm_cortex-a9.ipk"

cd $basedir

cp debian-binary tmp
cd tmp
tar -czf ../../$packagename ./*

# clean up
cd ..
rm -rf tmp

echo "finished building ipk"

It uses ./* as an argument to all three tar commands so the control file is placed by itself in a directory called control, and a tmp subdirectory is created/deleted on the fly. I had to delete your Depends line from the control file as dd-wrt already has /bin/sh built in. I prefixed the script in init.d with S99 to be consistent with other entware init scripts.

Here is the result:
Code:
# opkg install helloworld-package_3.0.arm_cortex-a9.ipk
Installing helloworld-package (3.0) to root...
Configuring helloworld-package.

# /opt/bin/helloworld.sh
Hello World!

# opkg files helloworld-package
Package helloworld-package (3.0) is installed on root and has the following files:
/opt/etc/init.d/S99helloworld
/opt/bin/helloworld.sh
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14242
Location: Texas, USA

PostPosted: Thu Feb 17, 2022 5:51    Post subject: Reply with quote
/me totally missed that this was a shell script and not a pre-compiled binary Embarassed Rolling Eyes
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum