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

ValueError: too many values to unpack #199

Closed
viral32111 opened this issue Oct 13, 2022 · 6 comments
Closed

ValueError: too many values to unpack #199

viral32111 opened this issue Oct 13, 2022 · 6 comments

Comments

@viral32111
Copy link

Hey, I am getting the following error after attempting to run sudo apt-offline get --bundle bundle.zip apt-offline.sig on the online system:

Fetching APT Data

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineCoreLib.py", line 864, in stripper
    url, localFile, size, checksum = item.split(' ')
ValueError: too many values to unpack (expected 4)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/apt-offline", line 28, in <module>
    main()
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineCoreLib.py", line 2503, in main
    args.func(args)
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineCoreLib.py", line 1253, in fetcher
    (ItemURL, ItemFile, ItemSize, ItemChecksum) = stripper(item)
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineCoreLib.py", line 868, in stripper
    url, localFile, size = item.split(' ')
ValueError: too many values to unpack (expected 3)

The apt-offline.sig was generated on the offline system using sudo apt-offline set --upgrade apt-offline.sig.

I'm running Ubuntu 22.04.1 on both systems, and using version 1.8.5 of this package.

@jwmynhier
Copy link

jwmynhier commented Oct 14, 2022

This appears to be caused by this Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1992026

I was able to work around it by following the recommendation to remove /etc/apt/apt.conf.d/20apt-esm-hook.conf on my offline machine.

@viral32111
Copy link
Author

That seems to be right as I've just inspected the contents of the apt-offline.sig file and it indeed contains a message about Ubuntu Pro:

Try Ubuntu Pro beta with a free personal subscription on up to 5 machines.
Learn more at https://ubuntu.com/pro

Removing that file does indeed stop this message from being written to the file, thanks!

@kyp44
Copy link

kyp44 commented Oct 27, 2022

Fixed this and created a pull request.

@rickysarraf
Copy link
Owner

@kyp44 I see that you closed the PR. Is this still a valid issue ? Otherwise, please close this issue.

We did have another similar issue originating from Ubuntu, where the apt output was appended with extra text garbage. I believe that was fixed in one of the previous releases.

rickysarraf added a commit that referenced this issue Mar 2, 2023
Because the signature file is generated by apt. And depending of the
distribution, it could have some extra changes added in it. Like in this
linked github issue report.

Nevertheless, given that the apt output is not in a declared machine
readable format, nor is it officially recommended to parse the output;
instead let us make apt-offline put more checks in place when parsing
its input.

Closes: #199
@kyp44
Copy link

kyp44 commented Mar 2, 2023

I believe this was actually fixed in apt itself, in that they no longer print the offending message when you run it in silent mode like apt-offline does. Like somebody on that development realized, "hey we definitely shouldn't print this message if we're in silent mode".

@rickysarraf
Copy link
Owner

I believe this was actually fixed in apt itself, in that they no longer print the offending message when you run it in silent mode like apt-offline does. Like somebody on that development realized, "hey we definitely shouldn't print this message if we're in silent mode".

Thanks. I still adapted your proposed change because we needed more checks in place for the generated signature file; given that apt-offline caters to many Debian derivatives too.

Similar breakages in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants