Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRDudeDownloader's extractTarBz2File is incorrect on latest Ubuntu LTS #759

Open
fenollp opened this issue Nov 13, 2024 · 0 comments
Open
Labels

Comments

@fenollp
Copy link

fenollp commented Nov 13, 2024

Steps to make the bug happen

  1. Firmware Update (dialog)
  2. Port set to /dev/ttyACM0
  3. Clicking "Huge"
  4. See error

What was supposed to happen
Firmware upgrade should work.

I managed to work around the problem and this issue should describe how.

Platform (please complete the following information):

  • Version: 7.59.1 7621147 (installed via deb, compiled by forking repo + getting CI to generate artefact)
  • OS: Ubuntu 24.04.1 LTS
  • Robot model (if any): Makelangelo 5 huge

Log file

00:09:56.911 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploaderPanel - maybe downloading avrdude...
00:09:57.045 [AWT-EventQueue-0] INFO  c.m.m.f.AVRDudeDownloader - download from: http://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i686-pc-linux-gnu.tar.bz2
00:09:57.045 [AWT-EventQueue-0] INFO  c.m.m.f.AVRDudeDownloader - temp file: /tmp/download351843625700052922.bz2
00:09:57.213 [AWT-EventQueue-0] INFO  c.m.m.f.AVRDudeDownloader - Extracting tar.bz2 file
00:09:57.464 [AWT-EventQueue-0] INFO  c.m.m.f.AVRDudeDownloader - new path: /home/pete/.makelangelo/avrdude-6.0.1
00:09:57.464 [AWT-EventQueue-0] INFO  c.m.m.f.AVRDudeDownloader - trying path: /home/pete/.makelangelo/avrdude-6.0.1/avrdude
00:09:57.464 [AWT-EventQueue-0] INFO  c.m.m.f.AVRDudeDownloader - trying path: /home/pete/.makelangelo/avrdude-6.0.1/bin/avrdude
00:09:57.464 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploader - setting install path to /home/pete/.makelangelo/avrdude-6.0.1
00:09:57.464 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploaderPanel - maybe downloading firmware...
00:09:57.925 [AWT-EventQueue-0] INFO  c.m.m.f.FirmwareDownloader - Latest Release: 2023-11-03-01
00:09:58.563 [AWT-EventQueue-0] INFO  c.m.m.f.FirmwareDownloader - file downloaded ok.
00:09:58.563 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploaderPanel - finding avrdude file...
00:09:58.563 [AWT-EventQueue-0] INFO  c.m.m.f.FirmwareUploader - Searching for avrdude starting in /home/pete/.makelangelo/avrdude-6.0.1
00:09:58.564 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploaderPanel - finding conf file...
00:09:58.564 [AWT-EventQueue-0] INFO  c.m.m.f.FirmwareUploader - Searching for avrdude.conf starting in /home/pete/.makelangelo/avrdude-6.0.1
00:09:58.564 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploaderPanel - setup...
00:09:58.565 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploader - uploading firmware...
00:09:58.565 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploader - running command: /home/pete/.makelangelo/avrdude-6.0.1/bin/avrdude -C/home/pete/.makelangelo/avrdude-6.0.1/etc/avrdude.conf -v -V -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/home/pete/.makelangelo/firmware-huge.hex:i
00:09:58.569 [AWT-EventQueue-0] DEBUG c.m.m.f.FirmwareUploader - update finished
00:09:58.569 [AWT-EventQueue-0] ERROR c.m.m.f.FirmwareUploaderPanel - upload failed.

Additional context
I encountered a few issues:

First: extracting tar.bz2 drops chmod and symlinks

AVRDudeDownloader on my distro ended up with unusable files:

  • unexecutable avrdude_bin
  • some files were empty
     .makelangelo λ t avrdude-6.0.1
[4.0K]  avrdude-6.0.1/
├── [4.0K]  bin/
│   ├── [ 108]  avrdude*
│   ├── [368K]  avrdude_bin*
│   └── [1.3K]  libusb-config*
├── [4.0K]  etc/
│   └── [453K]  avrdude.conf
├── [4.0K]  include/
│   ├── [4.0K]  libusb-1.0/
│   │   └── [ 67K]  libusb.h
│   └── [8.6K]  usb.h
└── [4.0K]  lib/
    ├── [  19]  libusb-0.1.so.4 -> libusb-0.1.so.4.4.4*
    ├── [   0]  libusb-0.1.so.4.4.4*
    ├── [116K]  libusb-1.0.a
    ├── [1017]  libusb-1.0.la*
    ├── [  19]  libusb-1.0.so -> libusb-1.0.so.0.1.0*
    ├── [  19]  libusb-1.0.so.0 -> libusb-1.0.so.0.1.0*
    ├── [102K]  libusb-1.0.so.0.1.0*
    ├── [ 15K]  libusb.a
    ├── [1.1K]  libusb.la*
    ├── [  19]  libusb.so -> libusb-0.1.so.4.4.4*
    └── [4.0K]  pkgconfig/
        ├── [ 386]  libusb-1.0.pc
        └── [ 363]  libusb.pc

7 directories, 18 files

