etckeeper with git breaks package upgrades that touch /etc

Bug #1267564 reported by Tuomas Suutari
44
This bug affects 8 people
Affects Status Importance Assigned to Milestone
etckeeper (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I tried to upgrade Ubuntu 12.04 Precise system to 14.04 Trusty (alpha) with "do-release-upgrade -d". I had etckeeper installed and configured to use Git. The upgrade failed at the very end, because etckeepers DPkg::Post-Invoke hook failed. The reason was that git user.name and user.email were not configured, but this was not an issue before the upgrade (i.e. apt/dpkg worked just fine).

It would be nice, if this kind of configuration issue was detected before the upgrade.

<pre>
Running mktexlsr. This may take some time... done.
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...

*** Please tell me who you are.

Run

  git config --global user.email "<email address hidden>"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@untamo.(none)')
Error in function:

A fatal error occurred

Please report this as a bug and include the files
/var/log/dist-upgrade/main.log and /var/log/dist-upgrade/apt.log in
your report. The upgrade has aborted.
Your original sources.list was saved in
/etc/apt/sources.list.distUpgrade.

SystemError: E:Problem executing scripts DPkg::Post-Invoke 'if [ -x
/usr/bin/etckeeper ]; then etckeeper post-install; fi', E:Sub-process
returned an error code

No pending crash reports. Try --help for more information.

Could not install the upgrades

The upgrade has aborted. Your system could be in an unusable state. A
recovery will run now (dpkg --configure -a).

Upgrade complete

The upgrade has completed but there were errors during the upgrade
process.

To continue please press [ENTER]
</pre>

description: updated
Revision history for this message
Tuomas Suutari (tuomas-suutari) wrote :

Hmm.. forget it. The upgrade went fine after all. Only the changes in etc had to be committed manually.

I mark this as Invalid, since the problem can be avoided by changing the configuration.

Changed in etckeeper (Ubuntu):
status: New → Invalid
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

It looks like git's behaviour changed between 1:1.7.10.4-1ubuntu1 (Quantal) and 1:1.8.1.2-1 (Raring).

If "dnsdomainname" returns empty, then git now fails, whereas before it proceeded with invalid committer/author "email addresses".

I think there are two things going on here. First is the change in upstream git; the second is that your system had a misconfigured (ie. empty) domain name.

So I think this is a previous domain name misconfiguration on your system causing the problem, rather than a general requirement that you must now configure git with a name and email. Configuring git with a name and email merely overrides the default. It is the default that on your system has always been unobtainable but is now being treated as an error.

Nevertheless, it would be nice if etckeeper didn't break in this case, as it is expected to function automatically and so prompting the user during an upgrade (as git does) is not helpful. I wonder how many other users do not have domain names defined.

Could you please post /etc/hostname and /etc/hosts and explain how you installed your system originally, so that we can figure out how many other users this issue might affect? And have you modified /etc/hostname and/or /etc/hosts by hand, at all?

Revision history for this message
Tuomas Suutari (tuomas-suutari) wrote :

Well, if you're still interested, here's some more info.

tuomas@untamo:~ $ hostname
untamo
tuomas@untamo:~ $ hostname -f
untamo
tuomas@untamo:~ $ hostname -A
untamo2.lan untamo.nepnep.lan
tuomas@untamo:~ $ cat /etc/hostname
untamo
tuomas@untamo:~ $ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 untamo localhost6.localdomain6 localhost6
127.0.1.1 untamo

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@untamo:/etc# git log -p --reverse hosts hostname
commit 102910c07c95f261d88e370e088f1b984daf5f0e
Author: root <root@untamo.(none)>
Date: Thu Feb 3 20:13:24 2011 +0200

    etckeeper init

diff --git a/hostname b/hostname
new file mode 100644
index 0000000..900a32e
--- /dev/null
+++ b/hostname
@@ -0,0 +1 @@
+untamo
diff --git a/hosts b/hosts
new file mode 100644
index 0000000..2ace82d
--- /dev/null
+++ b/hosts
@@ -0,0 +1,11 @@
+188.123.25.32 untamo # Added by NetworkManager
+127.0.0.1 localhost.localdomain localhost
+::1 untamo localhost6.localdomain6 localhost6
+127.0.1.1 untamo
+
+# The following lines are desirable for IPv6 capable hosts
+::1 localhost ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters

commit a9094cab7136d66f2b6ab8dad0724c20edea97df
Author: root <root@untamo>
Date: Thu Feb 3 20:30:00 2011 +0200

    saving uncommitted changes in /etc prior to apt run

diff --git a/hosts b/hosts
index 2ace82d..0e435af 100644
--- a/hosts
+++ b/hosts
@@ -1,4 +1,4 @@
-188.123.25.32 untamo # Added by NetworkManager
+192.168.1.116 untamo # Added by NetworkManager
 127.0.0.1 localhost.localdomain localhost
 ::1 untamo localhost6.localdomain6 localhost6
 127.0.1.1 untamo

commit 4d62835e5c7b782eafdef8f7cf653748a906cad3
Author: root <root@untamo.(none)>
Date: Tue Apr 5 16:13:56 2011 +0300

    daily autocommit

diff --git a/hosts b/hosts
index 0e435af..e27cf98 100644
--- a/hosts
+++ b/hosts
@@ -1,4 +1,4 @@
-192.168.1.116 untamo # Added by NetworkManager
+10.238.7.140 untamo # Added by NetworkManager
 127.0.0.1 localhost.localdomain localhost
 ::1 untamo localhost6.localdomain6 localhost6
 127.0.1.1 untamo

commit 9001f2425f6f1a37b7ab6440eef3c507a04a8545
Author: Tuomas Suutari <email address hidden>
Date: Tue May 3 00:54:35 2011 +0300

    Commit changes after system upgrade

diff --git a/hosts b/hosts
index e27cf98..d434de0 100644
--- a/hosts
+++ b/hosts
@@ -1,4 +1,3 @@
-10.238.7.140 untamo # Added by NetworkManager
 127.0.0.1 localhost.localdomain localhost
 ::1 untamo localhost6.localdomain6 localhost6
 127.0.1.1 untamo
root@untamo:/etc#

Revision history for this message
rubo77 (rubo77) wrote :

As a workaround I have added a tld to my hostname, so the upgrade could continue:

    hostname myhost.nonsense.com

see: http://askubuntu.com/questions/450028/how-do-i-set-the-tld-for-the-hostname

Revision history for this message
rubo77 (rubo77) wrote :

Please reopen. This is not solved in Ubuntu 14.04!

Revision history for this message
rubo77 (rubo77) wrote :

This is getting really annoying since 14.04 again. After each installation of a packet via the software center there comes the message again, that the username and email should not be set although they are set.

Changed in etckeeper (Ubuntu):
status: Invalid → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in etckeeper (Ubuntu):
status: New → Confirmed
Kevin Calman (codex24)
summary: - etckeeper with git breaks upgrade from Precise to Trusty
+ etckeeper with git breaks package upgrades that touch /etc
Revision history for this message
Borim (borim) wrote :

The problem could be that name and email are not configured in git for the root login. To do it you can do following:

sudo -s
git config --global user.email "<email address hidden>"
git config --global user.name "Your Name"

Can you please check if this solves your problem?

Another problem exists with the update manager, which still fails when name and email are set for root (#1335391).

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
while cleaning old bugs I have checked how this behaves as of today and I found that it seems to have better fallback mechanisms now.

If no user/email is set but there is a valid hostname it becomes root@hostname like
  Author: root <root@i.lxd>
But then we had other bugs (in other packages) about broken behavior if the hostname is no FQDN, but even that seems to be fine in etckeeper nowadays, it becomes automatically just the IP
  Author: root <root@192.168.122.225>

Also it actually tries to look up both - not only the config of root, but in case of e.g. sudo/su those of the user that invokes it. But then on unattended upgrades and such it is just root (no sudo), and that is when the above fallback even if no user or hostname is set happen.

And even worst case (= commit still fails for some reason) this has become non-breaking in 1.14 via [1] which isn't perfect as no commit happened in that case, but it makes it less impactful to the overall updating of the system. After all this will after a few hours be still catched by the daily timer that commits to git as well.

I'll set this to Fix Released based on that, but if there are still conditions left that make it break nowadays please re-open and we can have a look how to harden that edge case then.

[1]: https://salsa.debian.org/debian/etckeeper/-/commit/1b70e83dddcafbcbea84fc55a6396e4876a9a0c4

Changed in etckeeper (Ubuntu):
status: Confirmed → Fix Released
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.