"Installation failed !" "Exit code: 256" in GUI #30

Open
Lin-Buo-Ren opened this Issue Feb 13, 2016 · 27 comments

Comments

Projects
None yet
Collaborator

Lin-Buo-Ren commented Feb 13, 2016

Install log(when running winusbgui as normal user)

Installation failed !
Exit code: 256
Log:
**blank**

_001

Install log(when running winusbgui as root)

Installation failed !
Exit code: 256
Log:
Formatting device...
Wait 3 seconds for block device nodes to populate...
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
mkfs.fat 3.0.28 (2015-05-16)
Mounting...
mount: /dev/loop0 is write-protected, mounting read-only
Copying...
Installing grub...
Installing for i386-pc platform.
Installation finished. No error reported.
Installing grub.cfg...
Exiting...
Syncing...
/usr/local/bin/winusb: 行 78: 20260 終止                  while true; do
    sleep 0.05; echo 'pulse';
done
Cleaning...
/usr/local/bin/winusb: 行 78: 20593 終止                  while true; do
    sleep 0.05; echo 'pulse';
done
Unmounting and removing '/media/winusb_iso_1455346491_15903'...
Unmounting and removing '/media/winusb_target_1455346491_15903'...

P.S. "終止" in the output approximately means "terminated".

Reporter's Environment

Operating System

Ubuntu 15.10 AMD64

WinUSB

commit f3bd9ec

Software Installation Prefix

/usr/local

WxWidgets

3.0.2+dfsg-1.2 from Ubuntu 15.10 software source

Locale

LANG=zh_TW.UTF-8
LANGUAGE=zh_TW:zh_HK:zh_CN:en_US:en
LC_CTYPE="zh_TW.UTF-8"
LC_NUMERIC=zh_TW.UTF-8
LC_TIME=zh_TW.UTF-8
LC_COLLATE="zh_TW.UTF-8"
LC_MONETARY=zh_TW.UTF-8
LC_MESSAGES="zh_TW.UTF-8"
LC_PAPER=zh_TW.UTF-8
LC_NAME=zh_TW.UTF-8
LC_ADDRESS=zh_TW.UTF-8
LC_TELEPHONE=zh_TW.UTF-8
LC_MEASUREMENT=zh_TW.UTF-8
LC_IDENTIFICATION=zh_TW.UTF-8
LC_ALL=
Owner

slacka commented May 17, 2016

@Lin-Buo-Ren
Do you have gksudo command installed on your system?

Collaborator

Lin-Buo-Ren commented May 17, 2016

@slacka

Do you have gksudo command installed on your system?

I'm pretty sure I have it installed

Exit code: 32512
Log:

Also error while installing. I don't have gksudo but I do have pkexec so perhaps it could look for which is installed when compiling and use that?

Collaborator

Lin-Buo-Ren commented Jul 8, 2016

@Justinzobel That can be done in runtime.

BTW the 'winusb' package does depend on 'gksu' package, which provides 'gksu' and 'gksudo' commands

Collaborator

Lin-Buo-Ren commented Jul 9, 2016

I can't reproduce the issue in the latest build, may re-open it when I notice it agian

Lin-Buo-Ren closed this Jul 9, 2016

muzena commented Jul 20, 2016

@Lin-Buo-Ren
I have same problem in In Mint 18 and Ubunt Xenial

slug45 commented Sep 12, 2016

I think you need the destination partition/drive to be unmounted to make it work.

I got same problem but solved now by
"sudo apt-get install gksu"
"gksudo winusbgui"
(i.e..type it without quotes)

Lin-Buo-Ren changed the title from "Installation failed !" in GUI but not in CLI to "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated ) Nov 8, 2016

Collaborator

Lin-Buo-Ren commented Nov 8, 2016 edited

Reopen issue as there's new incoming report.

_060

Lin-Buo-Ren reopened this Nov 8, 2016

Collaborator

Lin-Buo-Ren commented Nov 8, 2016 edited

Hi again, please use the latest revision in GitHub repo and see if it's still reproducible(it should be, as we never fixed the problem anyway).

