Showing posts with label LinuxMint. Show all posts
Showing posts with label LinuxMint. Show all posts

Monday, 22 December 2014

Fix : Linux NTFS Error Mounting $MFTMirr does not match $MFT (record 0)




With an external USB hard drive that is used to share files between Windows and Linux computers you may get an Error on Linux similar to the following :

Error mounting: mount exited with exit code 13: $MFTMirr does not match $MFT (record 0). Failed to mount ‘/dev/sdd1′: Input/output error NTFS is either inconsistent, or there is a hardware fault, or it’s a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory

To resolve the issue is to use ntfsprogs which can be installed from most Linux distributions e.g.

Arch Linux

$ sudo pacman -S ntfsprogs

Ubuntu/Linux Mint/Debian

$ sudo apt-get install ntfsprogs

To fix the issue run the following command syntax

$ sudo ntfsfix <drive mount point>

Change the drive to be the same shown in the Error. For example in the above error the command is

$ sudo ntfsfix /dev/sdd1

Sunday, 13 April 2014

Setup latest NVIDIA Drivers for Ubuntu or Linux Mint


  • If you need to install NVIDIA Driver's on either Ubuntu or Linux Mint the following three commands will update your system with the latest available drivers

$ sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
$ sudo apt-get update
$ sudo apt-get install nvidia-current nvidia-settings

  • Reboot your system and the drivers should be applied
  • For more detailed configuration open the 'NVIDIA X Server Settings Applet'

What is a PPA for on Ubuntu or Linux Mint?




  • PPA stands for Personal Package Archive
  • It allows apps to be installed that are not in the Ubuntu/Mint repositories
  • Provides access to newer software
Example - add PPA for apt-fast
  •  On Ubuntu or Linux Mint from a terminal for a 64 bit OS :
$ sudo add-apt-repository ppa:apt-fast/stable 
$ sudo apt-get update 
$ sudo apt-get install apt-fast

  • This allows 'apt-fast' to be installed which is not in the standard repositories

Linux Mint 15 Error - Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_olivia_import_i18n_Translation-en



  • If you find the following Error in Linux Mint 15 (Olivia) with the Software Manager or 'apt-get' :

Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_olivia_import_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.


Solution

  • Select Menu -> Preferences -> Software Sources -> Maintenance 
  • Select 'Fix MergeList problems'




  • Select 'Update the Cache' :


  • Issue will now be resolved

Empty Trash quickly from Command Line in Linux



I find it useful to be able to quickly delete the Trash on any Linux box I am working on. To do this is straight forward on Ubuntu, Linux Mint or Arch Linux.

Where Trash Resides

  • List your Trash files under :
$ ls -la ~/.local/share/Trash/
  • The 'files' sub-directory is the actual files 
  • The 'info' sub-directory is the metadata for each file
  • The 'expunged' sub-directory can have have content when a folder that belongs to you but contains files that don't is deleted

Manual Method 

  • You can manually remove :
 $ rm -rf ~/.local/share/Trash/files/*
 $ rm -rf ~/.local/share/Trash/info/*
 $ rm -rf ~/.local/share/Trash/expunged/*

trash-cli package

  • Recommended method
  • Install
$ sudo apt-get install -y trash-cli
  • Foe arch install from the AUR 
  • List trash contents
$ trash-list
2013-07-20 15:06:23 /home/lclark/tmp/experimental

  • Empty trash
 $ trash-empty
  • List contents and its empty
 $ trash-list
  • Enjoy !

Shuf - generate random permutations on Linux



Its always great to find a new Linux command that I have never heard of but is really useful. The command 'shuf' comes in to this category. It should be installed by default on most Linux systems as its part of the GNU Coreutils.

I wanted to generate random MAC address's from a text file which was simple with :

$ shuf -n 2 MACList | sort | uniq
00:A0:C8:14:C2:22
00:A0:C9:14:C8:29


Examples of using 'Shuf'

  • Generate 10 random numbers between 1 and 999

$ shuf -i 1-999 -n 10
182
588
696
841
574
204
173
641
958
289

  • Output results to a file
$ shuf -i 1-999 -n 10 -o results.txt
$ head -n 1 results.txt
749


  • Sort results and ensure numbers are unique

$ shuf -i 1-999 -n 10 | sort | uniq
101
142
298
396
508
564
793
870
923
95

  • Generate random words from Linux dictionary
$ shuf -n 2 /usr/share/dict/words
universe's
phosphorus