** Description changed:

  [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 add gawk as a dependency to ppa-purge.
+ 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/graphics-drivers
  
- 3- pgrade to the version of the packages included in the ppa: $ sudo apt
- update && sudo apt upgrade
+ 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-0ubuntu2
  
  6- run ppa-purge: $ sudo ppa-purge ppa:oibaf/graphics-drivers
  
  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.launchpadcontent.net/oibaf/graphics-drivers/ubuntu/dists/noble/InRelease:
 Signature by key 5ABCE68FF4633EA42E219156957D2708A03A4626 uses weak algorithm 
(rsa1024)
  PPA to be removed: oibaf graphics-drivers
  Package revert list generated:
   libdrm-amdgpu1:amd64/noble libdrm-common/noble libdrm-intel1:amd64/noble
  libdrm-nouveau2:amd64/noble libdrm-radeon1:amd64/noble libdrm2:amd64/noble
  libegl-mesa0:amd64/noble libgbm1:amd64/noble libgl1-mesa-dri:amd64/noble
  libglapi-mesa:amd64/noble libglx-mesa0:amd64/noble libxatracker2:amd64/noble
  mesa-vulkan-drivers:amd64/noble
  
  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 adds gawk as a dependency for ppa-purge.
+ 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-Standard-PC-Q35-ICH9-2009:~/Desktop$ sudo apt install 
./ppa-purge_0.2.8+bzr63-0ubuntu2.1_all.deb
  
  Reading package lists... Done
  Building dependency tree... Done
  Reading state information... Done
  Note, selecting 'ppa-purge' instead of 
'./ppa-purge_0.2.8+bzr63-0ubuntu2.1_all.deb'
  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-Standard-PC-Q35-ICH9-2009:~/Desktop$ dpkg -l | grep ppa-purge
  ii  ppa-purge                                     0.2.8+bzr63-0ubuntu2.1
  
  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-Standard-PC-Q35-ICH9-2009:~/Desktop$ sudo ppa-purge 
ppa:oibaf/graphics-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.launchpadcontent.net/oibaf/graphics-drivers/ubuntu/dists/noble/InRelease:
 Signature by key 5ABCE68FF4633EA42E219156957D2708A03A4626 uses weak algorithm 
(rsa1024)
  PPA to be removed: oibaf graphics-drivers
  Package revert list generated:
   libdrm-amdgpu1:amd64/noble libdrm-common/noble libdrm-intel1:amd64/noble
  libdrm-nouveau2:amd64/noble libdrm-radeon1:amd64/noble libdrm2:amd64/noble
  libegl-mesa0:amd64/noble libgbm1:amd64/noble libgl1-mesa-dri:amd64/noble
  libglapi-mesa:amd64/noble libglx-mesa0:amd64/noble libxatracker2:amd64/noble
  mesa-vulkan-drivers:amd64/noble
  
  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-drivers'
  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://lb.archive.ubuntu.com/ubuntu noble/main amd64 libdrm2 amd64 
2.4.120-2 [40.4 kB]
  Get:2 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libdrm-common all 
2.4.120-2 [7,998 B]
  Get:3 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libdrm-amdgpu1 
amd64 2.4.120-2 [20.4 kB]
  Get:4 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libdrm-intel1 
amd64 2.4.120-2 [63.8 kB]
  Get:5 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libdrm-nouveau2 
amd64 2.4.120-2 [17.6 kB]
  Get:6 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libdrm-radeon1 
amd64 2.4.120-2 [20.7 kB]
  Get:7 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libegl-mesa0 amd64 
24.0.3-1ubuntu4 [115 kB]
  Get:8 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libgbm1 amd64 
24.0.3-1ubuntu4 [42.3 kB]
  Get:9 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libgl1-mesa-dri 
amd64 24.0.3-1ubuntu4 [8,942 kB]
  Get:10 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libglx-mesa0 
amd64 24.0.3-1ubuntu4 [154 kB]
  Get:11 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libglapi-mesa 
amd64 24.0.3-1ubuntu4 [40.8 kB]
  Get:12 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 libxatracker2 
amd64 24.0.3-1ubuntu4 [2,134 kB]
  Get:13 http://lb.archive.ubuntu.com/ubuntu noble/main amd64 
mesa-vulkan-drivers amd64 24.0.3-1ubuntu4 [11.0 MB]
  Fetched 22.6 MB in 9s (2,514 kB/s)
  dpkg: warning: downgrading libdrm2:amd64 from 
2.4.120+git2404040500.f94a79~oibaf~n to 2.4.120-2
  (Reading database ... 147872 files and directories currently installed.)
  Preparing to unpack .../00-libdrm2_2.4.120-2_amd64.deb ...
  Unpacking libdrm2:amd64 (2.4.120-2) over 
(2.4.120+git2404040500.f94a79~oibaf~n) ...
  dpkg: warning: downgrading libdrm-common from 
2.4.120+git2404040500.f94a79~oibaf~n to 2.4.120-2
  Preparing to unpack .../01-libdrm-common_2.4.120-2_all.deb ...
  Unpacking libdrm-common (2.4.120-2) over 
(2.4.120+git2404040500.f94a79~oibaf~n) ...
  dpkg: warning: downgrading libdrm-amdgpu1:amd64 from 
2.4.120+git2404040500.f94a79~oibaf~n to 2.4.120-2
  Preparing to unpack .../02-libdrm-amdgpu1_2.4.120-2_amd64.deb ...
  Unpacking libdrm-amdgpu1:amd64 (2.4.120-2) over 
(2.4.120+git2404040500.f94a79~oibaf~n) ...
  dpkg: warning: downgrading libdrm-intel1:amd64 from 
2.4.120+git2404040500.f94a79~oibaf~n to 2.4.120-2
  Preparing to unpack .../03-libdrm-intel1_2.4.120-2_amd64.deb ...
  Unpacking libdrm-intel1:amd64 (2.4.120-2) over 
(2.4.120+git2404040500.f94a79~oibaf~n) ...
  dpkg: warning: downgrading libdrm-nouveau2:amd64 from 
2.4.120+git2404040500.f94a79~oibaf~n to 2.4.120-2
  Preparing to unpack .../04-libdrm-nouveau2_2.4.120-2_amd64.deb ...
  Unpacking libdrm-nouveau2:amd64 (2.4.120-2) over 
(2.4.120+git2404040500.f94a79~oibaf~n) ...
  dpkg: warning: downgrading libdrm-radeon1:amd64 from 
2.4.120+git2404040500.f94a79~oibaf~n to 2.4.120-2
  Preparing to unpack .../05-libdrm-radeon1_2.4.120-2_amd64.deb ...
  Unpacking libdrm-radeon1:amd64 (2.4.120-2) over 
(2.4.120+git2404040500.f94a79~oibaf~n) ...
  dpkg: warning: downgrading libegl-mesa0:amd64 from 
24.1~git2404060600.acbf3a~oibaf~n to 24.0.3-1ubuntu4
  Preparing to unpack .../06-libegl-mesa0_24.0.3-1ubuntu4_amd64.deb ...
  Unpacking libegl-mesa0:amd64 (24.0.3-1ubuntu4) over 
(24.1~git2404060600.acbf3a~oibaf~n) ...
  dpkg: warning: downgrading libgbm1:amd64 from 
24.1~git2404060600.acbf3a~oibaf~n to 24.0.3-1ubuntu4
  Preparing to unpack .../07-libgbm1_24.0.3-1ubuntu4_amd64.deb ...
  Unpacking libgbm1:amd64 (24.0.3-1ubuntu4) over 
(24.1~git2404060600.acbf3a~oibaf~n) ...
  dpkg: warning: downgrading libgl1-mesa-dri:amd64 from 
24.1~git2404060600.acbf3a~oibaf~n to 24.0.3-1ubuntu4
  Preparing to unpack .../08-libgl1-mesa-dri_24.0.3-1ubuntu4_amd64.deb ...
  Unpacking libgl1-mesa-dri:amd64 (24.0.3-1ubuntu4) over 
(24.1~git2404060600.acbf3a~oibaf~n) ...
  dpkg: warning: downgrading libglx-mesa0:amd64 from 
24.1~git2404060600.acbf3a~oibaf~n to 24.0.3-1ubuntu4
  Preparing to unpack .../09-libglx-mesa0_24.0.3-1ubuntu4_amd64.deb ...
  Unpacking libglx-mesa0:amd64 (24.0.3-1ubuntu4) over 
(24.1~git2404060600.acbf3a~oibaf~n) ...
  dpkg: warning: downgrading libglapi-mesa:amd64 from 
24.1~git2404060600.acbf3a~oibaf~n to 24.0.3-1ubuntu4
  Preparing to unpack .../10-libglapi-mesa_24.0.3-1ubuntu4_amd64.deb ...
  Unpacking libglapi-mesa:amd64 (24.0.3-1ubuntu4) over 
(24.1~git2404060600.acbf3a~oibaf~n) ...
  dpkg: warning: downgrading libxatracker2:amd64 from 
24.1~git2404060600.acbf3a~oibaf~n to 24.0.3-1ubuntu4
  Preparing to unpack .../11-libxatracker2_24.0.3-1ubuntu4_amd64.deb ...
  Unpacking libxatracker2:amd64 (24.0.3-1ubuntu4) over 
(24.1~git2404060600.acbf3a~oibaf~n) ...
  dpkg: warning: downgrading mesa-vulkan-drivers:amd64 from 
24.1~git2404060600.acbf3a~oibaf~n to 24.0.3-1ubuntu4
  Preparing to unpack .../12-mesa-vulkan-drivers_24.0.3-1ubuntu4_amd64.deb ...
  Unpacking mesa-vulkan-drivers:amd64 (24.0.3-1ubuntu4) over 
(24.1~git2404060600.acbf3a~oibaf~n) ...
  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-amdgpu1:amd64 (2.4.120-2) ...
  Setting up mesa-vulkan-drivers:amd64 (24.0.3-1ubuntu4) ...
  Setting up libdrm-nouveau2:amd64 (2.4.120-2) ...
  Setting up libgbm1:amd64 (24.0.3-1ubuntu4) ...
  Setting up libdrm-radeon1:amd64 (2.4.120-2) ...
  Setting up libdrm-intel1:amd64 (2.4.120-2) ...
  Setting up libgl1-mesa-dri:amd64 (24.0.3-1ubuntu4) ...
  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]
  
- - newer versions of gawk could deprecate the -i option causing the issue to 
resurface again
- - bugs in gawk that affect the -i option could also cause ppa-purge to fail.
+ - the sed command might fail to disable the ppa causing ppa-purge to not
+ downgrade the packages

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2060544

Title:
  ppa-purge fails on ubuntu desktop images due to awk

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ppa-purge/+bug/2060544/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to