Search code examples
debianpackagingdpkg

dpkg giving error "Is a directory"


I am trying to create a Debain .deb package. Package is being created successfully but I am getting following error when I try to install it:

 unable to open file '/var/lib/dpkg/tmp.ci//opt': Is a directory

The package directory structure is :

.
└── DEBIAN
    ├── control
    ├── opt
    │   └── myDir
    │       └── myfile
    ├── postinst
    └── preinst

In preinst I've - mkdir -p /opt/myDir postinst is empty

If I try to install package on a different host, I get below error:

package control info rmdir of `opt' didn't say not a dir: Directory not empty

Any ideas?


Solution

  • Your directory layout is wrong. It should be like this:

    .
    ├── opt
    │   └── myDir
    │       └── myfile
    └── DEBIAN
        ├── control
        ├── postinst
        └── preinst
    

    After you build your package you can test its format with lintian:

    lintian my-package.deb
    

    I had the same problem as you and lintian helped me fix it.