Command "sudo service mongod start/stop/status" throws long error "Invalid command: start/stop/status" - Ubuntu 22.04 and MongoDB 6.0

Ubuntu 22.04 and MongoDB 6.0

I followed guides and tried installing mongodb-org many times in my Ubuntu 22.04. I have the following error when I do “sudo service mongod start/stop/status”. It says “Invalid command: start/stop/status”. Does anyone know the reason or fix for this? Any help is appreciated. Thanks.

:~$ mongod --version
db version v6.0.2
Build Info: {
    "version": "6.0.2",
    "gitVersion": "94fb7dfc8b974f1f5343e7ea394d0d9deedba50e",
    "openSSLVersion": "OpenSSL 1.1.1f  31 Mar 2020",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu2004",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

:~$ sudo service mongod start
{"t":{"$date":"2022-11-01T19:54:10.439+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2022-11-01T19:54:10.447+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-11-01T19:54:10.453+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2022-11-01T19:54:10.464+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-11-01T19:54:10.465+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-11-01T19:54:10.465+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
Invalid command: start
Options:
  --networkMessageCompressors arg (=snappy,zstd,zlib)
                                        Comma-separated list of compressors to
                                        use for network messages

General options:
  -h [ --help ]                         Show this usage information
  --version                             Show version information
  -f [ --config ] arg                   Configuration file specifying
                                        additional options
  --configExpand arg                    Process expansion directives in config
                                        file (none, exec, rest)
  --port arg                            Specify port number - 27017 by default
  --ipv6                                Enable IPv6 support (disabled by
                                        default)
  --listenBacklog arg (=4096)           Set socket listen backlog size
  --maxConns arg (=1000000)             Max number of simultaneous connections
  --pidfilepath arg                     Full path to pidfile (if not set, no
                                        pidfile is created)
  --timeZoneInfo arg                    Full path to time zone info directory,
                                        e.g. /usr/share/zoneinfo
  --nounixsocket                        Disable listening on unix sockets
  --unixSocketPrefix arg                Alternative directory for UNIX domain
                                        sockets (defaults to /tmp)
  --filePermissions arg                 Permissions to set on UNIX domain
                                        socket file - 0700 by default
  --fork                                Fork server process
  -v [ --verbose ] [=arg(=v)]           Be more verbose (include multiple times
                                        for more verbosity e.g. -vvvvv)
  --quiet                               Quieter output
  --logpath arg                         Log file to send write to instead of
                                        stdout - has to be a file, not
                                        directory
  --syslog                              Log to system's syslog facility instead
                                        of file or stdout
  --syslogFacility arg                  syslog facility used for mongodb syslog
                                        message
  --logappend                           Append to logpath instead of
                                        over-writing
  --logRotate arg                       Set the log rotation behavior
                                        (rename|reopen)
  --timeStampFormat arg                 Desired format for timestamps in log
                                        messages. One of iso8601-utc or
                                        iso8601-local
  --setParameter arg                    Set a configurable parameter
  --bind_ip arg                         Comma separated list of ip addresses to
                                        listen on - localhost by default
  --bind_ip_all                         Bind to all ip addresses
  --noauth                              Run without security
  --transitionToAuth                    For rolling access control upgrade.
                                        Attempt to authenticate over outgoing
                                        connections and proceed regardless of
                                        success. Accept incoming connections
                                        with or without authentication.
  --slowms arg (=100)                   Value of slow for profile and console
                                        log
  --slowOpSampleRate arg (=1)           Fraction of slow ops to include in the
                                        profile and console log
  --profileFilter arg                   Query predicate to control which
                                        operations are logged and profiled
  --auth                                Run with security
  --clusterIpSourceAllowlist arg        Network CIDR specification of permitted
                                        origin for `__system` access
  --profile arg                         0=off 1=slow, 2=all
  --cpu                                 Periodically show cpu and iowait
                                        utilization
  --sysinfo                             Print some diagnostic system
                                        information
  --noscripting                         Disable scripting engine
  --notablescan                         Do not allow table scans
  --shutdown                            Kill a running server (for init
                                        scripts)
  --keyFile arg                         Private key for cluster authentication
  --clusterAuthMode arg                 Authentication mode used for cluster
                                        authentication. Alternatives are
                                        (keyFile|sendKeyFile|sendX509|x509)

Replication options:
  --oplogSize arg                       Size to use (in MB) for replication op
                                        log. default is 5% of disk space (i.e.
                                        large is good)

Replica set options:
  --replSet arg                         arg is <setname>[/<optionalseedhostlist
                                        >]
  --enableMajorityReadConcern [=arg(=1)] (=1)
                                        Enables majority readConcern.
                                        enableMajorityReadConcern=false is no
                                        longer supported

Serverless mode:
  --serverless arg                      Serverless mode implies replication is
                                        enabled, cannot be used with replSet or
                                        replSetName.

Sharding options:
  --configsvr                           Declare this is a config db of a
                                        cluster; default port 27019; default
                                        dir /data/configdb
  --shardsvr                            Declare this is a shard db of a
                                        cluster; default port 27018

Storage options:
  --storageEngine arg                   What storage engine to use - defaults
                                        to wiredTiger if no data files present
  --dbpath arg                          Directory for datafiles - defaults to
                                        /data/db
  --directoryperdb                      Each database will be stored in a
                                        separate directory
  --syncdelay arg (=60)                 Seconds between disk syncs
  --journalCommitInterval arg (=100)    how often to group/batch commit (ms)
  --upgrade                             Upgrade db if needed
  --repair                              Run repair on all dbs
  --restore                             This should only be used when restoring
                                        from a backup. Mongod will behave
                                        differently by handling collections
                                        with missing data files, allowing
                                        database renames, skipping oplog
                                        entries for collections not restored
                                        and more.
  --journal                             Enable journaling
  --nojournal                           Disable journaling (journaling is on by
                                        default for 64 bit)
  --oplogMinRetentionHours arg (=0)     Minimum number of hours to preserve in
                                        the oplog. Default is 0 (turned off).
                                        Fractions are allowed (e.g. 1.5 hours)

WiredTiger options:
  --wiredTigerCacheSizeGB arg           Maximum amount of memory to allocate
                                        for cache; Defaults to 1/2 of physical
                                        RAM
  --zstdDefaultCompressionLevel arg (=6)
                                        Default compression level for zstandard
                                        compressor
  --wiredTigerJournalCompressor arg (=snappy)
                                        Use a compressor for log records
                                        [none|snappy|zlib|zstd]
  --wiredTigerDirectoryForIndexes       Put indexes and data in different
                                        directories
  --wiredTigerCollectionBlockCompressor arg (=snappy)
                                        Block compression algorithm for
                                        collection data [none|snappy|zlib|zstd]
  --wiredTigerIndexPrefixCompression arg (=1)
                                        Use prefix compression on row-store
                                        leaf pages

Free Monitoring Options:
  --enableFreeMonitoring arg            Enable Cloud Free Monitoring
                                        (on|runtime|off)
  --freeMonitoringTag arg               Cloud Free Monitoring Tags

AWS IAM Options:
  --awsIamSessionToken arg              AWS Session Token for temporary
                                        credentials

TLS Options:
  --tlsOnNormalPorts                    Use TLS on configured ports
  --tlsMode arg                         Set the TLS operation mode
                                        (disabled|allowTLS|preferTLS|requireTLS
                                        )
  --tlsCertificateKeyFile arg           Certificate and key file for TLS
  --tlsCertificateKeyFilePassword arg   Password to unlock key in the TLS
                                        certificate key file
  --tlsClusterFile arg                  Key file for internal TLS
                                        authentication
  --tlsClusterPassword arg              Internal authentication key file
                                        password
  --tlsCAFile arg                       Certificate Authority file for TLS
  --tlsClusterCAFile arg                CA used for verifying remotes during
                                        inbound connections
  --tlsCRLFile arg                      Certificate Revocation List file for
                                        TLS
  --tlsDisabledProtocols arg            Comma separated list of TLS protocols
                                        to disable [TLS1_0,TLS1_1,TLS1_2,TLS1_3
                                        ]
  --tlsAllowConnectionsWithoutCertificates
                                        Allow client to connect without
                                        presenting a certificate
  --tlsAllowInvalidHostnames            Allow server certificates to provide
                                        non-matching hostnames
  --tlsAllowInvalidCertificates         Allow connections to servers with
                                        invalid certificates
  --tlsLogVersions arg                  Comma separated list of TLS protocols
                                        to log on connect [TLS1_0,TLS1_1,TLS1_2
                                        ,TLS1_3]

I used to have this error ‘mongod: unrecognized service’ when I do “sudo service mongod start/stop/status”. Somehow the next day, the error becomes ‘Invalid command: start/stop/status’.

:~$ mongod -f /etc/mongod.conf
{"t":{"$date":"2022-11-02T11:34:24.761Z"},"s":"F",  "c":"CONTROL",  "id":20574,   "ctx":"-","msg":"Error during global initialization","attr":{"error":{"code":38,"codeName":"FileNotOpen","errmsg":"Can't initialize rotatable log file :: caused by :: Failed to open /var/log/mongodb/mongod.log"}}}

I do sudo chmod 777 -R /var/log/mongodb and it returns nothing now.

This is my mongod.log

{"t":{"$date":"2022-11-02T13:58:09.898+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-11-02T13:58:09.907+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalC>{"t":{"$date":"2022-11-02T13:58:09.943+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSiz>{"t":{"$date":"2022-11-02T13:58:10.290+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDo>{"t":{"$date":"2022-11-02T13:58:10.290+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrati>{"t":{"$date":"2022-11-02T13:58:10.290+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2022-11-02T13:58:10.292+00:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2022-11-02T13:58:10.294+00:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":102,"port":27017,"dbPath":"/var/lib/mongodb","architecture":"64-bit","host":"DESKTOP-BED>{"t":{"$date":"2022-11-02T13:58:10.294+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"6.0.2","gitVersion":"94fb7dfc8b974f1f5343e7ea394d0d9deedba50e","openSSLVersi>{"t":{"$date":"2022-11-02T13:58:10.294+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"22.04"}}}
{"t":{"$date":"2022-11-02T13:58:10.295+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"127.0.0.1","port":27017},"p>{"t":{"$date":"2022-11-02T13:58:10.303+00:00"},"s":"I",  "c":"NETWORK",  "id":5693100, "ctx":"initandlisten","msg":"Asio socket.set_option failed with std::system_error","attr":{"note":"acceptor TCP fast open","option":{"level":6,"name">{"t":{"$date":"2022-11-02T13:58:10.309+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=7475M,session_max=33000,eviction=(threads_min=4,threads_max=4),c>{"t":{"$date":"2022-11-02T13:58:10.473+00:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":22,"message":{"ts_sec":1667397490,"ts_usec":468902,"thread":"102:0x7f22fff1124>{"t":{"$date":"2022-11-02T13:58:10.473+00:00"},"s":"E",  "c":"WT",       "id":22435,   "ctx":"initandlisten","msg":"WiredTiger error message","attr":{"error":-31804,"message":{"ts_sec":1667397490,"ts_usec":473892,"thread":"102:0x7f22fff>{"t":{"$date":"2022-11-02T13:58:10.475+00:00"},"s":"F",  "c":"ASSERT",   "id":23089,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":50853,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp","line":652}}
{"t":{"$date":"2022-11-02T13:58:10.475+00:00"},"s":"F",  "c":"ASSERT",   "id":23090,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
{"t":{"$date":"2022-11-02T13:58:10.475+00:00"},"s":"F",  "c":"CONTROL",  "id":6384300, "ctx":"initandlisten","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}}
{"t":{"$date":"2022-11-02T13:58:11.179+00:00"},"s":"I",  "c":"CONTROL",  "id":31380,   "ctx":"initandlisten","msg":"BACKTRACE","attr":{"bt":{"backtrace":[{"a":"7F2306521564","b":"7F230177E000","o":"4DA3564","s":"_ZN5mongo18stack_trace_d>{"t":{"$date":"2022-11-02T13:58:11.179+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2306521564","b":"7F230177E000","o":"4DA3564","s":"_ZN5mongo18stack_trace_detail12_GLOBAL_>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2306523AA9","b":"7F230177E000","o":"4DA5AA9","s":"_ZN5mongo15printStackTraceEv","C":"mong>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230651D786","b":"7F230177E000","o":"4D9F786","s":"abruptQuit","s+":"66"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2300F82520","b":"7F2300F40000","o":"42520","s":"__sigaction","s+":"50"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2300FD6A7C","b":"7F2300F40000","o":"96A7C","s":"pthread_kill","s+":"12C"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2300F82476","b":"7F2300F40000","o":"42476","s":"raise","s+":"16"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2300F687F3","b":"7F2300F40000","o":"287F3","s":"abort","s+":"D3"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230366C2F6","b":"7F230177E000","o":"1EEE2F6","s":"_ZN5mongo25fassertFailedWithLocationEiP>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2303221A10","b":"7F230177E000","o":"1AA3A10","s":"_ZN5mongo12_GLOBAL__N_141mdb_handle_err>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F23041C0471","b":"7F230177E000","o":"2A42471","s":"__eventv","s+":"E61"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2303235BF5","b":"7F230177E000","o":"1AB7BF5","s":"__wt_panic_func","s+":"13A"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230418D23F","b":"7F230177E000","o":"2A0F23F","s":"__posix_sync","s+":"4F"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230418D36F","b":"7F230177E000","o":"2A0F36F","s":"__posix_directory_sync","s+":"10F"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230418E54A","b":"7F230177E000","o":"2A1054A","s":"__posix_open_file","s+":"44A"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2304189E15","b":"7F230177E000","o":"2A0BE15","s":"__wt_open","s+":"2C5"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F23041F53EC","b":"7F230177E000","o":"2A773EC","s":"__wt_block_manager_create","s+":"6C"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F23041A5EF2","b":"7F230177E000","o":"2A27EF2","s":"__schema_create","s+":"16D2"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F23041A34A7","b":"7F230177E000","o":"2A254A7","s":"__wt_schema_create","s+":"67"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2304186DBE","b":"7F230177E000","o":"2A08DBE","s":"__wt_turtle_init","s+":"155E"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230413788D","b":"7F230177E000","o":"29B988D","s":"wiredtiger_open","s+":"1B1D"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F23040DE8B9","b":"7F230177E000","o":"29608B9","s":"_ZN5mongo18WiredTigerKVEngine15_openWir>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F23040EC83D","b":"7F230177E000","o":"296E83D","s":"_ZN5mongo18WiredTigerKVEngineC2ERKNSt7_>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2303909827","b":"7F230177E000","o":"218B827","s":"_ZNK5mongo12_GLOBAL__N_117WiredTigerFac>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230478B7FE","b":"7F230177E000","o":"300D7FE","s":"_ZN5mongo23initializeStorageEngineEPNS_>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F23038880AE","b":"7F230177E000","o":"210A0AE","s":"_ZN5mongo12_GLOBAL__N_114_initAndListen>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230388B8DD","b":"7F230177E000","o":"210D8DD","s":"_ZN5mongo11mongod_mainEiPPc","C":"mongo>{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230367DA5E","b":"7F230177E000","o":"1EFFA5E","s":"main","s+":"E"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2300F69D90","b":"7F2300F40000","o":"29D90","s":"__libc_init_first","s+":"90"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F2300F69E40","b":"7F2300F40000","o":"29E40","s":"__libc_start_main","s+":"80"}}}
{"t":{"$date":"2022-11-02T13:58:11.180+00:00"},"s":"I",  "c":"CONTROL",  "id":31445,   "ctx":"initandlisten","msg":"Frame","attr":{"frame":{"a":"7F230388619E","b":"7F230177E000","o":"210819E","s":"_start","s+":"2E"}}}

{"t":{"$date":"2022-11-02T13:58:14.375+00:00"},"s":"I",  "c":"CONTROL",  "id":20698,   "ctx":"-","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2022-11-02T13:58:14.376+00:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalC>{"t":{"$date":"2022-11-02T13:58:14.402+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-11-02T13:58:14.404+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSiz>{"t":{"$date":"2022-11-02T13:58:14.481+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDo>{"t":{"$date":"2022-11-02T13:58:14.481+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrati>{"t":{"$date":"2022-11-02T13:58:14.481+00:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2022-11-02T13:58:14.481+00:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2022-11-02T13:58:14.482+00:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":110,"port":27017,"dbPath":"/var/lib/mongodb","architecture":"64-bit","host":"DESKTOP-BED>
:/$ sudo mongod --config /etc/mongod.conf
Aborted (core dumped)

Most of the issues you are facing are related to permissions
As per Mongo documentation to start mongod you should use
sudo systemctl start mongod
but you are using sudo
Sometimes you are running as sudo and othertime as normal user
You should not use sudo.Once you run mongod with sudo all files will be owned by root and next time when you run mongod as normal user it will fail
If you want to test/bring up your own mongod use different port,dbpath,logpath and do not pass /etc/mongod.conf as all your various attempts try to use same dirs

chmod 777 is not correct.You should give just needed permissions for mongod user
After you chmod logdir did mongod come up?
Did you try to connect with mongo
Core dump in your last attempt may be again due to another instance already up on same address/port/dirpath etc
Check doc for more details
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/#:~:text=Create%20a%20list%20file%20for,host%20and%20execute%20lsb_release%20-dc%20.