usb_inst.sh seems to be contradictory

You can report problems, make suggestions, about the new BETA versions in this forum. For stuff related to final releases, please post a message in other forums
whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

usb_inst.sh seems to be contradictory

Post by whit » 06 Jun 2010, 22:40

Code: Select all

# ./usb_inst.sh
Device [/dev/sdb] detected as [         Patriot Memory  ] is removable and size=3825MB
* Device [/dev/sdb] is mounted: cannot use it
All valid USB/Removable devices are currently mounted, unmount these devices first
but

Code: Select all

# ./usb_inst.sh
Device [/dev/sdb] detected as [         Patriot Memory  ] is removable and size=3825MB
* Device [/dev/sdb] is not mounted
./usb_inst.sh: line 524: ./usb_inst/dialog: Input/output error
./usb_inst.sh: line 524: ./usb_inst/dialog: Input/output error
and from http://www.sysresccd.org/Sysresccd-manu ... _USB-stick:

Code: Select all

 Plug the USB stick

Just make sure the USB stick has been plugged at that stage, and wait few seconds to be sure the device has been detected by the system.
So when it's recognized by the system, it gets mounted (this is on a current Ubuntu box). The USB install script doesn't like that. If it's unmounted, the script announces it's not mounted, but then has errors. I'm guessing that we want the stick "recognized" but not mounted? And then the "Device [/dev/sdb] is not mounted" is not a complaint but just trivia? And the input/output errors are a problem with - well, what? Is the ISO bad? Is the script unable to mount the stick to write to it?

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: usb_inst.sh seems to be contradictory

Post by admin » 07 Jun 2010, 08:12

1) Can you please check you are using sysresccd-1.5.6-beta3 or more recent, this script has been modified recently
2) The device has to be unmounted when you run this tool, so you have to insert the device and unmount it by hand first
3) Can you run the installer using "bash -x ./usb_inst.sh" to see which commands it's trying to run ? We have to understand why dialog fails with an Input/output error. As you running the program as root, and do you have a /tmp directory on your system ?

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 08 Jun 2010, 18:59

This is with systemrescuecd-x86-1.5.6-beta4.iso

Yes, I have a /tmp directory

Okay, I see the message that it is "unmounted" is purely informational.

Here's the end of the "bash -x" output:

Code: Select all

+ echo 'Installation on ++ at 2010-06-08_14:52'
+ status='Installation on ++ in progress\n\n'
+ status='Installation on ++ in progress\n\ndetails will be written in /tmp/usb_inst.log\n'
+ dialog_status 'Installation on ++ in progress\n\ndetails will be written in /tmp/usb_inst.log\n'
+ ./usb_inst/dialog --infobox 'Installation on ++ in progress\n\ndetails will be written in /tmp/usb_inst.log\n' 20 75
./usb_inst.sh: line 524: ./usb_inst/dialog: Input/output error
+ status='Installation on ++ in progress\n\ndetails will be written in /tmp/usb_inst.log\n* Writing MBR on ++\n'
+ dialog_status 'Installation on ++ in progress\n\ndetails will be written in /tmp/usb_inst.log\n* Writing MBR on ++\n'
+ ./usb_inst/dialog --infobox 'Installation on ++ in progress\n\ndetails will be written in /tmp/usb_inst.log\n* Writing MBR on ++\n' 20 75
./usb_inst.sh: line 524: ./usb_inst/dialog: Input/output error
+ do_writembr ++
And here's /tmp/usb_inst.log:

Code: Select all

# more usb_inst.log

Installation on ++ at 2010-06-08_14:52
+ devname=++
++ echo ++
++ sed -e 's!/dev/!!g'
+ shortname=++
+ check_valid_blkdevname ++
+ '[' -z ++ ']'
+ '[' '!' -b ++ ']'
+ die '++ is not a valid device name (2)'
+ '[' -n '++ is not a valid device name (2)' ']'
++ basename ./usb_inst.sh
+ echo 'usb_inst.sh: error: ++ is not a valid device name (2)'
usb_inst.sh: error: ++ is not a valid device name (2)
+ exit 1

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 08 Jun 2010, 19:13

Here's where the script's getting the "++" from: usb_inst_18915.tmp:

Code: Select all

++ ./usb_inst/dialog --backtitle 'Select USB/Removable device' --checklist 'Select the USB/Removable devices where you want to install it.\n Files on these devices will be lost if you continue.\n' 20 70 5 /dev/sdb '[         Patriot Memory  ]  and size=3825MB' off
./usb_inst.sh: line 481: ./usb_inst/dialog: Input/output error
So the script expects, in this case, to find "/dev/sdb" there but finds "++".

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: usb_inst.sh seems to be contradictory

Post by admin » 08 Jun 2010, 20:12

The cause of the problem is the usb_inst/dialog program that crashes. Do you see the menu on the screen before the crash ?
Can you run it by hand to see if it works ? Do you have the same problem if you run the same command using the official dialog binary from your distribution ?

Here is a simple thing to do with dialog:

Code: Select all

./usb_inst/dialog --infobox "Hello world" 20 75 ; sleep 10
The complete command which writes in /tmp/test.txt:

Code: Select all

./usb_inst/dialog --backtitle 'Select USB/Removable device' --checklist 'Select the USB/Removable devices where you want to install it.\n Files on these devices will be lost if you continue.\n' 20 70 5 /dev/sdb '[         Patriot Memory  ]  and size=3825MB' off 2>/tmp/test.txt

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 09 Jun 2010, 17:57

No menu on the screen before it crashes.

Code: Select all

# ./usb_inst/dialog --infobox "Hello world" 20 75 ; sleep 10
bash: ./usb_inst/dialog: Input/output error
Dialog wasn't installed on my system. But after installing, the official dialog does work fine. This a Ubuntu 10.04 64-bit box - a common animal these days.

