17

I was using my Ubuntu 2015.04 (with ecryptfs-encrypted user home) laptop normally when suddenly, the hard drive became read-only.

I rebooted and now it is stuck on this:

[    0.703206] ACPI PCC probe failed.
starting version 219
error: /dev/sdb: No medium found
error: /dev/sdb: No medium found
Welcome to emergency mode! After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default or ^D to
try again to boot into default mode.
root@nico:~#

Interesting part of the system logs:

-- Unit systemd-fsckd.service has begun starting up.
system-fsck[475]: /dev/sda1 contains a file system with errors, check forced.
kernel: ACPI warning: \_SB_.PCIO.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20141107/nsarguments-95)
kernel: ACPI warning: \_SB_.PCIO.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20141107/nsarguments-95)
kernel: thinkpad_acpi: EC reports that Thermal Table has changed
system-fsck[475]: /dev/sda1: Inodes that were part of a corrupted orphan linked list found.
system-fsck[475]: /dev/sda1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
system-fsck[475]: (i.e., without -a or -p options)
system-fsck[475]: fsck failed with error code 4.
system-fsck[475]: Running request emergency.target/start/replace
systemd[1]: system-fsck-root.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start File System Check on Root Device
-- Subject: Unit system-fsck-root.service has failed

I am not sure whether it is an ACPI or a disk problem. I tried updating to the latest BIOS my Lenovo Thinkpad T520, but it does not boot better.

How to fix this problem, or if the disk is dying how to at least export the data from my encrypted home to an external drive?

1
  • 8
    it has found errors with the root filesystem. do as it says, run fsck /dev/sda1 and interactively let it show you the errors it found and choose to correct them. Go through once saying no all the time to see how many errors there are. If they only seem to be for files of no importance, like log files, go through again saying yes. this may result in the loss of files, so if you can copy the partition first to say a usb device, do so first. – meuh Jul 23 '15 at 8:40
21
  1. At the prompt, type fsck /dev/sda<number> and press enter (look for the <number> from your logs based on the directory that contains the file system errors)
  2. Enter y to all the errors to fix them
  3. exit
3
  • how to find <number> – Kapil Yadav Jun 25 '19 at 14:12
  • 1
    Tyvm. It worked. – Viraths Jun 27 '19 at 23:15
  • 2
    @KapilYadav: you can find the number in the error logs that get thrown. For e.g., in OP's question the log says system-fsck[475]: /dev/sda1 contains a file system with errors, check forced. Hence the number is 1 – Rocky Inde Jul 3 '19 at 6:07
1

In Terminal

sudo -i (if not a root user, otherwise skip this)

fdisk -l

Look for your root drive.

I use Kali Linux in raspberry pi so mine looks something like mmcblk0p2 instead of sdb1... See for yours.

`umount /dev/mmcblk0p2`

fsck -y /dev/mmcblk0p2

poweroff

-1

I've had the same issue. I've created a image file from a working Raspbian SDCard using Win32DiskImager. When I ran pishrink, the tool gave me the "orphaned inode list" error. So I followed the suggestion from Rocky Inde and executed fsck. It encountered and fixed some errors so I ran pishrink again and it worked! Thanks Rock Inde.

If you got this far and are still confused how to do it, I've created a script, partly based on pishrink, to fix these "orphaned inodes". You can check the script source at

https://github.com/gmenezesg/fix_orphaned_inode_list

Usage:

wget https://raw.githubusercontent.com/gmenezesg/fix_orphaned_inode_list/master/fix_orphaned_inode_list.sh

sudo chmod +x fix_orphaned_inode_list.sh

sudo ./fix_orphaned_inode_list.sh [imagefile.img]

Script:

#!/bin/bash

function cleanup() {
  if losetup $loopback &>/dev/null; then
        if [ "$verbose_mode" = true ]; then
        echo "### Running cleanup ###"
        fi
        losetup -d "$loopback"
  fi
}

verbose_mode=false

while getopts ":v" opt; do
  case "${opt}" in
    v) verbose_mode=true ;;
    *) usage ;;
  esac
done
shift $((OPTIND-1))

usage() { echo "Usage: $0 [-v] imagefile.img"; exit -1; }

if [ "$verbose_mode" = true ]; then
echo "### Mapping arguments ###"
fi

img="$1"

if [ "$verbose_mode" = true ]; then
echo "### Usage checks ###"
fi

if [[ -z "$img" ]]; then
  usage
fi
if [[ ! -f "$img" ]]; then
  echo "ERROR: $img is not a file..."
  exit -2
fi
if (( EUID != 0 )); then
  echo "ERROR: You need to be running as root."
  exit -3
fi

echo "#Check that what we need is installed"
for command in parted losetup tune2fs md5sum e2fsck resize2fs; do
  which $command 2>&1 >/dev/null
  if (( $? != 0 )); then
    echo "ERROR: $command is not installed."
    exit -4
  fi
done

if [ "$verbose_mode" = true ]; then
echo "### Setting cleanup at script exit ###"
fi
trap cleanup ERR EXIT

beforesize=$(ls -lh "$img" | cut -d ' ' -f 5)
parted_output=$(parted -ms "$img" unit B print | tail -n 1)
partnum=$(echo "$parted_output" | cut -d ':' -f 1)
partstart=$(echo "$parted_output" | cut -d ':' -f 2 | tr -d 'B')
loopback=$(losetup -f --show -o $partstart "$img")
tune2fs_output=$(tune2fs -l "$loopback")
currentsize=$(echo "$tune2fs_output" | grep '^Block count:' | tr -d ' ' | cut -d ':' -f 2)
blocksize=$(echo "$tune2fs_output" | grep '^Block size:' | tr -d ' ' | cut -d ':' -f 2)

fsck -y "$loopback"
0

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.