Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Jan 2018, 11:04
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Grub4DOS Error 13, wee 13> due to 64-bit Ext4
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
jd7654

Joined: 06 Apr 2015
Posts: 256

PostPosted: Wed 23 Aug 2017, 03:09    Post subject:  Grub4DOS Error 13, wee 13> due to 64-bit Ext4
Subject description: How to fix Grub4DOS bootloader problem when using a 64-bit Ext4 partition
 

This How-To is to address an issue when trying to use Grub4DOS with newer systems with 64-bit Ext4 partitions, typically created when another newer Linux distro is installed.

This is an issue with older bootloaders like Grub4DOS (0.4.4), Grub Legacy (0.97) and Syslinux (6.03) not being compatible with this relatively new filesystem implementation of 64-bit Ext4. The current Grub2 (aka simply, Grub) is compatible with this newer filesystem. Installing Grub4DOS onto 64-bit Ext4 results in the Error 13 and bootloader failure.

Note that this has nothing to do with a 64-bit processor, or a 64-bit operating system. It is a separate issue with the filesystem itself being 64-bit, as opposed to 32-bit in previous versions. While Puppy booted live can read from a 64-bit Ext4 partition, the Grub4DOS bootloader itself cannot.

Wrote about it previously:
http://www.murga-linux.com/puppy/viewtopic.php?p=945756#945756

Quote:

This is a relatively new issue that came up within the last year, and Puppy may have to address it at some point. Has to do with 64-bit Ext4, which is different from 64-bit Linux. Started with 1.43 version of e2fsprogs, which came in with Ubuntu 16.10. Syslinux posted some info about it:
http://www.syslinux.org/wiki/index.php?title=Filesystem
Quoting part of the release notes of version 1.43 of e2fsprogs (May 17, 2016):
Mke2fs will now create file systems with the metadata_csum and 64bit features enabled by default.
Users should rather (manually) disable the 64bit feature in the mke2fs command when creating / formatting a boot volume with ext4; otherwise, the bootloader (as of version 6.03) will fail.


Technically, any distro released after May 2016 could have its installer creating 64-bit Ext4 partitions. Depends if their programs are all up to date.(check Distrowatch table) This will be more and more of a problem as new users try to install Puppy on top of newer distros with this feature enabled. Luckily was not in Ubuntu 16.04LTS which is so widespread, but appears to have gotten in with 16.10. I noticed it on an Arch derivative, but they are more up to date than others.


Depending on how you have Grub4DOS installed, you may see different errors.

If loaded to MBR, you will see a failure in the stage 1 of the bootloader as it cannot read the stage 2 on the 64-bit Ext4 partition:
wee 0> find --seek-root /grldr
(0x80,0)
wee 0> /grldr
wee 13>


If Grub4DOS is installed and working on another partition, you will see the error in stage 2 as it tries to boot Puppy/Linux on the 64-bit Ext4 partition:
Error 13: Invalid or unsupported exectuable format

To still use Grub4DOS with this partition, you will need to remove the 64-bit feature from the Ext4 filesystem.

Unfortunately, Puppy does not have the version of e2fsprogs 1.43 or greater that is required to fix the problem. But you can download and compile from source directly:
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git

EDIT: For a quick fix, here is a link to .pet packages for current Puppy 6 Slacko and Tahr.
(disclaimer: not all implications of using updated e2fsprogs has been tested, best to use only as a temporary fix for this issue)

Another easy way to get the right version is to download the Gparted Live CD ISO, version higher than 0.26 has e2fsprogs >=1.43:
http://gparted.org/download.php
And then you can use the e2fsprogs included on the disc.
Or you can boot a newer Linux distro/disc like the one which created the partition. Also see addendum below for rescue disc option.

From booted Gparted Live desktop, open a terminal and do the following:
(note: in Gparted Live examples below, all commands preceded by "sudo" prefix)

First, check partition for 64-bitness with tune2fs -l (partition) command::
Code:
user@debian:~$ sudo tune2fs -l /dev/sda1
tune2fs 1.43.1 (08-Jun-2016)
Filesystem volume name:   <none>
...
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash
...
Checksum:                 0x65dd14e3


Note the 64bit in Filesystem features list above.

In order to change this, you must have e2fsprogs version 1.43 or greater, where resize2fs will have "-s" option as below:

Code:
user@debian:~$ sudo resize2fs
resize2fs 1.43.1 (08-Jun-2016)
Usage: resize2fs [-d debug_flags] [-f] [-F] [-M] [-P] [-p] device [-b|-s|new_size] [-z undo_file]


Then to perform the fix, issue resize2fs -s (partition) command to remove 64-bit feature:

Code:
user@debian:~$ sudo resize2fs -s /dev/sda1
resize2fs 1.43.1 (08-Jun-2016)
Converting the filesystem to 32-bit.
The filesystem on /dev/sda1 is now 2883328 (4k) blocks long.


You may get a warning to do e2fsck first, so do that and then issue resize2fs after that.

That's it! Grub4DOS should now be working on your updated 32-bit Ext4 partition. Only takes a few seconds and existing data is unaffected.


Addendum:

If you do not want to use Grub4DOS and want to revert to your Linux Grub2 bootloader, you can use a rescue disc to boot into your other Linux. One good one is Super Grub2 Disk. Very tiny download ISO file that you can burn to CD or write to USB. You don't have to modify/change anything, it just looks for and boots any OS it can find. Then you can repair OS from within itself.

Download Super Grub2 Disk, recommended download ISO:
http://www.supergrubdisk.org/category/download/supergrub2diskdownload/super-grub2-disk-stable/

Write to flash. For Windows, cannot use Rufus. Direct write with something like ImageUSB:
http://osforensics.com/tools/write-usb-images.html


EDIT: A newer Chinese fork of Grub4DOS by chenall has been modified to address 64-bit Ext4, but not yet fully integrated with latest Puppy.

Last edited by jd7654 on Sat 16 Sep 2017, 23:32; edited 2 times in total
Back to top
View user's profile Send private message 
bigpup


Joined: 11 Oct 2009
Posts: 9882
Location: Charleston S.C. USA

PostPosted: Wed 23 Aug 2017, 10:27    Post subject:  

jd7654,

Thanks for this how to!!!

Could you please go to the Woof-CE on Github and submit a new pull request on this issue?
https://github.com/puppylinux-woof-CE/woof-CE
This needs to get some fix put into Puppy.
Woof-CE is the place to do it.
Making a pull request will get the people working on Woof-CE knowing about this issue.

You may be able to get involved in figuring out what needs to be done in Woof-CE.

Thanks!!

_________________
I have found, in trying to help people, that the things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected Shocked
Back to top
View user's profile Send private message 
mikeslr


Joined: 16 Jun 2008
Posts: 2131
Location: 500 seconds from Sol

PostPosted: Wed 23 Aug 2017, 10:42    Post subject:  

Ditto bigpup.

Thanks, jd7654, for taking the time to clear up what was going wrong and how to handle it.

One other thing for anyone who is ambitious, 'though I'm not sure a "one size fits all" is possible. Well, two sizes --one 32-bit, one 64-bit. Perhaps someone could create pets of e2fsprogs version 1.43 which could be installed into Puppies being booted from USB-Keys, eliminating the need to download gparted or resort to some other Distro.


mikesLr
Back to top
View user's profile Send private message 
jd7654

Joined: 06 Apr 2015
Posts: 256

PostPosted: Wed 23 Aug 2017, 10:59    Post subject:  

mikeslr wrote:
One other thing for anyone who is ambitious, 'though I'm not sure a "one size fits all" is possible. Well, two sizes --one 32-bit, one 64-bit. Perhaps someone could create pets of e2fsprogs version 1.43 which could be installed into Puppies being booted from USB-Keys, eliminating the need to download gparted or resort to some other Distro.


Yeah, that might be a good idea. I never even tried.(compile >=1.43 e2fsprogs on older Pups) Could make official release Tahr and Slacko even have the power to fix.
EDIT: Did a quick test and current e2fsprogs version 1.43.4 compiles fine in Puppy 6 official Slacko and Tahr.

Also note from syslinux link above:
- To manually disable the "64bit" feature when creating ext4 volumes, use -O ^64bit in the mke2fs (or equivalent) command. That is, an hyphen, immediately followed by an upper-case letter "O", a space character, the caret "^" symbol, followed by "64bit" (no hyphen).
In some cases, a backslash character before the caret might be needed: -O \^64bit
- In resize2fs, the -s parameter (that is, an hyphen followed by a lower-case letter "s") disables the "64bit" feature of an already-created filesystem volume, if its size allows it.


Not all newer Linux and not all Gparted may cause this issue. it all depends if they use that -O ^64bit or not in the mke2fs command, or like newest Dog Linux does, excludes that option from the list of Filesystem features. If Puppy were given the updated e2fsprogs, some other changes may be required as well to prevent issue popping up.
Back to top
View user's profile Send private message 
jd7654

Joined: 06 Apr 2015
Posts: 256

PostPosted: Thu 24 Aug 2017, 19:51    Post subject:  

bigpup wrote:
Could you please go to the Woof-CE on Github and submit a new pull request on this issue?


I'm not familiar with that, and not sure if a fix request in Woof-CE is needed?

I just did a quick check in vbox of the latest Slacko-700 RC3 (6.9.9.9) and although it does create the boot problem, it also has the ability to fix it.
So it could be fixed with documentation and awareness of the 64-bit Ext4 issue. And since Slacko 700 has e2fsprogs 1.43.1 included from Slackware 14.2, it can perform the fix above with the resize2fs -s command.(I verified)

But maybe it could fall in Woof-CE to modify the Grub4DOS config installer, to check for the existence of 64-bit Ext4, and pop up warning to offer fix to change to 32-bit otherwise boot will fail. I would imagine that wouldn't be too hard to do, but I never looked at the code. Or the big fix would be to change to offer Grub2 also, but that would be a big undertaking, or is it already in development? I don't know.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0710s ][ Queries: 11 (0.0067s) ][ GZIP on ]