How to install .deb file from within preinst script
        Posted  
        
            by 
                Ashwin D
            
        on Ask Ubuntu
        
        See other posts from Ask Ubuntu
        
            or by Ashwin D
        
        
        
        Published on 2012-10-05T23:46:09Z
        Indexed on 
            2012/10/06
            3:50 UTC
        
        
        Read the original article
        Hit count: 348
        
dpkg
I have my own application packaged using dpkg. The application depends on several deb files which I'm trying to install from within the preinst script of my application. The preinst script checks if a dependent deb file is installed, if not it goes to installt it using the dpkg -i command. This is repeated for all the dependent deb files needed by the main application.
When I try to install the main application using dpkg -i, the commands returns failure when trying to execute the preinst script. Below is that error message.
dpkg: error: dpkg status database is locked by another process
I deleted /var/lib/dpkg/lock file and retried to install the application. But to no avail. If I run the preinst script separately like any other shell script, it runs without any issue. All the deb files will be installed properly. So, the issue is only when this preinst script is being run automatically by the dpkg -i command.
I'm lost trying to determine the root cause. If anyone can shed some light on what the real issue might be, their help will be greatly appreciated.
Thank you.
Ashwin
© Ask Ubuntu or respective owner