Collaborator

Lin-Buo-Ren commented Nov 8, 2016

The problem seems to be on the pulse function, however I have no idea why it's failing...

pulseCurrentPid=0
function pulse()
{
    if [ "$forGui" -eq 1 ]; then
        if [ ! "$pulseCurrentPid" -eq 0 ]; then
            kill "$pulseCurrentPid"
            #wait "$pulseCurrentPid"
            pulseCurrentPid=0
        fi

        if [ "$1" = 'on' ]; then
            cd /; while true; do sleep 0.05; echo 'pulse'; done &
            pulseCurrentPid="$!"
        elif [ "$1" != 'off' ]; then
            echo "Pulse: bad argument" >&2
            exit 1
        fi
    fi
}

OrDuan commented Nov 17, 2016

I was encountered this issue right now, with windows 10.
I'm on ubuntu 16.04 and WinUSB 1.0.11

I tried to run the installation anyway and it worked(I just ignored the error).

Collaborator

Lin-Buo-Ren commented Nov 17, 2016

@OrDuan Hi, please use the latest revision in the repository (instead of latest released version) for reproducing the issue.

We've have changed a quite amount of code since 1.0.11

I got similar problem and solve it!
I dont now why, but if you use GUI its not work. Use command line in way:
sudo winusb --format /path-to-ISO-file/filename.iso /dev/sdb (or other way to your flash)

Collaborator

Lin-Buo-Ren commented Nov 22, 2016

@temyrrian The issue title already tell that CLI(command line interface) works.
This issue is about the GUI problem

The GUI fix is to blank the USB, DO NOT FORMAT drive this is for the Error 256 issue.

a-n-d-r-e-i commented Jan 26, 2017 edited

I was able to reproduce this error using the GUI version and in my case simply ignore the error haven't solved the problem.

Log as root

Installation failed !
Exit code: 256
Log:
Formatting device...
Wait 3 seconds for block device nodes to populate...
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
mkfs.fat 3.0.28 (2015-05-16)
Mounting...
Copying...
Installing grub...
Installing for i386-pc platform.
Installation finished. No error reported.
Installing grub.cfg...
Exiting...
Syncing...
/usr/bin/winusb: line 78: 32619 Terminated              while true; do
    sleep 0.05; echo 'pulse';
done
Cleaning...
/usr/bin/winusb: line 78:  3517 Terminated              while true; do
    sleep 0.05; echo 'pulse';
done
Unmounting and removing '/media/winusb_iso_1485449591_28119'...
Unmounting and removing '/media/winusb_target_1485449591_28119'...

Environment

I do have gksu package installed.

Operating System

Ubuntu 16.04 AMD64

Locale

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=pt_BR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_ALL=

WinUSB

commit 28ff500

CLI

I'm also getting an error when I try using the CLI:

sudo winusb -v --format ~/Downloads/win10.iso /dev/sdb1
Formatting device...
Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 
on /dev/sdb1 have been written, but we have been unable to 
inform the kernel of the change, probably because it/they are in use.  
As a result, the old partition(s) will remain in use.  
You should reboot now before making further changes.

fedix23 commented Feb 28, 2017

I think i have a solution
I used gparted to unmount the usb then format it to ntfs and it's work

@fedix23 This worked for me too, but, now the question is where the error come from?

devin42r commented Apr 28, 2017 edited

Kubuntu 16, similar response to @a-n-d-r-e-i

I went through all the suggestions above, none worked... the only thing that worked for me was:
*Format the Flash the USB Stick

Now if you excuse me, gonna install the crap Windows onto somebody else's machine, hope my hands don't get infected... LOL

Collaborator

Lin-Buo-Ren commented Jun 12, 2017

No longer reproduced and the /usr/bin/winusb: line 78: 18265 Terminated message probably comes from the pulse function in src/woeusb, closing...

@Lin-Buo-Ren Lin-Buo-Ren added a commit that referenced this issue Jun 12, 2017

@Lin-Buo-Ren Lin-Buo-Ren src/winusb: Silent the confusing "/usr/bin/woeusb: line XXX: XXXXX Te…
…rminated" message

Related-GitHub-issue: #30
Signed-off-by: 林博仁 <Buo.Ren.Lin@gmail.com>
2747b98
Collaborator

Lin-Buo-Ren commented Jun 14, 2017

According to WebUpd8 the issue still can be reproduced, reopened.

Lin-Buo-Ren reopened this Jun 14, 2017

Lin-Buo-Ren changed the title from "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated ) to "Installation failed !" "Exit code: 256" in GUI Jun 14, 2017

Collaborator

Lin-Buo-Ren commented Jun 14, 2017 edited

Some investigation of the Exit code: 256:

  • At least in Linux all program's exit status is 8-bit(0~255), so the 256 isn't come from the external command but probably come from the API that calls it
  • The external command is called and returned to the following src/MainPanel.cpp code:
PipeManager pipe(std::string("pkexec sh -c 'woeusb --no-color --for-gui --format \"") + iso + "\" \"" + device + "\" 2>&1'");

/* A bunch of code managing the install progress */

int exitCode = pipe.Close();
if(exitCode == 0)
{
	wxMessageBox(_("Installation succeded !"), _("Installation"), wxOK | wxICON_INFORMATION, this);
}
else
{
	wxMessageBox(wxString(_("Installation failed !")) + _T("\nExit code: ") + wxNbToStr(exitCode) + _T("\nLog:\n") + log, _("Installation"), wxOK | wxICON_ERROR, this);
}

The PipeManager is a custom class dealing with the external call and its output stream, at src/processManager.cpp, with the constructor and Close method like this:

PipeManager::PipeManager(const std::string &command)
{
    m_pipe = popen(command.c_str(), "r");

    if(m_pipe == NULL)
    {
        MY_THROW("Can't open pipe for command '" << command << "' !");
    }
}

int PipeManager::Close()
{
    if(m_pipe)
    {
        int exitCode = pclose(m_pipe);
        m_pipe = NULL;
        return exitCode;
    }
    else
    {
        MY_THROW("Pipe not open !");
    }
}

As you can see the exit status comes from the pclose(3) external library function, which has the follow synopsis and return code:

int pclose(FILE *stream);

The pclose() function returns -1 if wait4(2) returns an error, or some
other error is detected.

Which still doesn't mention the "256" exit status, a dead end.

Collaborator

Lin-Buo-Ren commented Jun 14, 2017

Maybe a type conversion issue instead?

The exitCode is int and is passed to wxNbToStr to convert to some sort of string. wxNbToStr, which is defined in src/strWxStdConv.hpp called nbToString with the exitCode as argument. nbToString is defined in src/nbStrConvert.hpp with this definition:

template < typename T >
std::string nbToString(const T &nb)
{
    std::stringstream ss;
    std::string str;
    if(sizeof(T) != 1) // Pas char
    {
        ss << std::fixed << nb; // fixed : pas de nb scientifique. Par contre, plein de zero...
    }
    else
    {
        // Type char ==> on le tranforme en int
        ss << std::fixed << int(nb); // fixed : pas de nb scientifique. Par contre, plein de zero...
    }
    ss >> str;

    // On enléve les 0 et . innutils
    std::string::iterator it = str.end() - 1;
    if(str.find('.') != std::string::npos) // On ne racourci pas le nb si pas de virgule
    {
        while(str.size() > 1 && *it == '0')
        {
            str.erase(it);
            it = str.end() - 1;
        }

        if(*it == '.') // Si on arrive à la virgule ==> suppression.
        {
            str.erase(it);
        }
    }

    return str;
}

Which I have no idea what it does for now.

Collaborator

Lin-Buo-Ren commented Jun 14, 2017

I've managed to reproduce the bug again by issue #109 , this time I'm pretty sure that the exit status is actually 1 instead of 256, and more possibility that this is in fact a numeric conversion issue.

_151

Still unsure where's the problem though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment