preinst writes to /root

Bug #2021937 reported by Julian Andres Klode
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
network-manager (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

As part of my sandboxed APT I noticed that the package failed to install as it was trying to write to /root.

/root is a user directory, not a system one, which may not even exist because the administrator changed it to like /home/root, for example, and we definitely should not be writing system files in user directories.

Preparing to unpack .../16-network-manager_1.42.4-1ubuntu4_amd64.deb ...
mkdir: cannot create directory ‘/root/NetworkManager.bak’: Read-only file system
cp: cannot create directory '/root/NetworkManager.bak/system-connections_1.42.4-1ubuntu2': No such file or directory
dpkg: error processing archive /tmp/apt-dpkg-install-x9x0Qo/16-network-manager_1.42.4-1ubuntu4_amd64.deb (--unpack):
 new network-manager package pre-installation script subprocess returned error exit status 1

Related branches

Revision history for this message
Danilo Egea Gondolfo (danilogondolfo) wrote :

Thanks, Julian.

This behavior was introduced by the netplan integration where we create a backup of the existing network manager connections. I'll look for a better place to store the backups.

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

This bug was fixed in the package network-manager - 1.42.4-1ubuntu5

---------------
network-manager (1.42.4-1ubuntu5) mantic; urgency=medium

  * d/network-manager.postinst: fix netplan migration logic.
    The "continue" is being executed in a subshell so it's not skipping the
    next commands. It will fail if Network Manager is not running. See LP: #2022023
  * d/network-manager.preinst: use /var/lib/NetworkManager for backups
    /root is not a system directory so we shouldn't use it. It might not
    even exist or the package manager might run in a sandbox and not have
    access to it. See LP: #2021937

 -- Danilo Egea Gondolfo <email address hidden> Thu, 01 Jun 2023 15:17:57 +0100

Changed in network-manager (Ubuntu):
status: New → Fix Released
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.