signalapp / Signal-iOS

A private messenger for iOS.
https://signal.org
GNU Affero General Public License v3.0
10.74k stars 3k forks source link

Data transfer from iPad to iPhone fails during QR-code scans #4558

Closed merkste closed 1 year ago

merkste commented 3 years ago

Bug description

The goal was to transfer the messages from an decoupled Signal on an iPad to a new installation on an iPhone. After scanning the QR code shown on the iPhone app, the app on the iPad asks me to scan a QR code with the phone. However, no QR code is shown and the process is stuck at this step (see screenshot).

Steps to reproduce

Actual result: Describe here what happens after you run the steps above (i.e. the buggy behaviour) I expect the transfer dialog to proceed in some way. Ideally as described on the support pages.

Expected result: Describe here what should happen after you run the steps above (i.e. what would be the correct behaviour) I am shown a message that asks me to scan a QR code using my iPhone (see attached screenshot in German)

Screenshots

IMG_0008 IMG_0009

Device info

Device: iPhone X and iPad 7. Gen

iOS version: 14 and 13.7

Signal version: 3.17.1

Link to debug log

After several attempts, my friend got frustrated and deleted the apps immediately. No chance to get a log.

mark-heffernan commented 3 years ago

Hi, I’m having the exact same issue on the following devices:

Device: iPhone 11 Pro & iPad Pro (11 inch) iOS: 14.0 & 14.0 Signal: 3.17.4 (both) and EN language

If you need a log let me know.

Thanks.

ChadMoran commented 3 years ago

Also seeing this issue.

Buddabrezn commented 3 years ago

Same problem!

iPad mini 4 ipadOS 14.0.1 Signal 3.19.1.2

iPhone 11 Pro iOS 14.0.1 Signal: latest Version

Thanks for a quick fix!

Buddabrezn commented 3 years ago

I changed the language setting of my iPhone and iPad to English and made a few screenshots:

iPhone 11 Pro: IMG_6165

iPad mini 4: IMG_2020

IMG_2022

As soon as the QR-Code is recognised by Signal on the iPad, it crashes. IMG_2023

whiskeykilo commented 3 years ago

Same issue transferring from iPhone X to iPhone SE, both iOS 14.1. Camera would not recognize the QR code

amwolff commented 3 years ago

I ran into the same issue. Here's what I did.

Preamble

I had Signal on my Android phone and a linked iPad. If you want to move this to the iPhone + iPad configuration, there's an extra step(s) involved.

  1. Deregister from the server on Android
  2. Your iPad becomes unlinked now
  3. Register on the iPhone
    1. For some reason, there's no pop-up to transfer data, and that's also the reason we're doing this
  4. Deregister from the iPhone
  5. Register on the iPhone again
  6. Pop-up appears
    1. Select the button to transfer your data
  7. QR code appears

If you want to transfer from an unlinked iPad to a new iPhone continuing from the 5th step should be enough.

Origin of the problem

If you look at that QR code, it's an URL:

sgnl://transfer?transferMode=primary&version=1&certificateHash=aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ&peerId=aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1FYXZUeWU5OWVaQQ

Notice the transferMode parameter.

When you scan this code with your iPad, this is the line of code that gets executed that starts parsing URL from the QR code:

https://github.com/signalapp/Signal-iOS/blob/f07d2887bd097fed2c712b39b10bb13f42592171/Signal/src/ViewControllers/Device%20Transfer/DeviceTransferQRScanningViewController.swift#L159

If you open this function, here are exciting lines:

https://github.com/signalapp/Signal-iOS/blob/f07d2887bd097fed2c712b39b10bb13f42592171/Signal/src/util/Device%20Transfer/DeviceTransferService%2BURL.swift#L60-L65

Key takeaways:

  1. currentMode is .linked because your unlinked iPad is a "linked" device
  2. rawMode is .primary because that's the value gathered from the URL
  3. There's a mismatch (obviously)
  4. modeMismatch error is thrown
    1. In that case, it's DEVICE_TRANSFER_ERROR_MODE_MISMATCH_LINKED, and that translates to known To transfer your account, you must scan with your iPhone

Hacking the process

