You are not logged in.

#1 2014-06-09 04:55:59

Never
Member
Registered: 2008-07-01
Posts: 103

[SOLVED]error: attempt to read or write outside of partition

Hello, I update my system at least once a week, sometimes I run pacman -Syu more than that. So this system is no more than about 7 days behind what is available today.  Last time I did this the kernel got updated and it updated itself again or at least it just ran mkinitcpio, also my passwd and group changed, anything that was not represented in the pacnew version got a representation, this last one mainly featured a lot of changes to "/usr/bin/nologin" from the login false version, whatever it was, nothing that looks too fussy.

Reboot just to see what will happen and I am greeted with this:

Booting `Arch Linux, with Linux core repo kernel'
Loading Linux core repo kernel ...
error: attempt to read or write outside of partition
Loading initial ramdisk ...
unaligned pointer 0x1d
Aborted. Press any key to exit.

I happen to have a usb drive that has Arch Linux 3.11.6.-1-ARCH, so I put that in and get an environment I can work with. Chroot in and so I can run mkinitcpio -p linux, thinking that that is the problem, some error in the kernel, I actually end up using the command

 # /usr/lib/modules

, since

 # mkinicpio -p linux 

won't run, it gives:

==> Building image from preset: /etc/mkinitcpio.d/linux.present: 'default'
    -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.config -g /boot/initramfs-linux.img
hexdump: /boot/vmlinuz-linux: Input/output error
==> ERROR: invalid kernel specified: '/boot/vmlinuz-linux'
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
    -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.config -g /boot/initramfs-linux-fallback.img -S autodetect
hexdump: /boot/vmlinuz-linux: Input/output error
==> ERROR: invalid kernel specified: '/boot/vmlinuz-linux'

However,

 # mkinitcpio -g /boot/linux.img -k 3.14.6-1-ARCH 

will. Everything finishes with a success, exit out, reboot and bam, same message, so it is not the kernel at least not on its own.  Here is what my fstab looks like:

# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
# /dev/sda3
UUID=4dbfa319-4f88-49c1-a595-27faabfe4f57	/         	ext3      	rw,relatime,data=ordered	0 1

# /dev/sda1
UUID=4C05-1A6B      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro	0 2

# /dev/sda4 LABEL=home
UUID=bff35508-596c-4d7c-a983-b6b0ddc4f6e2	/home     	ext3      	rw,relatime,data=ordered	0 2

# /dev/sda2
UUID=e87030ad-3226-41e3-938a-5be3351e34ed	none      	swap      	defaults  	0 0

#efivars
efivarfs	 /sys/firmware/efi/efivars	 efivarfs	 defaults 	0 0

#MySQL, linux version
tmpfs	/var/lib/mysqltmp	tmpfs	rw,gid=89,uid=89,size=100m,mode=0750,noatime	0 0

and my mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES="piix ide_disk reiserfs"
MODULES=""

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=""

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=""

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No raid, lvm2, or encrypted root is needed.
#    HOOKS="base"
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS="base udev autodetect block filesystems"
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS="base udev block filesystems"
#
##   This setup assembles a pata mdadm array with an encrypted root FS.
##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
#    HOOKS="base udev block mdadm encrypt filesystems"
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS="base udev block lvm2 filesystems"
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS="base udev autodetect modconf block filesystems keyboard fsck"

# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=""

While I am here I might as well ask this is this an appropriate boot structure?

/boot/
>>>>/EFI/
>>>>/>>>/grub/
>>>>/>>>/>>>>grubx64.efi
>>>>/grub
>>>>/>>>>/fonts
>>>>/>>>>/grub.cfg
>>>>/>>>>/grub.cfg.example
>>>>/>>>>/grubenv
>>>>/>>>>/local
>>>>/>>>>/>>>>/*.mo files
>>>>/>>>>/themes/
>>>>/>>>>/>>>>>>/starfield/*.png *.pf2 files
>>>>/>>>>/x86_64-efi
>>>>/>>>>/>>>>>>>/ *.mod files
>>>>/initramfs-linux-fallback.img
>>>>/initramfs-linux.img
>>>>/linux.img
>>>>/vmlinuz-linux

Anyone have any ideas on what I can do to get my system back?

Last edited by Never (2014-06-11 03:17:24)

Offline

#2 2014-06-10 09:54:54

Never
Member
Registered: 2008-07-01
Posts: 103

Re: [SOLVED]error: attempt to read or write outside of partition

Inside of my rescue disk I get:

# efibootmgr
BootCurrent: 000A
Timeout: 0 seconds
BootOrder: 0005,0003,0001,0002,000A,0004,0000,0007,0008,0009
Boot0000  Windows Boot Manager
Boot0001* USB Flopp/CD
Boot0002* USB Hard Drive
Boot0003* arch_grub
Boot0004* ATAPI CD-ROM Drive
Boot0005* grub
Boot0007* CD/DVD Drive
Boot0008* USB Floppy/CD
Boot0009* Hard Drive
Boot000A* UEFI: SanDisk Cruzer Glide 1.26

my /dev/sda1 was /boot/ not /boot/efi, so I made that change, allowing /boot on / [/dev/sda3] to now be populated with part of the stuff on /dev/sda1 and /dev/sda1 would just have /boot/efi/, instead of all of boot, then ran:

# modprobe -r efivars

# umount /sys/firmware/efi/efivars
# modprobe -r efivarfs

# modprobe efivarfs
# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
# efivar -l

returned a bunch of variables

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug
# grub-mkconfig -o /boot/grub/grub.cfg
# efibootmgr
BootCurrent: 000A
Timeout: 0 seconds
BootOrder: 0003,0001,0002,000A,0004,0000,0007,0008,0009
Boot0000  Windows Boot Manager
Boot0001* USB Flopp/CD
Boot0002* USB Hard Drive
Boot0003* grub
Boot0004* ATAPI CD-ROM Drive
Boot0007* CD/DVD Drive
Boot0008* USB Floppy/CD
Boot0009* Hard Drive
Boot000A* UEFI: SanDisk Cruzer Glide 1.26

arch_grub, whatever that was, went away. Pull out of arch-chroot, unmount sdaXs, reboot and:

ERROR: No boot disk has been detected or the disk has failed.

An extensive hp diagnostic check reveals... Nothing wrong.

A reboot and removal of all data written in /dev/sda1 and /dev/sda3/boot sectors reveals:

# mkdir /boot/efi/123
mkdir: cannot create directory /boot/efi/123: Cannot allocate memory

Which persist even on a restart and trying to mkdir into /mnt/arch/boot/efi/EFI while outside of arch-chroot. No idea why that is happening, oh well.

Offline

#3 2014-06-11 03:16:47

Never
Member
Registered: 2008-07-01
Posts: 103

Re: [SOLVED]error: attempt to read or write outside of partition

Ok so here is the fix, rescue disk in:

# mkfs.fat -F32 /dev/sda1

If that is your ESP, mount up all your partitions, go ahead and mount up swap as well

#mkdir /mnt/arch
#mount /dev/sda3 /mnt/arch/ 'if sda3 is your root partition'
#mount /dev/sda1 /mnt/arch/boot/efi/ 'if sda1 is your ESP'
#mount /dev/sda4 /mnt/arch/home/ 'if sda4 is your home partition'

# mkswap /dev/sda2

# swapon /dev/sda2

run a new fstab but save it as something else like fstab_new:

# genfstab -p -U -L /mnt/arch/ >> /mnt/arch/etc/fstab_new
# efivar -l

should return some list of variables, if not try:

# modprobe -r efivars

# umount /sys/firmware/efi/efivars
# modprobe -r efivarfs

# modprobe efivarfs
# mount -t efivarfs efivarfs /sys/firmware/efi/efivars

now we can enter our system:

# arch-chroot /mnt/arch /bin/bash

Renaming your /etc/fstab as fstab_old

 
# mv /etc/fstab /etc/fstab_old
# vim -o /etc/fstab_old /etc/fstab_new

use ctrl+w to switch between windows and edit fstab_new to have any values that are not represented from fstab_old, for instance my fstab_new did not have:

#efivars
efivarfs	 /sys/firmware/efi/efivars	 efivarfs	 defaults 	0 0

#MySQL, linux version
tmpfs	/var/lib/mysqltmp	tmpfs	rw,gid=89,uid=89,size=100m,mode=0750,noatime	0 0

so whatever you need to add. Try to save that as fstab

:w /etc/fstab

and then quit out everything else. Do the following:

# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
# mkinitcpio -p linux
# esp=/boot/efi
# grub-install --target=x86_64-efi --efi-directory=$esp --bootloader-id=grub --recheck --debug
# grub-mkconfig -o /boot/grub/grub.cfg
# exit
# reboot

You should be fine, I am.

Offline

Board footer

Powered by FluxBB