Troubleshooting the “Invalid Dial Command” Error with Huawei E3372 and wvdial on Debian

At revWhiteShadow, we understand the frustration that arises when essential connectivity tools fail to perform as expected. You’re seeking to establish a stable internet connection using your HUAWEI E3372 modem on a Debian system, and encountering the perplexing “Invalid dial command” error within wvdial, accompanied by an assertion failure. This is a common hurdle for users migrating from Windows to Linux environments, where modem configurations and system interactions can differ significantly. While your ultimate goal is a working internet connection, and indeed you’ve found a way to achieve this by addressing a resolv.conf symlink issue, the persistent error message is bothersome and indicates an underlying configuration or interaction problem that warrants a thorough investigation. We are committed to providing a comprehensive guide to help you not only achieve a stable connection but also to resolve this specific error, ensuring your Debian setup is as robust and clean as possible.

Understanding the HUAWEI E3372 and its Interaction with Debian

The HUAWEI E3372 is a widely used USB LTE dongle that offers excellent mobile broadband capabilities. Its functionality on operating systems like Windows is often managed by proprietary drivers and user-friendly software. When transitioning to Linux, particularly Debian, the approach to managing such hardware shifts. Linux relies on the kernel’s built-in drivers and standard utilities like wvdial for establishing dial-up and mobile broadband connections.

The core of the issue often lies in how the modem presents itself to the system and how wvdial interprets these presentations. Your provided lsusb output clearly identifies the device: Bus 002 Device 002: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard. This is a crucial piece of information, as the vendor and product IDs (12d1:1506) help us identify known behaviors and potential compatibility issues.

The dmesg | grep tty output is equally illuminating:

[    4.288912] usb 2-8: GSM modem (1-port) converter now attached to ttyUSB0
[    4.288990] usb 2-8: GSM modem (1-port) converter now attached to ttyUSB1

This indicates that your HUAWEI E3372 is recognized by the system and has been assigned serial port devices (/dev/ttyUSB0, /dev/ttyUSB1). Modems typically expose multiple serial ports for different functions, such as AT command interpretation, network data, and diagnostics. The wvdial configuration specifically targets one of these, /dev/ttyUSB1 in your case, for sending AT commands.

The error message ATDT*99# --> ERROR --> Invalid dial command. directly points to an issue with the ATDT*99# command. This command is a standard way to initiate a dial-up connection with many GSM modems. The *99# string is a special dialing prefix that instructs the modem to use its Packet Data (CSD or GPRS/LTE) service. The “Invalid dial command” suggests that either the modem is not correctly interpreting this specific command sequence in the context it’s being sent, or wvdial is not communicating with the modem via the expected serial port interface at that moment.