Since this probably demolish this process's security, I should probably state that you continue at your own risk for the steps below.

  1. Scan the QR code with another (trusted) device
    1. You can also decode the QR code by hand
  2. Write down the QR code modifying transferMode to linked
  3. Encode modified URL to QR code ([0])
  4. Scan the generated QR code with the iPad
  5. Data transfer should begin

After the transfer is completed, the two devices will both be in unlinked mode. However, after closing the Signal app on both machines, Signal will reset and throw an introductory wizard. On an iPhone chose the option not to transfer any data. The data is already here, and after registering on the server, you will have access to everything from the iPad here (and a working Signal).


[0] For example, you can write down the URL on a piece of paper, generate the QR code in a terminal (as shown below), scan the code and burn the paper piece.

image

rmarescu commented 3 years ago

Thanks @amwolff for the investigation and write-up! I was able to transfer from Android to iPhone via iPad. Tiny suggestion on step 2 to explicitly mention what needs to be changed

Write down the QR code modifying transferMode's value from primary to linked

PseudoC0de commented 3 years ago

Having the same issue.

Old Device: iPad Pro 12.9 2nd gen - iOS14.6 New Device: iPhone SE 2020 - iOS14.6 Signal: 5.15.1 (both) and EN language

Is anyone working on this? It seems like @amwolff already pinpointed the problem, but it's been almost 6 months since then.

casematrix commented 3 years ago

This nonsense makes it much more difficult to talk other people into installing Signal.

When is this whole issue going to be addressed? I just did a reset on my iPhone, and I'm currently screwed out of all of my message history. The security is absolutely vital, but there are solutions for the problem, including the simplest which is to just let the user specify a password for encrypting the message store using AES and storing that blob in iCloud backups if the user chooses to, or in PC backups.

jain-m commented 3 years ago

I get the same error

jakeharvey commented 2 years ago

I just encountered this, I guess it’s still going to be a thing going into 2022.

chrisl8 commented 2 years ago

The instructions here: https://support.signal.org/hc/en-us/articles/360007059752-Backup-and-Restore-Messages#ios_restore say that you can transfer: iPhone → Unlinked iPad

However, this is not true, due to this issue.

I was able to do the transfer thanks to the instructions from @amwolff I was able to screen shot the QR code on my iPad, crop it and save it. I used zbarimg at the Ubuntu Linux command line to read the URL out of the QR Code image. I then used simplecodegenerator from nirsoft to generate a new code after changing the word linked to primary in the URL.

It is important to note that the iPad generates a new code every time you start the process, so you need to screen shot the QR code and then don't restart signal.

All of this to say that either this should be fixed or the instructions at https://support.signal.org/hc/en-us/articles/360007059752-Backup-and-Restore-Messages#ios_restore should be changed to indicate that an iPhone to iPad transfer is not actually possible.

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

jain-m commented 2 years ago

Thank you for reaching out, it is still relevant. I would still like to recover messages from the lost device. I would like to have access to all my messages with the phone number 650-224-1969 (irrespective of which phone device it was sent or received from).

On Mon, Feb 14, 2022 at 8:26 AM stale[bot] @.***> wrote:

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

— Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-iOS/issues/4558#issuecomment-1039274521, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXPZIXYNZUOYCSDLUXEFT3U3ES5ZANCNFSM4RO6VMAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

petekirwan commented 2 years ago

Just experienced the same. really dissapointing how old this bug is.

benjamin-hg commented 2 years ago

Just lost all my conversations on my iPhone because I guessed that a "complete" iPhone backup (as iTunes calles it) would include well ... everything. Finding myself on the signal setup screen, I foud that I have an iPad lying around with all my converastions still there. After the transfer pop-up showed up on the iPad, I was very happy at first -- but than ran into this very issue. 😞 I hope more users will add their comments here and react with 👍 on the bug report to give it more visiblity.

To help find this online: The German Signal app error message: "Zum Übertragen deines Kontos musst du diesen QR-Code mit deinem iPhone einscannen" The Spanish Signal app error message: "Para transferir tu cuenta, debes escanear el código QR con tu iPhone." The French Signal app error message: "Afin de transférer votre compte, vous devez lire le code avec votre iPhone"; The Englisch Signal app error message: "To transfer your account, you must scan with your iPhone"; The Chinese Signal app error message: "要迁移你的账户,你必须用你的iPhone 扫描二维码"

