Tutorial: Running DDRescue-GUI on Windows with Cygwin

Introduction

Hi all. I’ve been wanting to release this for a long while now, but I’ve only just had time to write this all up. I should start by talking about what this is, and what this isn’t. This is a tutorial showing you how to set up Cygwin on Windows 7 or later, in order to run an initial, stripped down version of DDRescue-GUI. This is not an easy installation, and it isn’t free of bugs and other issues, but I hope that it’s enough to get you started running DDRescue-GUI on Windows.

NOTE: This video and post expect a small amount of knowledge about how Linux and Windows work. It’s possible to follow the tutorial without this, but it may make your life significantly harder. If you aren’t very technically minded, this may not be the tutorial for you.

The Video

The Writeup

System Requirements and Prerequisites

You need to have:

  • Windows 7 or later (32-bit or 64-bit).
  • At least 2 GB free disk space to install Cygwin.
  • A (preferably fast) internet connection.
  • At least 2 GB of RAM, but preferably more.
  • A few hours to set up Cygwin.

Notes:

It may be possible to do this on Windows Vista, but I don’t support that configuration as Vista is end-of-life.

If you have a faster machine with a good internet connection, it may be significantly quicker, but expect this to take at least 2 hours in total to get it set up.

Installing the Cygwin packages and dependencies for DDRescue-GUI

Temporarily disabling antivirus software

As demonstrated in the early parts of the video, Cygwin is not popular with antivirus programs because of the way it works. As a result of this, it is necessary to temporarily disable your antivirus program when installing Cygwin, and then create an exception after the base packages have been installed.

Disabling your antivirus is usually simple. You can often click an icon in the system tray and use the menus, but if not, you may need to open the main window and look in the settings section. If in doubt, search online for instructions for your antivirus product.

NOTE: Make sure not to browse the internet with your antivirus disabled! As soon as the Cygwin installation steps have been completed, you should re-enable your antivirus and add an exception for Cygwin as is detailed later.

Downloading and installing the base Cygwin packages

Next, head to http://www.cygwin.org and download the Cygwin setup program. I used the 32-bit version, but the 64-bit version will work fine as well, as long as your system has 64-bit Windows installed. If in doubt, use the 32-bit version.

After downloading, simply click through the Cygwin installation wizard and click “Okay” where needed to install the base packages as shown in the video.

At this point, it’s a good idea to check that Cygwin is working – open the Cygwin Terminal and check that you get a command prompt.

Installing dependencies for DDRescue-GUI

Next, re-open the Cygwin installer, and find and select the following packages for installation using the search box:

ddrescue, python2-wx, python2-wxversion, python27-requests, wget, libnotify, xauth, xorg-server, xinit

Make sure not to install any versions of packages labelled “Test”. Installing these may take a while. If you need additional instruction, see the relevant part of the video which walks you through this.

Defining an exception for Cygwin in your antivirus program

This is likely to be a bit more complicated to do, but generally there’s an “exceptions” area in the settings where you can define files and folders to ignore. You want to head here, and add a exception for C:\Cygwin (or C:\Cygwin64, if you installed 64-bit Cygwin).

As before, if you’re not sure how to do this, your best bet is to find instructions for your specific antivirus program.

Installing DDRescue-GUI in Cygwin

Head to https://www.hamishmb.com/html/downloads.php?program_name=ddrescue-gui, or https://gitlab.com/hamishmb/ddrescue-gui/tree/initial-cygwin to download the Cygwin version of DDRescue-GUI. Once done, you should extract the folder using Windows Explorer, and then open a cygwin terminal as administrator by right clicking on it and choosing the “Run as Administrator” option from the menu. You may be prompted for authentication.

Once opened, you should run the following commands one line at a time to install DDRescue-GUI:

mkdir /usr/share/ddrescue-gui
cd /usr/share/ddrescue-gui
cp -rv /cygdrive/c/Users/<yourusername>/Downloads/ddrescue-gui-initial-cygwin/ddrescue-gui-initial-cygwin/* ./
cp -v images/Logo.png ../pixmaps/ddrescue-gui.png

If you need any more instruction, please watch the relevant part of the video, or drop me an email.

Running DDRescue-GUI

A final few commands are needed to start DDRescue-GUI each time you want to run it:

cd /usr/share/ddrescue-gui
startxwin &
DISPLAY=:0 python2 ./DDrescue_GUI.py

You may see a load of output from the startxwin command, but that is normal and can be ignored. To type the next command, you can press enter first. You may also see a taskbar icon for the XWin Server.

Once started, DDRescue-GUI looks and runs very much like how it does on Linux and macOS, with two exceptions:

  • Disk Information is not available.
  • You cannot yet mount output files using DDRescue-GUI.

Neither of these problems stops you from using the GUI, but you’ll just have to figure out which devices in “/dev/” correspond to the Windows drive letters. This can be done by plugging in the drive to recovery from while browsing /dev, and seeing which files are added. To mount output files you will have to use Windows’ built-in tools, or other third-party tools.

Summary

This has been a very extensive blog post, but I hope it has helped anyone who wants to run DDRescue-GUI on Windows, until I get a polished release with an installer out. That’s it for now, but stay tuned – the PXE booting series is due to be finished very soon!

Tagged , , , , . Bookmark the permalink.

About Hamish McIntyre-Bhatty

I'm currently studying for a Computing and IT degree with the Open University, and am a software developer as well. I enjoy coding in Python, C++ (still learning), and Java. Having written 4 open-source programs (hosted on launchpad.net), set up my own website, and started volunteering at Wimborne Model Town to work on their river control system, I still find the time to enjoy cycling, acting, photography, and playing bass guitar. I go climbing every now and then as well. As you may have guessed, I also enjoy blogging :)

5 Responses to Tutorial: Running DDRescue-GUI on Windows with Cygwin

  1. PR says:

    Hello, Hamish!
    Just wanted to thank you for taking the time to write/create/share this tutorial.
    I am sure it will help quite a few folks to test DDRescue-GUI under Windows.
    However, I may not be one of them… 🙂

    3 problems:

    First @
    cp -v images/Logo.png ../pximaps/ddrescue-gui.png
    Here I noticed there’s a tipo in “pximaps” (instead of pixmaps).

    Second @
    DISPLAY=:0 python2 ./DDrescue-GUI.py
    Another tipo. In my ddrescue-gui-initial-cygwin folder the file’s name is DDRescue_GUI.py (with underline not minus/hyphen).

    Now, after typing the command
    $ DISPLAY=:0 python2 ./DDrescue_GUI.py
    I can see the splash.png for less than a second, then it closes and this error appears:

    ** (DDrescue_GUI.py:1411): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
    SetupSysMenu: GetSystemMenu() failed for HWND 0x1d06e2
    DDRescue-GUI Version 2.0.2 Starting up…
    Traceback (most recent call last):
    File “./DDrescue_GUI.py”, line 290, in on_exit
    APP.SetTopWindow(main_frame)
    NameError: global name ‘APP’ is not defined
    SetupSysMenu: GetSystemMenu() failed for HWND 0x1e06e2

    Couldn’t figure this time what might cause this, but maybe you can. Who knows?! Maybe there are others facing this…
    Once again, thank you!

    • Hello,

      Thanks for pointing out the typos – I’ll fix them shortly. I’m glad you’ve been able to follow the rest of the tutorial and found it helpful though.

      Most of the warnings you see there are normal, but the APP one is one I’ve found only intermittently, but I thought it was fixed. What version of Windows are you using?

      I have a feeling it’s got something to do with Cygwin, so I may not be able to fix this, but I will try.

      Hamish

  2. PR says:

    Hey there! 🙂
    Appreciate the fast answer.
    I’m using Windows 10, version 1803 build 17134.885, but I would have bet it has nothing to do with the OS.
    I actually changed APP at line 290, as the error mentioned, with “MyApp” and “wx.App” and the errors are different, but —unfortunately— I’m not a programmer, I cant figure out how should APP be declared, nor if it does need to be changed at all. According to you it doesn’t… 🙂

    Maybe this helps you figure out:

    https://pastebin.com/mU84XkWY
    NameError: global name ‘APP’ is not defined
    SetupSysMenu: GetSystemMenu() failed for HWND 0xf049c
    with original DDrescue-GUI.py file

    https://pastebin.com/9CQYh1g0
    TypeError: unbound method SetTopWindow() must be called with App instance as first argument (got MainWindow instance instead)
    SetupSysMenu: GetSystemMenu() failed for HWND 0x25069c
    with DDrescue-GUI.py file changed at line 290

    I will also try to run it on a different computer, as this one got seriously damaged. 🙂

    Take care!
    Regards
    PR

    • Thanks for the detailed output – that will be invaluable for diagnosing this.

      I hope you have better luck on the other computer. I’ll let you know when I figure out why this is happening 🙂

      Hamish

    • I’ve found some time to have a look at this, but I can’t see what the problem might be unfortunately. I think it may be a bug in the version of wxPython provided by Cygwin. Did you have any luck with running this on your other system?

      One of my long-term goals has been to try and get a newer version of wxPython running in Cygwin, but I keep encountering new problems, so it unfortunately may be a while before I can fix this.

Leave a Reply

Your email address will not be published. Required fields are marked *