Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When Network-Manager is not able to bind my Ubuntu to any connection, after a while it closes. The icon in the notification area (or indicator area) disappears, and it does not run any more. For instance this happens when there is really no ethernet network nor wireless one.

Nonetheless this is a problem, since I often plug in my ethernet cable long after having booted my computer. As a hack I therefore hit Alt + F2, and type nm-applet. But I am not satisfied with this solution, because I think it is not intuitive enough.

Is there a way to keep Network-Manager always running?

I have Network-Manager 0.8.1 on Ubuntu 10.10, but this has been so for a long time, at least for one year.

share|improve this question
    
On which Ubuntu version does this happen? –  Octavian Damiean Feb 24 '11 at 18:04

1 Answer 1

This happened to me in the past but I never got around to troubleshooting it. Generally, with this kind of intermittent problem I'll use the following script to both keep the application running and gather information about why it quit:

#!/bin/bash
# Automatically relaunch applications that exit unexpectedly, and log stdout for analysis.
# Usage: relauncher.sh "application"

# Command to (re)run
app="$1"

# Infinite loop
while true; do

    # Get starting time
    start_epoch=$(date +%s)

    # Run application and capture output in memory
    log=$( { $app ; } 2>&1 )

    # Run in background
    {
        # Notify in system tray (Waits here until clicked)
        zenity --notification --text "$app has exited. Click to view details."

        # Write log to temp file
        logfile="$(mktemp)"
        echo "$log" > "$logfile"

        # View it
        gedit "$logfile"
    } &

    # Abort if the application exited too quickly
    end_epoch=$(date +%s)
    duration=$(( $end_epoch - $start_epoch ))
    if [[ "$duration" < 30 ]]; then
        zenity --notification --text "$app exited too quickly. Aborting relauncher." &
        exit
    fi

done

exit

To use it, save an executable copy as ~/bin/relauncher.sh and then, in System ▸ Preferences ▸ Startup Applications ▸ Startup Programs ▸ Network Manager ▸ Edit, replace nm-applet --sm-disable with /home/user/bin/relauncher.sh "nm-applet --sm-disable".

The next time the applet disappears, it will be automatically restarted and an icon will appear in the notification area. Click the icon to check for information about why nm-applet exited, then consider reporting a bug via ubuntu-bug nm-applet and attach any relevant error messages.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.