The assertion failure wvdial: utils/wvtask.cc:303: static int WvTaskMan::yield(int): Assertion *current_task->stack_magic == WVTASK_MAGIC’ failed. Abortedis a more internalwvdialerror. This typically means thatwvdial's internal task management system has encountered an unexpected state or corruption. It can be a consequence of the modem's faulty response or a misconfiguration that throws wvdial`’s state machine off.

Deep Dive into wvdial Configuration for HUAWEI E3372

Your provided wvdial.conf is a good starting point:

[Dialer orange]
Modem = /dev/ttyUSB1
Phone = *99#
Username =;
Password =;
Init1 = ATZ
Init2 = AT+CGDCONT=1,"IP","internet","",0,0
Auto DNS = on

Let’s break down each line and explore potential refinements and alternative approaches to optimize for your HUAWEI E3372.

1. Modem Device Identification: /dev/ttyUSB1

Your dmesg output shows that /dev/ttyUSB1 is indeed assigned. However, some modems can present multiple TTY devices, and the specific one used for AT commands can vary. While /dev/ttyUSB1 is a common choice, it’s worth confirming.

Troubleshooting Modem Device Assignment

  • Multiple ttyUSB Ports: Your HUAWEI E3372 likely exposes several ttyUSB ports, each potentially serving a different function (e.g., AT commands, NMEA data, MBIM interface). The modem might switch modes, or different ports might be designated for specific operations.
  • Using ls /dev/ttyUSB*: After plugging in the modem, list all /dev/ttyUSB* devices. Observe which ones appear.
  • Testing Different TTY Ports: If /dev/ttyUSB1 continues to cause issues, consider testing /dev/ttyUSB0, /dev/ttyUSB2, or any other that appears.
  • The usb-modeswitch Factor: Many USB modems, especially Huawei devices, utilize a mechanism called usb-modeswitch. This utility switches the device from a default USB mass storage mode (which presents a virtual CD-ROM with drivers for Windows) to a modem mode, exposing the serial ports. Debian typically handles this automatically, but an incorrect mode switch or a failure in this process can lead to unexpected serial port behavior or no serial ports appearing at all. If you suspect usb-modeswitch issues, ensure it’s installed (sudo apt install usb-modeswitch) and that its rules are correctly configured for your modem.

2. The Phone Number: *99#

*99# is a widely accepted command for initiating a packet data connection. However, some modems respond better to variations.

Alternative Phone Settings

  • *99***1#: This is another common variant, particularly for GPRS connections. The ***1 part often specifies the context or access point name (APN) implicitly.
  • *998683#: Some modems use specific service access points. You might find this in your modem’s documentation or by searching online for your specific E3372 model and Debian.
  • Direct APN Dialing: In some cases, you might be able to dial a command that directly specifies the APN, bypassing the need for *99#. This is less common with wvdial’s standard Phone setting.

3. Essential Initialization Commands: Init1 and Init2

Your Init1 and Init2 commands are crucial for preparing the modem.

Init1 = ATZ

  • Purpose: ATZ is the standard command to reset the modem to its default configuration. This is generally a good first step to ensure the modem is in a known state.
  • Potential Issues: If the modem doesn’t respond with “OK” to ATZ, it indicates a problem with serial port communication or that the modem isn’t in the correct mode.

Init2 = AT+CGDCONT=1,"IP","internet","",0,0

  • Purpose: AT+CGDCONT is used to define a packet data protocol (PDP) context. This command tells the modem which APN to use for the internet connection.
    • 1: Context identifier.
    • "IP": Packet data protocol type (e.g., IP, PPP).
    • "internet": The Access Point Name (APN). You mentioned your carrier is “orange”. If “orange” is the actual APN, you should use "orange" here. If “internet” is a generic APN provided by Orange for general internet access, then your current setting might be correct, but it’s worth verifying.
    • "": Optional APN configuration (usually left empty if not needed).
    • 0,0: Optional parameters for authentication (username, password) and packet data protocol configuration.

Refining Init2 and APN Configuration

  • Verifying the APN: The most critical aspect of Init2 is the APN. It is highly probable that "internet" is not the correct APN for your Orange SIM card. You need to find the correct APN for your mobile carrier. For Orange, common APNs are often orange or internet. Crucially, confirm the exact APN provided by Orange for your specific mobile plan. You can usually find this on their website, by contacting their support, or by checking the settings when the modem worked on Windows.
    • If your APN is orange, change Init2 to:
      Init2 = AT+CGDCONT=1,"IP","orange","",0,0
      
  • Order of Initialization: Sometimes, the order of initialization commands matters. ATZ is usually safe first. If you encounter issues, you could try placing AT+CGDCONT before ATZ, though this is less conventional.
  • Additional Initialization Commands: Some modems require other AT commands to enable specific features or modes. You might need to add commands like:
    • AT+CPIN?: To check SIM card status.
    • AT+CSQ: To check signal quality.
    • AT+CREG?: To check network registration status.
    • AT+COPS?: To check the current network operator.

A More Comprehensive wvdial.conf Example

Consider this more robust configuration. Remember to replace orange with the correct APN if it differs.

[Dialer orange]
Modem Type = huawei
Init1 = ATZ
# If ATZ doesn't work, try Init1 = ATE0V1 to enable echoing and verbose responses
# Init1 = ATE0V1
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
# ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 are general modem setup commands
# ATQ0: Disable result codes (Quiet mode)
# V1: Verbose result codes
# E1: Echo commands
# S0=0: Don't auto-answer incoming calls
# &C1: Assert DCD (Data Carrier Detect)
# &D2: When DTR goes low, enter command state
# +FCLASS=0: Set modem to class 0 (standard modem)

# Crucially, use the correct APN provided by your carrier.
# If your carrier's APN is 'orange', use that. If it's 'internet', use 'internet'.
# Verify this with your carrier.
Phone = *99***1#
# Or try Phone = *99# if *99***1# doesn't work

Username = "" # Usually not needed for standard mobile data, but try your carrier username if specified
Password = "" # Usually not needed for standard mobile data, but try your carrier password if specified

# Modem device. Adjust if /dev/ttyUSB1 doesn't work.
# You might also see /dev/cdc-wdm0 or similar for MBIM devices.
Modem = /dev/ttyUSB1

# Optional: Configure DNS servers. 'on' should use ISP's DNS.
# You can also specify manually:
# DNS = 8.8.8.8, 8.8.4.4
Auto DNS = on

# If you have a fixed IP or specific connection requirements, adjust this.
# For most mobile broadband, IPV4 is standard.
# Dial Command = ATDT
# For some modems, ATD might be required instead of ATDT.

# APN setting is critical. Ensure this is correct.
# Some Huawei modems require specific AT commands via Init3 or similar.
# For example, some need AT+CGDCONT=1,"IP","your_apn" or AT+CGSOCKCONT=1,"IP","your_apn"
# Let's add a more specific CGDCONT command as Init3 if needed.
# Init3 = AT+CGDCONT=1,"IP","your_apn_here"

4. The Assertion Failure: WvTaskMan::yield

The assertion failure Assertion \*current_task->stack_magic == WVTASK_MAGIC’ failed.` is often a symptom of a deeper issue, such as:

  • Race Conditions: wvdial might be trying to access or control the modem when the modem is busy or in an unexpected state.
  • Incorrect Modem Response: The modem might be sending unexpected data or no data at all, confusing wvdial’s internal state machine.
  • Hardware/Driver Issues: Although less likely if it worked on Windows, there could be subtle incompatibilities with the Linux kernel’s handling of the USB modem’s serial interface.

