/etc/network/if-up.d/resolved: line 20: return: can only `return' from a function or sourced script

Bug #2004003 reported by Nicholas Guriev
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ifupdown (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Just found the following errors in "systemctl status networking"

× networking.service - Raise network interfaces
     Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-01-27 12:26:29 MSK; 3min 10s ago
       Docs: man:interfaces(5)
    Process: 3963 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
   Main PID: 3963 (code=exited, status=1/FAILURE)
        CPU: 147ms

янв 27 12:26:29 gerbera systemd[1]: Starting Raise network interfaces...
янв 27 12:26:29 gerbera ifup[3976]: /etc/network/if-up.d/resolved: line 12: mystatedir: command not found
янв 27 12:26:29 gerbera ifup[3973]: /etc/network/if-up.d/resolved: line 20: return: can only `return' from a function or sourced script
янв 27 12:26:29 gerbera ifup[3969]: run-parts: /etc/network/if-up.d/resolved exited with return code 2
янв 27 12:26:29 gerbera ifup[3963]: ifup: failed to bring up lo
янв 27 12:26:29 gerbera systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
янв 27 12:26:29 gerbera systemd[1]: networking.service: Failed with result 'exit-code'.
янв 27 12:26:29 gerbera systemd[1]: Failed to start Raise network interfaces.

The error with mystatedir has been already reported as bug#1907878. However, patches there do not fix unexpected return statement.

Tags: jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ifupdown (Ubuntu):
status: New → Confirmed
Revision history for this message
Juozas Pocius (juozaspo) wrote (last edit ):

I've also encountered this bug in Ubuntu 22.04 LTS. I'd get an error in /etc/network/if-up.d/resolved unless I change 'return' to 'exit' in the affected line. After the change I'd no longer encounter an error.

I have /bin/sh symlinked to bash as requirement to build some software.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.