kdambekalns commented 2 years ago

I am seeing this on a "linked iPad", and still don't get why that doesn't work. My iPad still receives all messages and I can send messages, too. It is obviously completely able to communicate without my iPhone being registsred (erased it for battery service.)

So, if it has access to my account and can send/receive messages, what is missing to be able to restore my account on my iPhone?

I can't wrap my head around the lack of that "backup" feature on iOS. Telegram has it, Threema has, Signal on Android has it - and on iOS it's impossible? Hard to believe…

Oh, and frankly – locking https://github.com/signalapp/Signal-iOS/issues/2542 because "we don't discuss on GitHub" seems lame… that is open for almost 5 years now…

fhihu commented 2 years ago

Hello I tried the guide above. Transfer from unlinked IPad to an newly set up iPhone. However I get now the message on the sending iPad "Please update Signal and try again".

What has to be in the new generated QR Code?

I Replaced

sgnl://transfer?transferMode=primary&certificateHash=suidfsaudhfsjadhfsjkafksldnfklasnflksdnfkjlasdnfaskdlfnaskjlnfsduhfausdhfuzas

with

sgnl://transfer?transferMode=linked&certificateHash=suidfsaudhfsjadhfsjkafksldnfklasnflksdnfkjlasdnfaskdlfnaskjlnfsduhfausdhfuzas

I get the message "Please update Signal and try again"

When I add in the "&peerId=value" into the qr code creation, it doesn't recognized the Qr Code?

What do I wrong or do I really have to update Signal. The iPad is very old (iPad Air first generation).

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Kikkererwt commented 2 years ago

Same problem here, highly disappointed.

MarkusHaberstock commented 1 year ago

Just experienced the same. really dissapointing how old this bug is.

Well, according to Signal support, it's not a bug, but a feature, because this way your conversations are secured - at least from third party misuse. But the fact that you also want to protect data from loss has somehow not yet reached the decision-makers.

florianlabu commented 1 year ago

36A239D4-7B04-4D16-9DE5-8FB5DA074380 Did Signal block this hack? When I follow these steps, it hangs instead of beginning to transfer the data. ![Uploading 54B6CCD4-C572-41BD-BD41-3E9C12D9146D.jpeg…]()

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

b-col commented 1 year ago

Not stale.

eliykat commented 1 year ago

This is still a problem. Maybe the biggest issue is the lack of any warning in the UI - if I can transfer my data from my iPhone to my iPad, why wouldn't I be able to transfer it back? In my situation, I had to send my iPhone away for repairs, so I transferred everything to my iPad and did a factory reset. When my phone came back, I couldn't restore my messages. If this behaviour isn't going to change, there should at least be a warning about this limitation when linking a new device.

Thankfully, the workaround described above still works. Here's how I did it:

  1. Took a screenshot of the QR code on my iPad
  2. Opened the screenshot on my MacBook
  3. Used zbar (brew install zbar) to extract the QR code: zbar screenshot.png
  4. Copied the URL and changed transferMode=primary to transferMode=linked
  5. Used qrencode (brew install qrencode) to generate a new QR code: qrencode -o qrcode.png "sgnl://<new URL here>"
  6. Opened the new QR code image and scanned it with my iPad

Reminder to make sure Bluetooth is turned on and to do it reasonably quickly so the process doesn't time out.

Miguel-Signal commented 1 year ago

A chat history transfer only takes place between the primary device (old phone) and its replacement (new phone). Cross-platform chat history transfer (specifically any combination between Desktop <-> iPad <-> iPhone <-> Android) is not currently supported.

However, we know it's an often suggested feature, so I'll make sure to bring this request to our Product Team's attention.

chrisl8 commented 1 year ago

I want to reiterate that the instructions here: https://support.signal.org/hc/en-us/articles/360007059752-Backup-and-Restore-Messages#ios_restore say that you can transfer: iPhone → Unlinked iPad

However, this is not true, due to this issue.

You should at least use this issue to remove that unsupported option from the instructions if you are not going to fix the issue to make it work.

Thank you.

tofuwarrior commented 1 year ago

Profuse thanks @amwolff for the detailed solution. No way i could have worked that out! I had same problem of unable to transfer from ipad to iphone (which had been security reset from forgetting passcode) I used an online qrdecoder to get the url, edited it in notepad. Used "QR-Code Studio" on windows to generate the code.

Also had problem where it hung on 99% complete when transferring data To avoid this.... Make sure signal is up to date on both devices and also keep trying. Several people in the thread below had a problem with it hanging on 99%. They found that retrying worked on 2nd or 3rd go. https://www.reddit.com/r/signal/comments/xgcza3/transfer_of_data_to_new_iphone_stops_at_99_and_0/

def3nc3r commented 1 year ago

Tried transferring from my iPad to my newly set up iPhone with these steps, but I have the same issue where it hangs forever at "establishing connection" Tried many times, reinstalled Signal and restarted both devices multiple times. Also left both screens on for hours, but no luck...

Any ideas?

ryanpcmcquen commented 1 year ago

Still an issue.

b-col commented 1 year ago

Still an issue!

Blatzheim commented 11 months ago

Stil an issue!

NetworkTest commented 11 months ago

Still an issue.

eliykat’s brew steps all work, but the result is an error saying to install the latest version of Signal even though I’m already there on both devices.

Miguel-Signal commented 11 months ago

@NetworkTest Could you please update Signal on both devices to v6.45 and send us debug logs from both devices if the issue still persists?

To share a debug log from Signal iOS, tap your profile, Settings, Help, Submit Debug Log, Copy Link.

ludwigschubert commented 11 months ago

@Miguel-Signal Thanks for looking into this! I ran into this issue yesterday, with no request to update to the lastest versions of Signal. I believe no debug logs should really be needed to work on this, as @amwolff 's excellent in-depth investigation and write-up of what's happening in the code and @eliykat 's workaround seem to me sufficient to both fully reproduce and work around this issue. If I link my debug log from the iPhone I restored the message history from the iPad to, I believe we'll (only?) see the successful transfer from after I changed the iPad's QR code to contain the transferMode=linked query parameter. (I admit I can't now prove that the iPad was at 6.45.0, too!)

Sorry for my tangible frustration. Our message history is important user data. If there's no way to make a backup ("Storing messages outside of your active Signal device is not supported.") then all these device-to-device transfer code paths need to be thoroughly robust & tested. There should also be support for transferring from desktop instances of Signal. I know it's neither good form nor particularly helpful to complain at developers directly, but shit like this brings the movement down. ("This nonsense makes it much more difficult to talk other people into installing Signal." — @casematrix)

merkste commented 11 months ago

Thanks for keeping that thread alive. I do have a related "issue" and hope some of you can help me.

I will likely move from Android to iOS soon. Currently, Signal is installed on Android with both desktop and iPad instances linked. As far as I understand, there is no supported way to move between the two OS. But I wonder whether I can at least preserve the messages on my linked instances, if not transferring them to iOS. Support did not answer me yet, except for a link to the installation page of Signal.

GrantNagel commented 9 months ago

Still an issue. I'm currently logged in to my original account on iPad with all my messages etc except there is no way for me to now backup this data or share this account with my new phone. I didn't see the official transfer process instructions. Seems absurd that i can be logged in to the original account on iPad and yet not be trusted to share it to my iPhone?

gamer191 commented 9 months ago

I used @amwolff's workaround, but now I can't re-link my iPad, because there's no "linked devices" option in my iPhone's Signal settings. Has anyone else had this issue?

tofuwarrior commented 9 months ago

Yes, changing the code means my signal app on the phone thinks it is on the iPad, not the iPhone and so isn’t authorised to link to other devices. It’s pretty poor that this issue persists for so long. On 29 Nov 2023 at 09:44 +0000, gamer191 @.***>, wrote:

I used @amwolff's workaround, but now I can't re-link my iPad, because there's no "linked devices" option in my iPhone's Signal settings. Has anyone else had this issue? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

gamer191 commented 9 months ago

Why doesn't transferring data from my iPad to another device keep the data on my iPad?

When I have a chance I'll jailbreak my iPhone and see if I can modify the Signal app to make it think that it's an iPhone (which it is). Or perhaps I'll jailbreak my iPad and see if I can make it a primary device

If I achieve anything (which I probably won't) then I'll send the workaround here

kankanen24 commented 8 months ago

Still having this problem in January 2024.

I upgraded my iPhone and traded in the old one when I picked up the new one. I’m trying to set Signal up on the new phone with my iPad that has my message history but the iPad throws the “To transfer your account, you must scan with your iPhone” error.

nilssolanki commented 7 months ago

Still an issue end of January 2024. Have exactly the same problem as kankanen24.

Miguel-Signal commented 7 months ago

This is the intended behavior. Transfers from a linked iPad -> iPhone are not supported.

Only transfers from an iPad as a separate device -> iPhone are supported. This is when you have an iPad with a SIM card/phone number and used that number to register for the account on the iPad. This is the only scenario in which a transfer from iPad -> iPhone can happen. Screenshot 2024-02-01 at 2 24 14 PM

tofuwarrior commented 7 months ago

So when you have your ipad signal setup which reflects your iphone and then you lose your phone there is no way to get the messages off your ipad onto your new phone? What is the rationale behind that?

On Thu, 1 Feb 2024 at 19:27, Miguel-Signal @.***> wrote:

This is the intended behavior. Transfers from a linked iPad -> iPhone are not supported.

Only transfers from an iPad as a separate device -> iPhone are supported. This is when you have an iPad with a SIM card/phone number and used that number to register for the account on the iPad. This is the only scenario in which a transfer from iPad -> iPhone can happen. Screenshot.2024-02-01.at.2.24.14.PM.png (view on web) https://github.com/signalapp/Signal-iOS/assets/96307097/3f0d28ad-36c7-431e-b1be-2cc5f85381ba

— Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-iOS/issues/4558#issuecomment-1922072808, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMWR5DUOUNSIQQZPEWY6DYRPUD3AVCNFSM4RO6VMA2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJSGIYDOMRYGA4A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Paul Burdon

Projects Director, Clear Intent

@.*** www.clearintent.co.uk +44(0)2920 140 028

Lao Tzu House, 39 Deri Rd, Cardiff, CF23 5AH United Kingdom

chrisl8 commented 7 months ago

The instructions seem to have been updated a little here https://support.signal.org/hc/en-us/articles/360007059752-Backup-and-Restore-Messages#ios_linked_ipad

But it is still confusing. The instructions there never mention a SIM card or phone number in relation to the iPad, in fact they don't say what "separate device" means at all, although after following a lot of links I seem to have gotten to a page that talks about it: https://support.signal.org/hc/en-us/articles/360008216551-Installing-Signal#install_ios

What makes this all strange is that you can transfer your account to an iPad, wipe the phone, and then transfer everything back, it just takes a bunch of shenanigans with the QR code, as documented above, which makes us wonder why Signal cannot just display a working QR code to begin with?

Perhaps in 2024, that latest link does work better? I haven't actually tried this in years now and won't try it again so I should probably unsubscribe from this issue and let you all struggle on.

jimmyhsu commented 7 months ago

Was working until some recent updates, moved it about a month ago and now it has a new error of "The transfer couldn’t complete, please ensure your devices are near each other and try again" almost instantly after scanning the code.

iPad Air 4th gen -> iPad Mini 6th gen, signal 6.59.0.23 on both

paugre commented 5 months ago

Was working until some recent updates, moved it about a month ago and now it has a new error of "The transfer couldn’t complete, please ensure your devices are near each other and try again" almost instantly after scanning the code.

iPad Air 4th gen -> iPad Mini 6th gen, signal 6.59.0.23 on both

For me this was resolved by making sure the QR code was not closed on the iPhone while completing all the other steps and until I had scanned the modified QR code with the iPad and initiated the actual transfer. My assumption is that Signal generates a new identifier whenever you initiate the "Transfer from iOS device"-feature and therefore does no longer respond to the "old" modified QR code created previously.