LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-08-2014, 09:06 AM   #1
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Rep: Reputation: 231Reputation: 231Reputation: 231
Exclamation usbimg2disk.sh FAILED at line 483


Greetings!

I'm running into this error when trying to build a usb bootable disk for 14.1. I did not have any problems when I did this for current. Here is the code:
Code:
--- Available free space on the the USB drive is 3907100 KB
--- Required free space for installer: 37040 KB
--- Copying boot files to the USB drive...
--- Extracting Slackware initrd.img...
--- Modifying installer files...
--- Gzipping the initrd image again:
--- Copying Slackware package tree to the USB drive...
--- Cleaning up the staging area...
--- Making the USB drive '/dev/sdb' bootable...
*** /usr/local/sbin/usbimg2disk.sh FAILED at line 483 ***
--- Cleaning up the staging area...
umount2: No such file or directory
umount: /mnt/img.e7hs8B: not found
Any ideas? Thanks!
 
Old 06-08-2014, 09:41 AM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Judging by the line number of that error you are using the usbimg2disk.sh script from my web site and not the somewhat shorter version contained in Slackware's usb_and_pxe_installer directory.

The error occurs on the line which calls the "makebootable" function, which uses sfdisk to set the first partition bootable. Perhaps your computer does not have sfdisk installed?
In any case, try adding "--logfile </path/to/some/logfilename>" as parameter and after the script stops, inspec the content of that log file to see if it helps you find the cause of the error.

The difference between my original usbimg2disk.sh and the version maintained by Pat in Slackware, is that my script extracts the initrd image, changes a few things so that the USB stick is automatically mounted on boot and then selected as the default location from which to install the packages, and then re-creates the initrd image.

Eric
 
Old 06-08-2014, 09:57 AM   #3
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,059

Rep: Reputation: Disabled
If instead of the version from Eric's website you want to use the version included in Slackware's usb_and_pxe_installer directory, and you'd like to boot a machine with an EFI firmware, apply attached patch first.

Caveat emptor: I'm not telling that will solve your issue, just an off-topic reminder.
Attached Files
File Type: txt usbimg2disk.sh.patch.txt (536 Bytes, 25 views)

Last edited by Didier Spaier; 06-08-2014 at 09:58 AM.
 
Old 06-08-2014, 10:11 AM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by Didier Spaier View Post
If instead of the version from Eric's website you want to use the version included in Slackware's usb_and_pxe_installer directory, and you'd like to boot a machine with an EFI firmware, apply attached patch first.

Caveat emptor: I'm not telling that will solve your issue, just an off-topic reminder.
Care to tell us why this is a good thing? What will it fix? Why just change these lines and not take care of the other commands relating to the /syslinux directory in the USB image?

I do not own any hardware with UEFI so I can not test what the effect of your modification is.

Eric
 
Old 06-08-2014, 10:23 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,059

Rep: Reputation: Disabled
@ Alien BoB. That puts the content of the initrd directly at the root of the tree instead of in the /syslinux directory IIRC, that is needed for EFI booting. I have no EFI firmware either, but tried in a VM.

PS To make sure, I'll apply the patch and test again.

Last edited by Didier Spaier; 06-08-2014 at 10:33 AM. Reason: PS added.
 
Old 06-08-2014, 11:12 AM   #6
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
This hardware is not that old, but it is also not EFI. Going to try the version from the official release and see if I get better results. Will report back. Thank you all for the help.
 
Old 06-08-2014, 12:18 PM   #7
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
Ah! Found the culprit. This thumb drive was previously a Fedora 20 Live Disc. When looking at the logfile (thanks AlienBOB for pointing that out), I found that sfdisk did not support GPT and thus the reason why it would fail to make the thumb drive bootable. What I had to do was to use gdisk, and do the following:
Code:
gdisk /dev/sdX
Select 2
Select x
Select z
Select Y to the next two questions
That's it! The usbimg2disk.sh works correctly. I tested using the one from Slackware (which was failing with the same error). I am assuming that it will work for the one provided by AlienBOB.

Hopefully this will help someone else! Thank you all for your help.
 
Old 06-08-2014, 02:01 PM   #8
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Thanks Didier for the insight, I failed to realize that UEFI needs the syslinux files in the root.

stormtracknole, I need to think that over. GPT formatted USB sticks should be properly handled.

Eric
 
Old 06-08-2014, 02:09 PM   #9
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by Alien Bob View Post
Thanks Didier for the insight, I failed to realize that UEFI needs the syslinux files in the root.

stormtracknole, I need to think that over. GPT formatted USB sticks should be properly handled.

Eric
Maybe it's the way Fedora partitioned the drive?
 
Old 06-08-2014, 09:53 PM   #10
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,508

Rep: Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473Reputation: 8473
Quote:
Originally Posted by stormtracknole View Post
...

Any ideas? Thanks!
If you're trying to make a complete bootable USB installer for a non-UEFI machine, just dd or cat the appropriate ISO image to the stick. The ones for 14.1 will boot directly from a stick just fine.
 
Old 06-08-2014, 10:27 PM   #11
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Original Poster
Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by volkerdi View Post
If you're trying to make a complete bootable USB installer for a non-UEFI machine, just dd or cat the appropriate ISO image to the stick. The ones for 14.1 will boot directly from a stick just fine.
Thank you! That is good to know. Last time I had tried that, it didn't work.
 
Old 06-09-2014, 01:49 AM   #12
rouvas
Member
 
Registered: Aug 2006
Location: Greece
Distribution: Slackware.12.2
Posts: 104
Blog Entries: 3

Rep: Reputation: 21
Quote:
Originally Posted by volkerdi View Post
If you're trying to make a complete bootable USB installer for a non-UEFI machine, just dd or cat the appropriate ISO image to the stick. The ones for 14.1 will boot directly from a stick just fine.
Great news! Thanks!
 
Old 08-09-2014, 05:42 AM   #13
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by Alien Bob View Post
stormtracknole, I need to think that over. GPT formatted USB sticks should be properly handled.
I ran into this very same problem, and I think I found the cause of the issue. You see, at lines 94 and 95 of the “usbimg2disk.sh” script (as found on the Slackware64 14.1 DVD), the following snippet is to be found:
Code:
# Wipe the MBR:
dd if=/dev/zero of=$TOWIPE bs=512 count=1
The thing is, this will (as the comment says) wipe the MBR—but it will leave the GPT data structures on the disk (or stick) intact. Any software that knows about GPT will, then, assume (and correctly, at that) that the disk is still partitioned using a GPT scheme, but with a corrupted MBR. Indeed, the “gdisk” utility will inform you that it:
Code:
Found valid GPT with corrupt MBR; using GPT and will write new protective MBR on save.
Non-GPT utilities (e.g., “fdisk”), assuming that they are recent enough to at least detect the presence of GPT data structures, will tell you that they don’t support GPT, and that you should use other utilities, such as “gdisk”, to operate on the disk partition table.

As stormtracknole noted, you can use “gdisk” to zap the GPT data structures, and the disk will subsequently be properly handled as an MBR-partitioned disk.

Otherwise, if you don’t want to, or cannot, use “gdisk”, then you should zap not only the MBR, but also the GPT tables—both at the beginning and at the end of the disk. Instead of wiping just the MBR (i.e., the first sector of the disk), you should zap the first 34 sectors—i.e.:
Code:
# Wipe the MBR and the main GPT tables:
dd if=/dev/zero of=$TOWIPE bs=512 count=34
Then, to wipe the backup copy of the GPT tables, you should zap the final 34 sectors of the disk as well:
Code:
# Wipe the backup GPT tables:
dd if=/dev/zero of=$TOWIPE bs=512 count=34 seek=$(( ${NUMBER_OF_SECTORS} - 34 ))
(where NUMBER_OF_SECTORS represents the total number of sectors on the disk).

(In fact, the backup GPT tables do not include a copy of the MBR, and occupy not 34 sectors, but one sector less, so you could replace both occurrences of the number “34” with “33” in that last command. Also, it is probably sufficient to zap only the MBR and both copies of the GPT Header—i.e., the first two sectors, and the single last sector—but I haven’t actually tried that.)

Also, I’m assuming that the GPT partition table has the default size, which allows for 128 partitions, recording four partitions per 512-byte sector—which works out to 32 sectors. The beginning of the disk has 1 sector for the “Protective” MBR, one sector for the GPT Header, plus 32 sectors for the GPT partition table; the end of the disk has only the 32 sectors for the GPT backup partition table, plus the GPT Header. The 32-sector, 128-partition size of the partition table is, however, not hard-wired; in principle, it could be made larger—though, for current-generation disks, 128 partitions should be more than sufficient. If you really want to be sure about the GPT table size, you will have to look into the GPT Header—i.e., the second sector of the disk—which, somewhere, includes a record of these values.)


EDIT:

There appears to exist an “sgdisk” utility, which can zap the MBR and GPT structures for you, as follows:
Code:
sgdisk --zap-all ${TOWIPE}
(provided, of course, that you have access to the utility).

For more info, cfr. The GPT fdisk Tutorial, by Rod Smith (which is where I learned this)—specifically, Wiping Out Old GPT Data.

Last edited by luvr; 08-09-2014 at 05:56 AM.
 
Old 03-15-2015, 09:53 AM   #14
rudsonalves
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Rep: Reputation: 0
usbimg2disk.sh FAILED

The script in Slackware-14.1/usb-and-pxe-installers, is worng in the line 151.

Replace the line

/sbin/sfdisk -A $USBDRV 1

by

/sbin/sfdisk -a $USBDRV 1

The -A is append a partition and sfdisk stay way for input commands.
 
Old 03-15-2015, 10:38 AM   #15
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by rudsonalves View Post
The script in Slackware-14.1/usb-and-pxe-installers, is worng in the line 151.

Replace the line

/sbin/sfdisk -A $USBDRV 1

by

/sbin/sfdisk -a $USBDRV 1

The -A is append a partition and sfdisk stay way for input commands.
Looks like the developer changed the meaning of a parameter here. How stupid can you get?

On Slackware 13.37:
Code:
        -A number
              Make the indicated partition(s) active, and all others inactive.
On Slackware 14.1:

Code:
       -a, --activate device [partition-number...]
              Switch  on  the bootable flag.  If no partition-number is speci-
              fied, then all partitions with an enabled flag are listed.

OPTIONS
       -A, --append
              Don't  create  a new partition table, but only append the speci-
              fied partitions.
 
  


Reply

Tags
usbimg2disk.sh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
usbimg2disk.sh - 'This is not a directory' gcamp689 Slackware - Installation 6 08-21-2013 04:26 PM
usbimg2disk.sh fails in current piratesmack Slackware 6 11-26-2010 02:27 PM
[SOLVED] USB bootstick, usbimg2disk.sh and OEM recovery partition catkin Slackware 15 07-01-2010 02:54 AM
usbimg2disk.sh fails on dependencies check zavko Slackware 1 02-11-2010 10:11 AM
Squid failed: line 162 su_jump Linux - Newbie 0 10-17-2002 08:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration