Error unclean shutdown

This tutorial educates about various problems and their solutions to repair a database in MongoDB.
Repair MongoDB Database

This tutorial speaks about repairing a database using MongoDB in the Windows operating system depending on the problem we face.

Repair a Database in MongoDB

There are different scenarios where we need to repair a database using MongoDB. For instance, we repair a database if there is an improper or unclean shutdown or we want to check inconsistencies and errors.

We also repair the database if the system gets shut down accidentally. Before going into the repairing process, let’s understand the components of the MongoDB database.

MongoDB Database Components

The MongoDB database has three components, briefly explained below.

  1. mongo — an interactive shell that checks the alert log; for instance, details and retries an operation.
  2. mongos — Process’ improper termination. Further, it was forced to disconnect from an instance.
  3. mongod — A daemon process that handles the background operations and data requests.

The following are some problems and the respective solutions.

Problem 1: System Gets Shutdown Accidentally

The following is the step-by-step solution for this issue. Remember to have a data folder in the root directory before following the steps.

  • Use the cd/ command to change the directory to the root, C:> in Windows OS.
  • Copy the full path for the mongod.exe service. In our case, it is C:Program FilesMongoDBServer5.0binmongod.exe.

    Notice that we also added the --repair parameter.

    C:> "C:Program FilesMongoDBServer5.0binmongod.exe" --dbpath C:data --repair
    
  • Hit the Enter key and wait for this to finish. Once it is done, the database will be repaired.

Problem 2: Repair MongoDB for Improper Shutdown

The data may be inconsistent if the unclean shutdown happens and journaling is disabled while working in MongoDB. If there is a non-empty mongod.lock file, we will face the following error message.

Error Message:

Detected unclean shutdown – mongod.lock is not empty

The solution for this specific problem is given below.

  • Switch to the root directory using the cd/ command on the Windows command prompt.
  • We create data files’ backup copy in the --dbpath.
  • Use --repair to initialize MongoDB.
  • Execute the command given below and hit Enter.
C:> mongod --dbpath /data/db --repair

Once it is finished, the MongoDB will be repaired.

Problem 3: Connect Failed Unclean Shutdown Detected

If any of us faces the following error, we must follow the 2-step process.

Error Message:

couldn't connect to server 127.0.0.1 shell/mongo.js:8 4 exceptions: connect failed Unclean shutdown detected

Step 1: Open the Windows Command Prompt and type cd/ to change the directory to the root.

Step 2: Execute the command as given below, press Enter and wait for this to end. Once it is done, the MongoDB is repaired now.

  • Remove From My Forums
  • Question

  • I have a number of what seem to be nearly identical virtual machines on ESX running Windows Server 2008.  After some sort of ‘event’ (hard shutdown of the hypervisor), some of these VMs are asking upon startup why I shutdown the machine.  I answer,
    and everything seems happy.  I then go to restart the VMs, and they (as expected) ask why I’m restarting.

    Here is where it gets odd… even though the shutdown part of the restart seems to go perfectly, upon login the system asks why the system had been shutdown.  This behavior indicates an unclean shutdown.  This tells me that the restart, which appeared
    to be clean, apparently failed to do something along the way and therefore didn’t clean up those 2 files that tell Windows that a clean shutdown occurred.

    This is really a two part question:

    — how can one tell exactly where the clean shutdown failed?  (I’ve combed through the event logs and don’t see anything helpful)

    — has anyone seen this and been able to fix (nope, no AV software or RIM software… I see various people talking about those being the guilty party)?

    Thanks!

Answers

  • Hi,

    I checked all Errors mentioned in your log and here are all of them:

    Error   12/13/2014 8:27:30 AM   Microsoft-Windows-GroupPolicy   1006    None    The processing of Group Policy failed. Windows could not authenticate to the Active Directory service on a domain controller. (LDAP Bind function call failed). Look in the details tab for error code and description.
    Error   12/13/2014 8:23:47 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver Adobe PDF Converter required for printer Adobe PDF ClassAuthor is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:45 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver Adobe PDF Converter required for printer Adobe PDF is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:44 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver InfoPrint 1000 Series required for printer Lab Office is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:43 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver IBM Infoprint 1000 Series PS3 required for printer uspttlaj Color-901K-09-11 Stanwix-Pittsburgh is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:43 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver InfoPrint 1870 MFP PS3 required for printer uspttlah-902F-09-11 Stanwix-Pittsburgh is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:42 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver SnagIt 8 Printer required for printer SnagIt 8 is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:42 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver Fax - HP Officejet Pro 8500 A910 required for printer Fax - HP Officejet Pro 8500 A910 (Network) is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:41 AM   Microsoft-Windows-TerminalServices-Printers     1111    None    Driver HP Officejet Pro 8500 A910 required for printer HP Officejet Pro 8500 A910 (Network) is unknown. Contact the administrator to install the driver before you log in again.
    Error   12/13/2014 8:23:39 AM   Microsoft-Windows-GroupPolicy   1079    None    The processing of Group Policy failed. Windows could not obtain the list of Group Policy objects applicable for this computer or user. View the event details for more information.
    Error   12/13/2014 8:16:41 AM   NetBT   4321    None    "The name ""WS2008R2X64    :0"" could not be registered on the interface with IP address 172.16.80.1. The computer with the IP address 172.16.80.86 did not allow the name to be claimed by this computer."
    Error   12/13/2014 8:16:25 AM   Microsoft-Windows-DfsSvc        14550   None    The DFS Namespace service could not initialize cross forest trust information on this domain controller, but it will periodically retry the operation. The return code is in the record data.
    Error   12/13/2014 8:16:10 AM   Server  2505    None    The server could not bind to the transport DeviceNetBT_Tcpip_{F4224B2D-666A-49D7-8DAD-3E6FDB2B2F34} because another computer on the network has the same name.  The server could not start.
    Error   12/13/2014 8:16:01 AM   EventLog        6008    None    The previous system shutdown at 8:15:31 AM on ?12/?13/?2014 was unexpected.
    

    From these logs we can see that some components are mentioned, including Terminal services, Group Policys, DFS namespace and computer name/IP assignment.

    First I would like to make sure if it is a real issue that the computer name is duplicated with another computer. There are 2 errors mentioned the same issue:

     The server could not bind to the transport DeviceNetBT_Tcpip_{F4224B2D-666A-49D7-8DAD-3E6FDB2B2F34} because another computer on the network has the same name.  The server could not start

    The name «»WS2008R2X64    :0″» could not be registered on the interface with IP address 172.16.80.1. The
    computer with the IP address 172.16.80.86 did not allow the name to be claimed by this computer

    Please try to rename the computer with a different one to see if this issue could be fixed. 


    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by

      Tuesday, December 23, 2014 1:46 AM

    • Marked as answer by
      MedicalSMicrosoft contingent staff
      Wednesday, December 24, 2014 6:10 AM

Предистория. Если нет времени — вопросы в конце, вытекающие из текста ниже

Как это обычно бывает «ни с того ни с сего» (а вернее после принудительного шатдауна или какой-нибудь ошибки и аварийного завершения gnome после очередного эксперимента или просто неумелости, было разок такое) при загрузке начинается сканирование раздела /dev/sda6, который у меня ext2 и монтируется как /home.

При сканировнии fsck доходил до 88%, дальше просто отказывался работать чтоб не навредить, Ctrl+D, система загружается но при следующей загрузке все по новой. А было следующее:

Cheking drive /dev/sda6:   88%   (stage 2/5 1089/1197)
/dev/sda6: Unattached inode 273703
/dev/sda6: UNEXPECTED INCONSISTENCY; RUN fsck MANUALY (i.e., without -a or -p options)
fsck died with exit status 4
Cheking drive /dev/sda6:   93%   (stage 4/5 17/38)
File system check failed
Дальше он повторяет что надо вручную запускать fsck а если хочешь terminate this shell то нажми Ctrl+D

Для новичков вроде меня  ;) объясняю то что понял сам:

Inodes are system data structures that contain information about files in Unix and similar type operating system file systems. Each file has an inode and is identified by a unique inode number in the file system where it resides. Inodes provide important information on files such as user and group ownership, access mode (read, write, execute permissions) and type. Inodes are created when a file system is created.

Т.е. inode — это номер в файловой системе конкретного файла.
Unattached inode 273703 — значит неприкрепленный «inode» таким-то номером
fsck died with exit status 4 — значит программа fsck завершила работу и ошибку оставила неисправленной.

Разбираясь в понятии inode я запустил

user@komp:~$ find -inum 273704
user@komp:~$
и ничего не нашел, разумеется. inode на 1 номер больше-меньше — находил конкретный файл на /dev/sda6

Запустив fsck вручную (можно только под рутом?) он предлагал мне сначала отмонтировать данный раздел (ради безопасности данных), но тк это /home и я полагаю что там не мало настроек и без них учетная запись работать не станет, то надо по уму закрывать x-server, завершать сеанс user и из под консоли лезть в рут а там уже запускать fsck
Я прав?
Но я рискнул и запустил на не размонтированной системе. Оказалось что просто 1 файл имел 2 разных inode, и второй был лишний. Затем fsck обнаружил еще около 5-6 ошибок другого плана но их я не запомнил, а лог не сохранился, т.к после перезагрузки компьютер еще раз в автоматически проверил этот раздел, успешно прошел его и больше к этому не возвращался.

Вопросы:
1. Причина таких ошибок с inode?
2. Почему после того как он нашел на 88% ошибку и сказал что дальте надо руками — стал сканировать дальше (хотя видно этого не было) и остановился на 93%?
3. Всегда ли fsck запускаться должна под root/sudo?
4. Правильно ли я описал процесс для размонтирования раздела /home и его последующего сканирования или можно проще?
5. Сохранился ли лог работы fsck в ручном режиме когда были найдены ошибки, если после этого он все равно прошелся при загрузке автоматом и теперь в логе /var/log/fsck/checkfs только результаты последнего удачно завершившегося сканирования?

Понравилась статья? Поделить с друзьями:
  • Error unable to locate the original valve api
  • Error unable to locate the configuration file hoi4
  • Error unable to load vpn connection editor
  • Error unable to load the nvidia drm kernel module
  • Error unclassifiable statement at 1 fortran