My fix:

cd ~/.makelangelo
we http://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i686-pc-linux-gnu.tar.bz2
rm -rf avrdude-6.0.1
tar --dereference --extract --file avrdude-6.0.1-arduino2-i686-pc-linux-gnu.tar.bz2

Note --dereference to follow symlinks. This ends up with usable files:

  2s .makelangelo λ t avrdude-6.0.1
[4.0K]  avrdude-6.0.1/
├── [4.0K]  bin/
│   ├── [ 108]  avrdude*
│   ├── [368K]  avrdude_bin*
│   └── [1.3K]  libusb-config*
├── [4.0K]  etc/
│   └── [453K]  avrdude.conf
├── [4.0K]  include/
│   ├── [4.0K]  libusb-1.0/
│   │   └── [ 67K]  libusb.h
│   └── [8.6K]  usb.h
└── [4.0K]  lib/
    ├── [  19]  libusb-0.1.so.4 -> libusb-0.1.so.4.4.4*
    ├── [ 22K]  libusb-0.1.so.4.4.4*
    ├── [116K]  libusb-1.0.a
    ├── [1017]  libusb-1.0.la*
    ├── [  19]  libusb-1.0.so -> libusb-1.0.so.0.1.0*
    ├── [  19]  libusb-1.0.so.0 -> libusb-1.0.so.0.1.0*
    ├── [102K]  libusb-1.0.so.0.1.0*
    ├── [ 15K]  libusb.a
    ├── [1.1K]  libusb.la*
    ├── [  19]  libusb.so -> libusb-0.1.so.4.4.4*
    └── [4.0K]  pkgconfig/
        ├── [ 386]  libusb-1.0.pc
        └── [ 363]  libusb.pc

7 directories, 18 files

Second: missing libtinfo5 (32bit)

     .makelangelo λ /home/pete/.makelangelo/avrdude-6.0.1/bin/avrdude -C/home/pete/.makelangelo/avrdude-6.0.1/etc/avrdude.conf -v -V -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/home/pete/.makelangelo/firmware-huge.hex:i
/home/pete/.makelangelo/avrdude-6.0.1/bin/avrdude: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

Turns out it's replaced by libtinfo6 on latest Ubuntu LTS. I found debs at https://www.ubuntuupdates.org/package/core/focal/universe/updates/libtinfo5
I initially installed the 64bit version but avrdude is a 32bit executable. Maybe it's possible to switch to an amd64 version? I didn't look.

Fix:

we http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.2-0ubuntu2.1_i386.deb
sudo dpkg -i libtinfo5_6.2-0ubuntu2.1_i386.deb
sudo apt --fix-broken install # Add missing 32bit packages (libc, ...)
sudo dpkg -i libtinfo5_6.2-0ubuntu2.1_i386.deb
ln -s /usr/lib/i386-linux-gnu/libtinfo.so.5 avrdude-6.0.1/lib/libtinfo.so.5 # Simplest way to add our installed lib to $LD_LIBRARY_PATH
  25s .makelangelo λ l avrdude-6.0.1/lib/libtinfo.so.5
lrwxrwxrwx 1 pete pete 37 Nov 13 00:31 avrdude-6.0.1/lib/libtinfo.so.5 -> /usr/lib/i386-linux-gnu/libtinfo.so.5

Lastly: executable requires sudo rights

Running the avrdude command I had this error:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied

Also, in the middle of this I had deleted the hex file so repeated the whole process just to hopefully re-generate it. It seems to have worked OK.

     .makelangelo λ sha256sum firmware-huge.hex 
a75bc6122f404b6dbab4238d133d5f96b8ce5e0c83f987389488488e387c46da  firmware-huge.hex

Finally:

  2s .makelangelo λ sudo /home/pete/.makelangelo/avrdude-6.0.1/bin/avrdude -C/home/pete/.makelangelo/avrdude-6.0.1/etc/avrdude.conf -v -V -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/home/pete/.makelangelo/firmware-huge.hex:i

avrdude: Version 6.0.1, compiled on Mar 19 2015 at 11:53:10
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/home/pete/.makelangelo/avrdude-6.0.1/etc/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Wiring
         Description     : Wiring
         Programmer Model: AVRISP
         Hardware Version: 15
         Firmware Version Master : 2.10
         Vtarget         : 0.0 V
         SCK period      : 173.7 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as FF
avrdude: reading input file "/home/pete/.makelangelo/firmware-huge.hex"
avrdude: writing flash (96406 bytes):

Writing | ################################################## | 100% 15.44s

avrdude: 96406 bytes of flash written

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (H:FF, E:D8, L:FF)

avrdude done.  Thank you.

  19s .makelangelo λ 

Then I had to init or reload EEPROM and the Configuration screen showed the huge minX/minY numbers mentioned at the end of https://mcr.dozuki.com/Guide/2.+Makelangelo+5+to+HUGE+upgrade/41?lang=en


Now I have no idea how to patch this Java repo, plus I used many of my Bash aliases here hoping you'll infer their meaning.
So I guess that's the best help I can be for this to get fixed or for others to work around this issue...

I hope this helps!

@fenollp fenollp added the bug label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant