uml-utilities don't install from apt

Bug #290661 reported by Jacek Dabrowski
12
Affects Status Importance Assigned to Milestone
uml-utilities (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

When the package is unpacked and when the system is restarted before the setup of the package, then the directory /var/run/uml-utilities is not there anymore and the installation fails with the error below. This is because /var/run is mounted as tmpfs

A simple fix is to create the directory /var/run/uml-utilities during postinst and not only in the filelist of the package.

ldconfig deferred processing now taking place
Errors were encountered while processing:
 uml-utilities
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up uml-utilities (20070815-1.1) ...
chown: cannot access `/var/run/uml-utilities': No such file or directory
dpkg: error processing uml-utilities (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 uml-utilities

ProblemType: Package
Architecture: amd64
DistroRelease: Ubuntu 8.10
ErrorMessage: subprocess post-installation script returned error exit status 1
Package: uml-utilities 20070815-1.1
SourcePackage: uml-utilities
Title: package uml-utilities 20070815-1.1 failed to install/upgrade: subprocess post-installation script returned error exit status 1
Uname: Linux 2.6.27.2-custom x86_64

Revision history for this message
Jacek Dabrowski (ponythewhite) wrote :
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for your report.

From what I can guess from your log. You've run a first upgrade session during which the package uml-utilities has been downloaded and unpacked. Then for some reason it has been abruptly interrupted (an error during vbox setup ?)
Then you've run the upgrade another time during which the package has been set up.

The directory /var/run/uml-utilities has been created during the first run. You've rebooted. But because /var/run is of type tmpfs the directory /var/run/uml-utilities was not there anymore after the reboot. Hence the error "No such file or directory" when the postinst script try to chown the directory.

Is it a scenario like this one ?

I think this is really a corner case and there's no real fix. The only advice is to reinstall the package.

Thanks.

Changed in uml-utilities:
status: New → Incomplete
Revision history for this message
Jacek Dabrowski (ponythewhite) wrote : Re: [Bug 290661] Re: uml-utilities don't install from apt

Yes, that is just the scenario you described.
Is it correct that dpkg --configure doesn't work for the package after
interruption and it has to be removed and reinstalled? All other
packages I've met support incremental configuration with interruptions
or they do the configuration from scratch, anyway with no need for
manual removal/reinstall.

Thank you for your reply,

--
J Dabrowski

On Wed, Oct 29, 2008 at 10:59 PM, Jean-Baptiste Lallement
<email address hidden> wrote:
> Thanks for your report.
>
> >From what I can guess from your log. You've run a first upgrade session during which the package uml-utilities has been downloaded and unpacked. Then for some reason it has been abruptly interrupted (an error during vbox setup ?)
> Then you've run the upgrade another time during which the package has been set up.
>
> The directory /var/run/uml-utilities has been created during the first
> run. You've rebooted. But because /var/run is of type tmpfs the
> directory /var/run/uml-utilities was not there anymore after the reboot.
> Hence the error "No such file or directory" when the postinst script try
> to chown the directory.
>
> Is it a scenario like this one ?
>
> I think this is really a corner case and there's no real fix. The only
> advice is to reinstall the package.
>
> Thanks.
>
>
> ** Changed in: uml-utilities (Ubuntu)
> Status: New => Incomplete
>
> --
> uml-utilities don't install from apt
> https://bugs.launchpad.net/bugs/290661
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in "uml-utilities" source package in Ubuntu: Incomplete
>
> Bug description:
> Binary package hint: uml-utilities
>
> ldconfig deferred processing now taking place
> Errors were encountered while processing:
> uml-utilities
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> A package failed to install. Trying to recover:
> Setting up uml-utilities (20070815-1.1) ...
> chown: cannot access `/var/run/uml-utilities': No such file or directory
> dpkg: error processing uml-utilities (--configure):
> subprocess post-installation script returned error exit status 1
> Errors were encountered while processing:
> uml-utilities
>
> ProblemType: Package
> Architecture: amd64
> DistroRelease: Ubuntu 8.10
> ErrorMessage: subprocess post-installation script returned error exit status 1
> Package: uml-utilities 20070815-1.1
> SourcePackage: uml-utilities
> Title: package uml-utilities 20070815-1.1 failed to install/upgrade: subprocess post-installation script returned error exit status 1
> Uname: Linux 2.6.27.2-custom x86_64
>

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks for your update. Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here.

The fix is trivial. We need to create the directory /var/run/uml-utilities in the postinst script if it doesn't exists.

Thanks for taking the time to make Ubuntu better!

Changed in uml-utilities:
importance: Undecided → Low
status: Incomplete → Triaged
description: updated
Changed in uml-utilities:
assignee: nobody → serialorder
status: Triaged → In Progress
Revision history for this message
Manny Vindiola (serialorder) wrote :

I have created a patch that explicitly checks if /var/run/uml-utilities exists and creates it if it does not.

Revision history for this message
Manny Vindiola (serialorder) wrote :

I have also rebuilt the package and have sucessfully compiled with pbuilder

Changed in uml-utilities:
assignee: serialorder → nobody
status: In Progress → Confirmed
Revision history for this message
James Westby (james-w) wrote :

Hi,

What we usually do in this case is modify the initscript
to create the directory in /var/run/ if it does not exist, and
then remove anything to do with /var/run from the postinst.

Your patch would fix the issue, but I think it would be better to
stick with the usual mechanism.

Also, when patching something inside debian/ you shouldn't
use a dpatch, and just modify the file directly.

Thanks,

James

Revision history for this message
Manny Vindiola (serialorder) wrote :

Hi,

If you are talking about uml-utilities.init. It does contain code to create the directory if it does not exist.
23:UML_DIR=/var/run/uml-utilities
...
44: # create $UML_DIR if it doesn't exist (RAMRUN=yes in /etc/default/rcS)
45: if [ ! -d "$UML_DIR" ] ; then
46: mkdir -p $UML_DIR
47: chown uml-net:uml-net $UML_DIR

This error occurs specifically in the following instance:
1) Package is unpacked
2) System is rebooted or /var/run/uml-utilities is removed for some other reason
3) Package is configured

The postinst assumes that the directory exists however since /var is mounted as a tmpfs if a reboot occurs between unpacking and configuration then postinst will halt. I think the fix is in the correct place. See attached file for an example.

Regarding the patch, I was just following https://wiki.ubuntu.com/PackagingGuide/PatchSystems.
Can you clarify when the patch should be applied directly to debain versus when to use a patchsystem?
There was actually a small error in the patch so I can resend the corrected version when everything is hammered out.

Revision history for this message
James Westby (james-w) wrote :

On Fri, 2008-11-21 at 20:16 +0000, Manny Vindiola wrote:
> Hi,
>
> If you are talking about uml-utilities.init. It does contain code to create the directory if it does not exist.
> 23:UML_DIR=/var/run/uml-utilities
> ...
> 44: # create $UML_DIR if it doesn't exist (RAMRUN=yes in /etc/default/rcS)
> 45: if [ ! -d "$UML_DIR" ] ; then
> 46: mkdir -p $UML_DIR
> 47: chown uml-net:uml-net $UML_DIR
>
> This error occurs specifically in the following instance:
> 1) Package is unpacked
> 2) System is rebooted or /var/run/uml-utilities is removed for some other reason
> 3) Package is configured
>
> The postinst assumes that the directory exists however since /var is
> mounted as a tmpfs if a reboot occurs between unpacking and
> configuration then postinst will halt. I think the fix is in the correct
> place. See attached file for an example.

Usually with the above code in the init script the postinst can just
drop all reference to directories in /var/run.

This will obviously not be the case if the postinst does anything that
requires /var/run before starting the daemon.

> Regarding the patch, I was just following https://wiki.ubuntu.com/PackagingGuide/PatchSystems.
> Can you clarify when the patch should be applied directly to debain versus when to use a patchsystem?

Anything inside the ./debian/ directory should not be patched in a patch
system, as that obscures the changes, and can lead to build problems.
If the package uses a patch system then use it for any changes outside
of ./debian/

Thanks,

James

Revision history for this message
Manny Vindiola (serialorder) wrote :

Hi,

I am not sure why debian/postinst contains these lines which are causing the error:

if ! dpkg-statoverride --list /var/run/uml-utilities >/dev/null; then
     chown uml-net:uml-net /var/run/uml-utilities
fi

I removed these lines and rebuilt the package locally. When I attempted to replicate the error as before there was no error this time. The packge was set up correctly and the directory was recreated by the init script with the correct owner:group

drwxr-xr-x 2 uml-net uml-net 80 2008-11-21 22:59 uml-utilities

I think a better solution would be to remove these lines from postinit since they do not appear to be necessary

Manny

Revision history for this message
James Westby (james-w) wrote :

On Sat, 2008-11-22 at 04:06 +0000, Manny Vindiola wrote:
> Hi,
>
> I am not sure why debian/postinst contains these lines which are causing
> the error:
>
> if ! dpkg-statoverride --list /var/run/uml-utilities >/dev/null; then
> chown uml-net:uml-net /var/run/uml-utilities
> fi
>
> I removed these lines and rebuilt the package locally. When I attempted
> to replicate the error as before there was no error this time. The
> packge was set up correctly and the directory was recreated by the init
> script with the correct owner:group
>
> drwxr-xr-x 2 uml-net uml-net 80 2008-11-21 22:59 uml-utilities
>
> I think a better solution would be to remove these lines from postinit
> since they do not appear to be necessary

I would agree.

Does the init script do the chown? I assume it does not have the
dpkg-statoverride check?

Thanks,

James

Revision history for this message
Manny Vindiola (serialorder) wrote :

Ok I think it is ready now.
I have removed the chown lines from debian/postinst as they are present in the init script and unnecesary.
No the init scrip does not have a dpkg-statoverride check
Changes successfully build with pbuilder, they also build locally.
Package installs correctly and I am no longer able to replicate the error.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package uml-utilities - 20070815-1.1ubuntu1

---------------
uml-utilities (20070815-1.1ubuntu1) jaunty; urgency=low

  * debain/postinst
    removed uneccesary chown command as it can cause
     package setup failure if tmpfs directory /var/run/uml-utilities
     is accidently removed and init script properly perfomes chown command.
    (LP: #290661)

 -- Manny Vindiola <email address hidden> Fri, 21 Nov 2008 22:51:38 -0500

Changed in uml-utilities:
status: Confirmed → Fix Released
Revision history for this message
James Westby (james-w) wrote :

Hi Manny,

As you can see I uploaded your package, thanks for your work.

This change needs to be sent to Debian, but I will do that as I want
to raise something on the ubuntu-devel mailing list first.

Also, I removed the entry about changing the maintainer field from
debian/changelog. As this change is done to every package modified
in Ubuntu it is not very interesting information, so it is convention to
leave that out now.

Lastly, if you check the "this is a patch" box when attaching your
changes to LP then it allows me to review them in-browser, so I would
appreciate it if you would do that.

Thanks,

James

Revision history for this message
tdflanders (thomasdelbeke) wrote :

Is this a duplicate of: #302171?

Revision history for this message
Michele Mordenti (micmord) wrote :

This bug fix has created the bug #302171

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.