ppa-purge fails on ubuntu desktop images due to awk
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ppa-purge (Ubuntu) |
Fix Released
|
High
|
Ghadi Rahme | ||
Mantic |
In Progress
|
High
|
Ghadi Rahme | ||
Noble |
In Progress
|
High
|
Ghadi Rahme |
Bug Description
[impact]
Currently there are different versions of awk installed on a Ubuntu system based on the flavor the user is running.
For ubuntu server images, the awk interpreter being used is gawk (GNU awk) while on desktop images, mawk is the default interpreter installed.
ppa-purge on ubuntu versions that use the deb822 source format (Noble and Mantic) uses the -i option in awk which is only available in gawk and is missing in mawk. This results in the following error:
awk: not an option: -i
A proposed fix would be to replace awk with sed.
[Reproducer]
1- install a desktop version of Noble or Mantic. In this case Noble is used as an example
2- add a ppa: $ sudo add-apt-repository ppa:oibaf/
3- upgrade to the version of the packages included in the ppa: $ sudo apt update && sudo apt upgrade
4- install ppa-purge: $ sudo apt install ppa-purge
5- ppa-purge version: $ dpkg -l| grep ppa-purge
ii ppa-purge 0.2.8+bzr63-
6- run ppa-purge: $ sudo ppa-purge ppa:oibaf/
7- you will see the following output with an awk related failure (only a sample of the output is shown below):
cs-drivers
Updating packages lists
Warning: The unit file, source configuration file or drop-ins of apt-news.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Warning: The unit file, source configuration file or drop-ins of esm-cache.service changed on disk. Run 'systemctl daemon-reload' to reload units.
W: https:/
PPA to be removed: oibaf graphics-drivers
Package revert list generated:
libdrm-
libdrm-
libegl-
libglapi-
mesa-vulkan-
awk: not an option: -i
Updating packages lists
...
...
...
8- this results in the packages not being downgraded since the .sources file was not disabled.
[cause]
This was caused in a patch that tried to fix LP:2036761
Although this patch was successful in fixing Ubuntu server installs, it does not work for Ubuntu desktop installs where gawk is not installed by default.
[workaround]
Manually install gawk: $ sudo apt install gawk
[solution]
I have written a patch that replaces the awk command with the sed command.
Below is the test plan showing the fix
[Test Plan]
1- Install the new ppa-purge version:
ghadi@ghadi-
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'ppa-purge' instead of './ppa-
The following package was automatically installed and is no longer required:
libllvm17t64
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
gawk libsigsegv2
Suggested packages:
gawk-doc aptitude
The following NEW packages will be installed:
gawk libsigsegv2
The following packages will be upgraded:
ppa-purge
1 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 478 kB/484 kB of archives.
After this operation, 1,830 kB of additional disk space will be used.
Do you want to continue? [Y/n]
We can see that gawk is being pulled in as a dependency
2- verify the ppa-purge verison:
ghadi@ghadi-
ii ppa-purge 0.2.8+bzr63-
3- verify that gawk is also installed: dpkg -l | grep gawkii
gawk 1:5.2.1-2build3
4- run ppa-purge again on the ppa installed in the [reproducer] section:
ghadi@ghadi-
Updating packages lists
Warning: The unit file, source configuration file or drop-ins of apt-news.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Warning: The unit file, source configuration file or drop-ins of esm-cache.service changed on disk. Run 'systemctl daemon-reload' to reload units.
W: https:/
PPA to be removed: oibaf graphics-drivers
Package revert list generated:
libdrm-
libdrm-
libegl-
libglapi-
mesa-vulkan-
Updating packages lists
Warning: The unit file, source configuration file or drop-ins of apt-news.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Warning: The unit file, source configuration file or drop-ins of esm-cache.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Selected version '2.4.120-2' (Ubuntu:24.04/noble [amd64]) for 'libdrm-amdgpu1'
Selected version '2.4.120-2' (Ubuntu:24.04/noble [all]) for 'libdrm-common'
Selected version '2.4.120-2' (Ubuntu:24.04/noble [amd64]) for 'libdrm-intel1'
Selected version '2.4.120-2' (Ubuntu:24.04/noble [amd64]) for 'libdrm-nouveau2'
Selected version '2.4.120-2' (Ubuntu:24.04/noble [amd64]) for 'libdrm-radeon1'
Selected version '2.4.120-2' (Ubuntu:24.04/noble [amd64]) for 'libdrm2'
Selected version '24.0.3-1ubuntu4' (Ubuntu:24.04/noble [amd64]) for 'libegl-mesa0'
Selected version '24.0.3-1ubuntu4' (Ubuntu:24.04/noble [amd64]) for 'libgbm1'
Selected version '24.0.3-1ubuntu4' (Ubuntu:24.04/noble [amd64]) for 'libgl1-mesa-dri'
Selected version '24.0.3-1ubuntu4' (Ubuntu:24.04/noble [amd64]) for 'libglapi-mesa'
Selected version '24.0.3-1ubuntu4' (Ubuntu:24.04/noble [amd64]) for 'libglx-mesa0'
Selected version '24.0.3-1ubuntu4' (Ubuntu:24.04/noble [amd64]) for 'libxatracker2'
Selected version '24.0.3-1ubuntu4' (Ubuntu:24.04/noble [amd64]) for 'mesa-vulkan-
The following packages will be DOWNGRADED:
libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
libdrm2 libegl-mesa0 libgbm1 libgl1-mesa-dri libglapi-mesa libglx-mesa0
libxatracker2 mesa-vulkan-drivers
0 upgraded, 0 newly installed, 13 downgraded, 0 to remove and 6 not upgraded.
Need to get 22.6 MB of archives.
After this operation, 34.8 MB disk space will be freed.
Do you want to continue? [Y/n]
Get:1 http://
Get:2 http://
Get:3 http://
Get:4 http://
Get:5 http://
Get:6 http://
Get:7 http://
Get:8 http://
Get:9 http://
Get:10 http://
Get:11 http://
Get:12 http://
Get:13 http://
Fetched 22.6 MB in 9s (2,514 kB/s)
dpkg: warning: downgrading libdrm2:amd64 from 2.4.120+
(Reading database ... 147872 files and directories currently installed.)
Preparing to unpack .../00-
Unpacking libdrm2:amd64 (2.4.120-2) over (2.4.120+
dpkg: warning: downgrading libdrm-common from 2.4.120+
Preparing to unpack .../01-
Unpacking libdrm-common (2.4.120-2) over (2.4.120+
dpkg: warning: downgrading libdrm-
Preparing to unpack .../02-
Unpacking libdrm-
dpkg: warning: downgrading libdrm-intel1:amd64 from 2.4.120+
Preparing to unpack .../03-
Unpacking libdrm-intel1:amd64 (2.4.120-2) over (2.4.120+
dpkg: warning: downgrading libdrm-
Preparing to unpack .../04-
Unpacking libdrm-
dpkg: warning: downgrading libdrm-
Preparing to unpack .../05-
Unpacking libdrm-
dpkg: warning: downgrading libegl-mesa0:amd64 from 24.1~git2404060
Preparing to unpack .../06-
Unpacking libegl-mesa0:amd64 (24.0.3-1ubuntu4) over (24.1~git240406
dpkg: warning: downgrading libgbm1:amd64 from 24.1~git2404060
Preparing to unpack .../07-
Unpacking libgbm1:amd64 (24.0.3-1ubuntu4) over (24.1~git240406
dpkg: warning: downgrading libgl1-
Preparing to unpack .../08-
Unpacking libgl1-
dpkg: warning: downgrading libglx-mesa0:amd64 from 24.1~git2404060
Preparing to unpack .../09-
Unpacking libglx-mesa0:amd64 (24.0.3-1ubuntu4) over (24.1~git240406
dpkg: warning: downgrading libglapi-mesa:amd64 from 24.1~git2404060
Preparing to unpack .../10-
Unpacking libglapi-mesa:amd64 (24.0.3-1ubuntu4) over (24.1~git240406
dpkg: warning: downgrading libxatracker2:amd64 from 24.1~git2404060
Preparing to unpack .../11-
Unpacking libxatracker2:amd64 (24.0.3-1ubuntu4) over (24.1~git240406
dpkg: warning: downgrading mesa-vulkan-
Preparing to unpack .../12-
Unpacking mesa-vulkan-
Setting up libglapi-mesa:amd64 (24.0.3-1ubuntu4) ...
Setting up libdrm-common (2.4.120-2) ...
Setting up libdrm2:amd64 (2.4.120-2) ...
Setting up libdrm-
Setting up mesa-vulkan-
Setting up libdrm-
Setting up libgbm1:amd64 (24.0.3-1ubuntu4) ...
Setting up libdrm-
Setting up libdrm-intel1:amd64 (2.4.120-2) ...
Setting up libgl1-
Setting up libxatracker2:amd64 (24.0.3-1ubuntu4) ...
Setting up libegl-mesa0:amd64 (24.0.3-1ubuntu4) ...
Setting up libglx-mesa0:amd64 (24.0.3-1ubuntu4) ...
Processing triggers for libc-bin (2.39-0ubuntu8) ...
PPA purged successfully
5- we can see that packages were successfully reverted.
[Where problems could occur]
- the sed command might fail to disable the ppa causing ppa-purge to not downgrade the packages
Related branches
- Andreas Hasenack: Approve
- Ubuntu Sponsors: Pending requested
-
Diff: 39 lines (+11/-3)2 files modifieddebian/changelog (+6/-0)
ppa-purge (+5/-3)
Changed in ppa-purge (Ubuntu Mantic): | |
assignee: | nobody → Ghadi Rahme (ghadi-rahme) |
Changed in ppa-purge (Ubuntu Noble): | |
assignee: | nobody → Ghadi Rahme (ghadi-rahme) |
Changed in ppa-purge (Ubuntu Mantic): | |
importance: | Undecided → High |
Changed in ppa-purge (Ubuntu Noble): | |
importance: | Undecided → High |
description: | updated |
summary: |
- ppa-purge crashes on ubuntu desktop images due to awk + ppa-purge fails on ubuntu desktop images due to awk |
Changed in ppa-purge (Ubuntu Mantic): | |
status: | New → In Progress |
Changed in ppa-purge (Ubuntu Noble): | |
status: | New → In Progress |
description: | updated |
Fix sponsored for oracular: 0.2.8+bzr63- 0ubuntu3. dsc 0.2.8+bzr63- 0ubuntu3. tar.xz 0.2.8+bzr63- 0ubuntu3_ source. buildinfo 0.2.8+bzr63- 0ubuntu3_ source. changes
Uploading ppa-purge_
Uploading ppa-purge_
Uploading ppa-purge_
Uploading ppa-purge_