So if I take your script where I can edit it, then change LOCATION and PROG_DIALOG it should run?

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 09 Jun 2010, 18:04

Nope, more stuff doesn't run:

Code: Select all

/usb_inst# ./parted
bash: ./parted: Input/output error

Code: Select all

/usb_inst# ./syslinux
bash: ./syslinux: Input/output error

Code: Select all

/usb_inst# ./mkfs.vfat
bash: ./mkfs.vfat: Input/output error

Code: Select all

/usb_inst# ./install-mbr 
bash: ./install-mbr: Input/output error

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 09 Jun 2010, 18:17

Even after changing all the settings to, in this instance:

Code: Select all

    LOCATION="/mnt/tmp"
    PROG_PARTED="`which parted`"
    PROG_INSTMBR="`which install-mbr`"
    PROG_MKVFATFS="`which mkfs.vfat`"
    PROG_SYSLINUX="`which syslinux`"
    PROG_DIALOG="`which dialog`"
it appears to at least partially install, but doesn't get far enough to produce what can be recognized as a bootable disk. Those programs are all on the system in native form and found. So something else isn't right.

Update: It failed because a bad symlink for /mnt/usbstick was left from an earlier failure. Removed that, and it works!

Update 2: Well it boots as far as SYSLINUX and a boot: prompt. It should be showing me some options for choosing how to boot, right? It wants me to specify a kernel image, but gives no clues on the choices. This can't be right.

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: usb_inst.sh seems to be contradictory

Post by admin » 09 Jun 2010, 18:41

Thanks for working on that problem. So it's a more generic problem, all programs have the same error.
I think using system programs is not the ultimate solution since it would be unusable for users who don't have these things installed on their system.
We just have to understand what the problem is with the binary provided on the cdrom.

I suspect it could be a security or permission problem, or something like that. For instance the options used to mount the cdrom may prevent execution.
You can see if it makes a difference when you remount the cdrom using the "exec" mount option. (cf fsatb)

If your cdrom is mounted with the "noexec" option, it may be why it fails:

Code: Select all

/dev/xxx on /media/cdrom0 type iso9660 (rw,noexec,nosuid,nodev)
The solution may be something like that:

Code: Select all

sudo mount -o remount,exec /media/cdrom0
Anyway, when I mount my cdrom with the noexec flag, I get a permission denied message, so it's not exactly the same problem

Another interesting test is to just copy all these files (at least usb_inst + usb_inst.sh) to a temp directory on your disk and to run it from that place.

Can you please run one of these programs from strace to see what happens.
# apt-get install strace
# strace -f -o /var/tmp/strace.txt ./usb_inst/parted

This will produce /var/tmp/strace.txt. Can you upload this file somewhere or on pastebin, or in this topic if you can see what part is relevant. I expect something at the end of the log file that explains which error has been returned internally. So the last 50 lines should be enough I hope.

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: usb_inst.sh seems to be contradictory

Post by admin » 09 Jun 2010, 20:21

I have modified the usb_inst.sh script to run these programs from a temp directory (/tmp/usb_inst.tmp).
It's a bit more complicated but I think that's the only solution if we can't execute the program from the cdrom.
The script has to work for all users even if they don't have parted/dialog/mkfs.vfat installed on their system.
This new version will be in sysresccd-1.5.6-beta7.

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: usb_inst.sh seems to be contradictory

Post by admin » 10 Jun 2010, 12:44

sysresccd-1.5.6-beta7 is available now. Can you please try with that version ?

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 10 Jun 2010, 13:27

admin wrote: If your cdrom is mounted with the "noexec" option, it may be why it fails:
Could it have something to do with mounting the iso via loopback? I haven't burned a CD.
Can you please run one of these programs from strace to see what happens.
# apt-get install strace
# strace -f -o /var/tmp/strace.txt ./usb_inst/parted

Code: Select all

# strace -f -o /var/tmp/strace.txt ./usb_inst/parted
strace: exec: Input/output error
I'm not running AppArmour or SELinux, so it's not a security-permissions thing. And the binaries all have execute permission on the system level.

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 10 Jun 2010, 13:35

admin wrote:I have modified the usb_inst.sh script to run these programs from a temp directory (/tmp/usb_inst.tmp).
Before doing that I thought I'd see if I can copy one and run it from /tmp.

Code: Select all

# cp parted /tmp/parted
cp: reading `parted': Input/output error
Now, I'd been able to copy usb_inst.sh just fine. Anything from the iso's root directory copies, but anything from within its subdirectories gives the "Input/output error." It's all represented in directories okay, but if I go to view any of it that should be text files, nothing shows either. So somehow either the .iso is bad or incompatible with normal loopback mounting - aside from its base directory.

Never seen this before. I'll grab the newer iso and see if the problem repeats.

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: usb_inst.sh seems to be contradictory

Post by admin » 10 Jun 2010, 14:39

The first thing to do is to check the md5sum of the ISO image then... It really looks like a corruption.

Anyway, it raised an important potential problem: if the ISO / cdrom media is not mounted with the exec permission, then the old version of the script could not work. So I think the recent modification (introduced in 1.5.6-beta7) is still necessary for certain users: the binaries are first copied to a temp directory, and then the script runs the binaries from that place. Unfortunately it makes the script a bit more complex and it depends on disk space but it's the only way to be sure it will not fail for users having the cdrom mounted in noexec mode.

Also this version of usb_inst.sh adds extra checks to only attempt the installation with valid partition names.

whit
Posts: 10
Joined: 10 May 2008, 18:15
Location: Vermont

Re: usb_inst.sh seems to be contradictory

Post by whit » 10 Jun 2010, 18:39

The new beta installed fine.

Post Reply