Strategies to Mitigate Assertion Failures

  • Staggered Initialization: Introduce delays between AT commands. This can be done using sleep commands within wvdial or by adding more Init lines with short delays.
  • More Robust AT Commands: Ensure the AT commands sent are the most appropriate for your specific modem model.
  • Alternative Dialing Methods: If ATDT*99# consistently fails, investigate if your modem supports other ways to initiate data calls.
  • wvdialconf Tool: Run wvdialconf to automatically detect your modem and generate a basic configuration. Then, you can manually edit this configuration.
    sudo wvdialconf /etc/wvdial.conf
    
    This might create a wvdial.conf file that is more compatible with your specific modem.
  • Check usb-modeswitch Data: Ensure the usb-modeswitch package is installed and up-to-date. Sometimes, a specific mode-switching rule is required for certain Huawei models.

Addressing the resolv.conf Issue and Network Manager

You mentioned that after resolving a resolv.conf symlink issue and copying /etc/ppp/resolv.conf, your internet connection began working. This is a significant step forward. However, the persistent “Invalid dial command” error suggests that the underlying problem with wvdial’s interaction with the modem still exists.

  • resolv.conf: This file is crucial for DNS resolution. When wvdial successfully establishes a connection, it often needs to update resolv.conf to point to the DNS servers provided by your mobile carrier. An empty or incorrect resolv.conf would prevent you from accessing websites by name, even if the modem connection itself was established. The fact that copying a working resolv.conf fixed this indicates that wvdial was likely establishing a connection, but the DNS part was broken.
  • Network Manager Disabled: You mentioned doing all of this with Network Manager disabled. This is important. Network Manager is the default network management service on most Debian installations. It has its own ways of handling mobile broadband connections (often using ModemManager and plugins). If you are manually managing the connection with wvdial, you need to ensure Network Manager isn’t interfering.

Recommendations Regarding resolv.conf and Network Manager

  1. Investigate resolv.conf Behavior: Even though you’ve fixed it, understand why it was a symlink or empty. Did wvdial fail to update it correctly? Or was there a system configuration issue?
  2. Consider Network Manager: For a cleaner and more integrated experience, consider disabling wvdial and configuring your connection through Network Manager. The HUAWEI E3372 is generally well-supported by ModemManager, which Network Manager uses.
    • Enable Network Manager:
      sudo systemctl enable NetworkManager
      sudo systemctl start NetworkManager
      
    • Add the connection: You can use the graphical interface (e.g., nm-applet) or nmcli command-line tool to add a new mobile broadband connection. You will need to provide your carrier’s APN, and possibly username and password.
    • If Network Manager doesn’t auto-detect: You might need to ensure modemmanager and relevant plugins are installed.

Advanced Troubleshooting Steps to Eliminate the “Invalid Dial Command” Error

Since you’ve confirmed connectivity but want to resolve the error itself, let’s focus on debugging wvdial’s interaction:

1. Enable Verbose Output for wvdial

Run wvdial with the debug flag to get more detailed output.

sudo wvdial -d orange

This will show every AT command sent and every response received from the modem. Look for any unexpected responses or missing “OK” acknowledgments.

2. Check wvdial’s Debug Logs

You can configure wvdial to log its activity to a file. Add this to your wvdial.conf:

[Dialer orange]
# ... other settings ...
Debug = /var/log/wvdial.log

Then restart wvdial. The log file will provide a detailed history of its operations.

3. Manual AT Command Testing

Use a serial terminal program like minicom or screen to manually send AT commands to your modem and observe its responses. This bypasses wvdial and helps isolate whether the issue is with wvdial’s commands or the modem’s interpretation.

  • Install minicom:
    sudo apt install minicom
    
  • Configure and run minicom:
    sudo minicom -s
    
    In the configuration menu, set the serial port to /dev/ttyUSB1 (or whichever port you are using) and the baud rate (try common ones like 115200, 9600). Save the configuration.
  • Exit to minicom: Press Ctrl+A then Z for the command menu, then O to resume.
  • Send Commands: Type ATZ, press Enter. You should see OK. Then try ATDT*99# and observe the response. If ATDT*99# fails, try ATDT*99***1#.

This manual testing will reveal if the modem itself is responding correctly to the ATDT commands. If it fails here too, the problem is definitively with the modem’s configuration or its communication path.

4. Examining usb-modeswitch Behavior

  • Verbose usb-modeswitch:
    sudo usb-modeswitch -v 12d1 -p 1506 -c /etc/usb_modeswitch.d/12d1:1506 -v 12d1 -p 1506 -e -L
    
    Replace -e with -s for a full dump of commands and responses if the above doesn’t provide enough detail. Check if usb-modeswitch successfully switches the device to modem mode.
  • usb-modeswitch Configuration: Ensure the configuration file for your modem (/etc/usb_modeswitch.d/12d1:1506) is correct. You can find community-maintained configurations online.

5. Alternative wvdial Configurations

Some users have reported success with specific modem types by adjusting how the Dial Command is specified or by using a different Modem Type.

[Dialer orange]
# ...
Modem Type = dynamic
# Or sometimes explicitly:
# Modem Type = huawei_e3372

# You might need to explicitly set the dial command if *99# isn't working
# Dial Command = ATDT*99#
# Or try Dial Command = ATD*99#
# ...

6. udev Rules for Modem Ports

Occasionally, udev rules might not be configured correctly for your modem, leading to incorrect or missing serial port assignments. While your dmesg output suggests they are present, ensuring robust rules can prevent issues. You can look for existing udev rules related to Huawei modems and adapt them if necessary.

7. Kernel Module Issues

Ensure that necessary kernel modules for USB serial devices (usbserial, cdc_acm) are loaded. Normally, these are loaded automatically.

lsmod | grep usbserial
lsmod | grep cdc_acm

If they are not loaded, you might need to load them manually (sudo modprobe usbserial cdc_acm) or investigate why they aren’t being triggered.

Conclusion and Path Forward

The “Invalid dial command” error, coupled with the assertion failure, indicates a communication breakdown between wvdial and your HUAWEI E3372 modem, even though you’ve achieved connectivity by other means. The most probable causes are an incorrect APN setting in your wvdial.conf or the modem not responding as expected to the ATDT*99# command.

Our primary recommendations to resolve this error are:

  1. Verify and Correct the APN: Ensure the APN in Init2 (AT+CGDCONT=1,"IP","internet") is precisely what your Orange SIM card requires. Change "internet" to the correct APN (e.g., "orange"), and test again.
  2. Test Alternative Phone Numbers: Try Phone = *99***1# if *99# is not working reliably.
  3. Utilize Detailed Debugging: Run sudo wvdial -d orange and examine the output thoroughly for any unexpected modem responses.
  4. Manual AT Command Testing: Use minicom to interact directly with the modem via /dev/ttyUSB1. This is the most definitive way to determine if the modem itself is correctly interpreting commands.

By systematically applying these troubleshooting steps, you should be able to isolate the root cause of the “Invalid dial command” error and achieve a clean, error-free connection with your HUAWEI E3372 on Debian. Remember that the success of mobile broadband connections on Linux often hinges on precise configuration and understanding how your specific hardware interacts with the system’s tools.

We at revWhiteShadow are dedicated to providing you with the in-depth technical guidance needed to overcome these challenges. Should you encounter further complexities, our detailed approach to analysis and problem-solving will continue to guide you toward a successful resolution.