Upgrading Ubuntu from 16.04 to 18.04 breaks MongoDB

Bug #1881083 reported by LostNotFound
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mongodb (Ubuntu)
New
Undecided
Unassigned

Bug Description

Upgrading from 16.04 to 18.04 breaks existing mongoDB databases.

Pre update versions:
> lsb_release -rd
Description: Ubuntu 16.04.6 LTS
Release: 16.04

> apt-cache policy mongodb
mongodb:
  Installed: 1:2.6.10-0ubuntu1
  Candidate: 1:2.6.10-0ubuntu1
  Version table:
 *** 1:2.6.10-0ubuntu1 500
        500 http://no.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        100 /var/lib/dpkg/status

Post upgrade versions:

mongodb:
  Installed: 1:3.6.3-0ubuntu1.1
  Candidate: 1:3.6.3-0ubuntu1.1
  Version table:
 *** 1:3.6.3-0ubuntu1.1 500
        500 http://no.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
        100 /var/lib/dpkg/status
     1:3.6.3-0ubuntu1 500
        500 http://no.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

After upgrading the release, the existing database files fail to load with the error:
** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.

To reproduce this I can use a fresh install of 16.04 fullyupdated, with a MongoDB running on it, and upgrade it to 18.04.

Revision history for this message
LostNotFound (lostnotfound) wrote :
Download full text (10.5 KiB)

I did a few more attempts, following these steps:
- Install 16.04
- apt update
- apt upgrade
- apt install mongodb
- Create simple database (using compass), insert a collection with a few entries
- do-release-upgrade
- MongoDB fails to start

Errors in the logs:
May 28 11:55:31 mongo systemd[1]: Started An object/document-oriented database.
May 28 11:55:35 mongo systemd[1]: mongodb.service: Main process exited, code=dumped, status=11/SEGV
May 28 11:55:35 mongo systemd[1]: mongodb.service: Failed with result 'core-dump'.

I attempted to start mongo manually:
> mongod --dbpath=/var/lib/mongodb
Which resulted in this output:
CONTROL [initandlisten] MongoDB starting : pid=1889 port=27017 dbpath=/var/lib/mongodb 64-bit host=mongo
CONTROL [initandlisten] db version v3.6.3
CONTROL [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
CONTROL [initandlisten] allocator: tcmalloc
CONTROL [initandlisten] modules: none
CONTROL [initandlisten] build environment:
CONTROL [initandlisten] distarch: x86_64
CONTROL [initandlisten] target_arch: x86_64
CONTROL [initandlisten] options: { storage: { dbPath: "/var/lib/mongodb" } }
- [initandlisten] Detected unclean shutdown - /var/lib/mongodb/mongod.lock is not empty.
- [initandlisten] Detected data files in /var/lib/mongodb created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
JOURNAL [initandlisten] journal dir=/var/lib/mongodb/journal
JOURNAL [initandlisten] recover begin
JOURNAL [initandlisten] info no lsn file in journal/ directory
JOURNAL [initandlisten] recover lsn: 0
JOURNAL [initandlisten] recover /var/lib/mongodb/journal/j._0
JOURNAL [initandlisten] recover cleaning up
JOURNAL [initandlisten] removeJournalFiles
JOURNAL [initandlisten] old journal file will be removed: /var/lib/mongodb/journal/j._0
JOURNAL [initandlisten] recover done
JOURNAL [initandlisten] preallocating a journal file /var/lib/mongodb/journal/prealloc.0
JOURNAL [durability] Durability thread started
JOURNAL [journal writer] Journal writer thread started
CONTROL [initandlisten]
CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
CONTROL [initandlisten]
CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
CONTROL [initandlisten]
INDEX [initandlisten] error: hashtable namespace index max chain reached:1335
- [initandlisten] In...

Revision history for this message
LostNotFound (lostnotfound) wrote :

If all files in /var/lib/mongodb is removed, mongo will start using:
sudo -u mongodb mongod --dbpath /var/lib/mongodb --smallfiles --storageEngine mmapv1

If the old db files are present, the segmentation fault occurs:

sudo -u mongodb mongod --dbpath /var/lib/mongodb --smallfiles --storageEngine mmapv1

I INDEX [initandlisten] error: hashtable namespace index max chain reached:1335
F - [initandlisten] Invalid access at address: 0
F - [initandlisten] Got signal: 11 (Segmentation fault).

Revision history for this message
LostNotFound (lostnotfound) wrote :

Does anyone have any input or opinion on this? Is this the expected behaviour and result?

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

Other bug subscribers

Related questions

Remote bug watches

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