10

I've been building my own emacs because I want to fix some issues in it and get the bug fixes upstream. However, Ubuntu keeps automatically removing my own built emacs and I have to keep rebuilding and reinstalling it.

Here's my output of apt-cache policy emacs when I went to bed last night:

~/emacs$ sudo apt-cache policy emacs
emacs:
  Installed: 26.0.50.aaron-1
  Candidate: 46.1
  Version table:
     46.1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main i386 Packages
 *** 26.0.50.aaron-1 100
        100 /var/lib/dpkg/status

Here it is when I wake up:

~/emacs$ sudo apt-cache policy emacs
[sudo] password for excelsiora:
emacs:
  Installed: 46.1
  Candidate: 46.1
  Version table:
 *** 46.1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status

Why is this package being versioned at 46 instead of 24 or 25? 26 is the currently the highest major emacs version you can get.

I can see that this is a meta-package: https://packages.debian.org/source/jessie/emacs-defaults

Why is Ubuntu updating software without asking?

Main Question: What am I supposed to do - assign my package version a number higher than 46 just to make it stick?

That seems like a horrible hack, or maybe that's how it's supposed to work?

  • 2
    From the changelog: "Set the initial version higher than any existing emacs binary package." – muru Feb 10 '17 at 14:54
  • this makes me sad. :/ – Aaron Hall Feb 10 '17 at 15:27
15

There are many issues and questions here, so I'll be brief but try to cover them all.

  • emacs is just a meta-package that points at the latest version of emacs... in Ubuntu (currently emacs24). The "46.1" is just a package version, deliberately high to displace older emacs packages. See apt show emacs for a bit more info.

  • You're overriding that emacs package with a lower version number package. Ubuntu prioritises the package version installed by version number. The highest will be the one that gets installed (when installing or upgrading), hence yours is constantly guzzumped.

    You can see this in the apt-cache policy emacs output. The candidate is the higher version.

  • You can work around priorities with pinning, or fudging your version number (something higher than 46.1) but that does rather ignore the problem (and may leave a emacs24 package in place).

  • Your best option is removing the emacs package and just building and installing a emacs25 or emacs26 package instead. You could also build an emacs meta-package that depended on your version-in-name package, but that's just a vanity. I wouldn't do that unless you're planning on distributing.

  • Regarding Ubuntu doing stuff without "without asking", check to see if automatic updates are turned on. Getting the latest available to it is the default behaviour so I think this is more a case of "not understanding what Ubuntu does" rather than a ghost in the machine, or worse.

  • And as for "why version 24, not 25 or 26?", Ubuntu and Debian beneath it both aim for stable, tested software versions. 26 is still in development and 25 didn't come out until September 2016.

    Additionally, Ubuntu isn't a rolling-release so versions of Ubuntu with 24 will stay on version 24 for the lifespan of those Ubuntu releases (unless something really crazy happens). Security patches will be backported and applied if necessary but it'll still be 24.

  • I never asked "why version 24" (I think the answer to that is obvious) my words were "why this version" referring to 46, but since it was redundant and less clear than the prior question, I deleted it. Anyways, I went with renaming it emacs26 in an argument to checkinstall - I'll probably post a resolution later. Plus one. And thanks – Aaron Hall Feb 10 '17 at 16:01
  • @Oli (+1) regarding your last point, is there a good argument for not upgrading Emacs beyond the version the arrives with an OS? Are there known stability issues or other problems? I am working on Ubuntu 16.04 LTS and would like to move to version Emacs 25.1. – n1k31t4 Mar 29 '17 at 7:01
  • 99 would have been a better version number. – Thorbjørn Ravn Andersen May 20 '17 at 16:48
0

Why is Ubuntu updating software without asking?

I think this might be due to your Update Policy in Update Manager (Edit menu). I recommend the middle option: Optimize stability and security. The last option will "Always update everything" - which you do not want.

You can also blacklist the package "emacs-defaults" in Edit>Preferences>Blacklisted packages (AKA Ignored packages).

0

Following up @Oli's answer, here's how you go about:

removing the emacs package and just building and installing a emacs25 or emacs26 package instead.

  1. Find your emacs.deb file. For me, it was in my emacs source root folder and was named emacs_25.1-1_amd64.deb
  2. Create a directory to hold the new debian package you're going to create: $ mkdir emacs-rename
  3. Unarchive the debian package to the directory: $ ar -x emacs_25.1-1_amd64.deb emacs-rename/
  4. Go into the emacs-rename directory: $ cd emacs-rename
  5. Further extract control.tar.gz and data.tar.xz: $ tar -xzf control.tar.gz and $ tar -xf data.tar.xz
  6. Edit the control file that results with nano (since you don't have emacs yet ;) -- $ nano control and change Package: emacs to Package: emacs25 (or 26, 27 etc)
  7. Create a DEBIAN directory inside of emacs-rename: $ mkdir DEBIAN and copy the control file there: $ cp control DEBIAN/
  8. Go up a directory, back to the emacs source root ($ cd ..) and run $ dpkg --build emacs-rename. This might take a few moments.
  9. You should now have an emacs-rename.deb package. Don't worry that it doesn't follow proper debian package naming structure, it's just for your use. Install it with $ sudo dpkg -i emacs-rename.pkg
  10. If everything worked you should see:

    Preparing to unpack emacs-rename.deb ...
    Unpacking emacs25 (25.1-1) ...
    Setting up emacs25 (25.1-1) ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.