** Description changed:

- In MAAS, we use grub-mkimage to create a bootloader for VM's to PXE boot
- of MAAS by a grub bootloader that we provide over the network. (we call
- this bootppc64.bin).
+ [Impact]
+ grub2 on ppc64el wrongfully configures two interfaces for the same card when 
running in qemu with a tftp boot. This causes net_default_mac to point to the 
wrong mac address, amongst other things.
+  
+ [Test case]
+ (1) grub-mknetdir --net-directory=$dir
+ (2) qemu-system-ppc64le -device virtio-net-pci,netdev=mynet,mac=$mac -netdev 
user,id=mynet,tftp=$dir,bootfile=boot/grub/powerpc-ieee1275/core.elf
+ 
+ grub loads successfully via tftp.
+ 
+ Verify that
+ (1) net_ls_cards shows the card with the correct mac addr $mac
+ (2) net_ls_addr shows one interface with mac $mac
+ (3) echo $net_default_mac shows the mac $mac
+ 
+ [Regression potential]
+ grub now correctly stores the mac address in variables, meaning that code now 
might not fallback to a default.
+ 
+ Apart from that/On the other hand, the fix is a simple case of
+ initializing variables, therefore that was possible before too, as it
+ was basically random anyway.
+ 
+ [Original bug report]
+ In MAAS, we use grub-mkimage to create a bootloader for VM's to PXE boot of 
MAAS by a grub bootloader that we provide over the network. (we call this 
bootppc64.bin).
  
  This bootloader is created with the following grub configuration:
  
-    grub_config: |
-       # MAAS GRUB2 pre-loader configuration file
-       
-       # Load based on MAC address first.
-       configfile (pxe)/grub/grub.cfg-${net_default_mac}
+    grub_config: |
+       # MAAS GRUB2 pre-loader configuration file
  
-       # Failed to load based on MAC address.
-       # Load arm64 by default, UEFI only supported by 64-bit
-       configfile (pxe)/grub/grub.cfg-default-arm64
+       # Load based on MAC address first.
+       configfile (pxe)/grub/grub.cfg-${net_default_mac}
+ 
+       # Failed to load based on MAC address.
+       # Load arm64 by default, UEFI only supported by 64-bit
+       configfile (pxe)/grub/grub.cfg-default-arm64
  
  When we use bionic bootloader, we see the following output in the
  console:
  
-  "Booting under MAAS direction...  [ grub.cfg-default-ppc  642B  100%
+  "Booting under MAAS direction...  [ grub.cfg-default-ppc  642B  100%
  57.16B/s ]"
  
  And in rackd.log we see:
  
  2018-08-07 17:37:21 provisioningserver.rackdservices.tftp: [info] 
bootppc64.bin requested by 10.245.136.136
  2018-08-07 17:37:24 provisioningserver.rackdservices.tftp: [info] 
/grub/grub.cfg-80:1c:b0:c0:7d:c5 requested by 10.245.136.136
  2018-08-07 17:37:24 provisioningserver.rackdservices.tftp: [info] 
/grub/grub.cfg-default-ppc64el requested by 10.245.136.136
  2018-08-07 17:37:24 provisioningserver.rackdservices.tftp: [info] 
ubuntu/ppc64el/ga-18.04/bionic/daily/boot-kernel requested by 10.245.136.136
  
  This means that the VM attempted to PXE boot with MAC address
  "80:1c:b0:c0:7d:c5", but the VM itself has a different MAC address
  "52:54:00:7f:83:62"
  
-     <interface type='network'>
-       <mac address='52:54:00:7f:83:62'/>
-       <source network='maas'/>
-       <model type='virtio'/>
-       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' 
function='0x0'/>
-     </interface>
+     <interface type='network'>
+       <mac address='52:54:00:7f:83:62'/>
+       <source network='maas'/>
+       <model type='virtio'/>
+       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' 
function='0x0'/>
+     </interface>
  
+ If we are to switch the bootloader to the one created with xenial as a
+ base, we see correct behavior.
  
- If we are to switch the bootloader to the one created with xenial as a base, 
we see correct behavior.
- 
-  "Booting under MAAS direction...   [ grub.cfg-52:54:00:7f  640B  100%
+  "Booting under MAAS direction...   [ grub.cfg-52:54:00:7f  640B  100%
  0.62B/s ]   "
  
  And the result is that grub has used to correct MAC address for the PXE
  process.
  
  2018-08-07 17:07:45 provisioningserver.rackdservices.tftp: [info] 
bootppc64.bin requested by 10.245.136.136
  2018-08-07 17:07:46 provisioningserver.rackdservices.tftp: [info] 
/grub/grub.cfg-52:54:00:7f:83:62 requested by 10.245.136.136
  2018-08-07 17:07:47 provisioningserver.rackdservices.tftp: [info] 
ubuntu/ppc64el/generic/bionic/daily/boot-kernel requested by 10.245.136.136
  2018-08-07 17:08:17 provisioningserver.rackdservices.tftp: [info] 
ubuntu/ppc64el/generic/bionic/daily/boot-initrd requested by 10.245.136.136
  
- 
- It would seem as the firmware in bionic is automatically generating a new MAC 
address.
+ It would seem as the firmware in bionic is automatically generating a
+ new MAC address.
  
  Bionic console log
  
-------------------------------------------------------------------------------
  Using default console: /vdevice/vty@30000000
  
-   Welcome to Open Firmware
+   Welcome to Open Firmware
  
-   Copyright (c) 2004, 2017 IBM Corporation All rights reserved.
-   This program and the accompanying materials are made available
-   under the terms of the BSD License available at
-   http://www.opensource.org/licenses/bsd-license.php
- 
+   Copyright (c) 2004, 2017 IBM Corporation All rights reserved.
+   This program and the accompanying materials are made available
+   under the terms of the BSD License available at
+   http://www.opensource.org/licenses/bsd-license.php
  
  Trying to load:  from: /pci@800000020000000/ethernet@4 ...
-  Initializing NIC
-   Reading MAC address from device: 52:54:00:7f:83:62
-   Requesting information via DHCP: done
-   Using IPv4 address: 10.245.136.136
-   Requesting file "bootppc64.bin" via TFTP from 10.245.136.6
-   Receiving data:  1665 KBytes
-   TFTP: Received bootppc64.bin (1665 KBytes)
-   Successfully loaded
+  Initializing NIC
+   Reading MAC address from device: 52:54:00:7f:83:62
+   Requesting information via DHCP: done
+   Using IPv4 address: 10.245.136.136
+   Requesting file "bootppc64.bin" via TFTP from 10.245.136.6
+   Receiving data:  1665 KBytes
+   TFTP: Received bootppc64.bin (1665 KBytes)
+   Successfully loaded
  Booting under MAAS direction...  [ grub.cfg-default-ppc  642B  100%  57.16B/s 
]
- OF stdout device is: /vdevice/vty@30000000initrd  55.89MiB  100%  647.54KiB/s 
]                  
+ OF stdout device is: /vdevice/vty@30000000initrd  55.89MiB  100%  647.54KiB/s 
]
  Preparing to boot Linux version 4.15.0-30-generic (buildd@bos02-ppc64el-011) 
(gcc version 7.3.0 (Ubuntu 7
- .3.0-16ubuntu3)) #32-Ubuntu SMP Thu Jul 26 17:43:11 UTC 2018 (Ubuntu 
4.15.0-30.32-generic 4.15.18)       
- Detected machine type: 0000000000000101                                       
                           
+ .3.0-16ubuntu3)) #32-Ubuntu SMP Thu Jul 26 17:43:11 UTC 2018 (Ubuntu 
4.15.0-30.32-generic 4.15.18)
+ Detected machine type: 0000000000000101
  command line: BOOT_IMAGE=ubuntu/ppc64el/ga-18.04/bionic/daily/boot-kernel 
nomodeset ro root=squash:http:/
  /10.245.136.6:5248/images/ubuntu/ppc64el/ga-18.04/bionic/daily/squashfs 
ip=::::maas-enlist:BOOTIF ip6=off
-  overlayroot=tmpfs overlayroot_cfgdisk=disabled cc:{datasource_list: 
[MAAS]}end_cc cloud-config-url=http:
+  overlayroot=tmpfs overlayroot_cfgdisk=disabled cc:{datasource_list: 
[MAAS]}end_cc cloud-config-url=http:
  
//10-245-136-0--21.maas-internal:5248/MAAS/metadata/latest/enlist-preseed/?op=get_enlist_preseed
 apparmor
- =0 log_host=10.245.136.6 log_port=514 BOOTIF=01-80:1c:b0:c0:7d:c5   
- 
+ =0 log_host=10.245.136.6 log_port=514 BOOTIF=01-80:1c:b0:c0:7d:c5
  
  Xenial console log
  --------------------------------------------------------------------
  Using default console: /vdevice/vty@30000000                                  
                [1032/2975]
-                                                                               
                           
-   Welcome to Open Firmware                                                    
                           
-                                                                               
                           
-   Copyright (c) 2004, 2017 IBM Corporation All rights reserved.               
                           
-   This program and the accompanying materials are made available              
                           
-   under the terms of the BSD License available at                             
                           
-   http://www.opensource.org/licenses/bsd-license.php                          
                           
-                                                                               
                           
-                                                                               
                           
- Trying to load:  from: /pci@800000020000000/ethernet@4 ...                    
                           
-  Initializing NIC                                                             
                           
-   Reading MAC address from device: 52:54:00:7f:83:62                          
                           
-   Requesting information via DHCP: done                                       
                           
-   Using IPv4 address: 10.245.136.136                                          
                           
-   Requesting file "bootppc64.bin" via TFTP from 10.245.136.6                  
                           
-   Receiving data:  1714 KBytes                                                
                           
-   TFTP: Received bootppc64.bin (1714 KBytes)                                  
                           
-   Successfully loaded                                                         
                           
- Booting under MAAS direction...   [ grub.cfg-52:54:00:7f  640B  100%  0.62B/s 
]                          
- OF stdout device is: /vdevice/vty@30000000initrd  55.89MiB  100%  958.95KiB/s 
]                          
+ 
+   Welcome to Open Firmware
+ 
+   Copyright (c) 2004, 2017 IBM Corporation All rights reserved.
+   This program and the accompanying materials are made available
+   under the terms of the BSD License available at
+   http://www.opensource.org/licenses/bsd-license.php
+ 
+ Trying to load:  from: /pci@800000020000000/ethernet@4 ...
+  Initializing NIC
+   Reading MAC address from device: 52:54:00:7f:83:62
+   Requesting information via DHCP: done
+   Using IPv4 address: 10.245.136.136
+   Requesting file "bootppc64.bin" via TFTP from 10.245.136.6
+   Receiving data:  1714 KBytes
+   TFTP: Received bootppc64.bin (1714 KBytes)
+   Successfully loaded
+ Booting under MAAS direction...   [ grub.cfg-52:54:00:7f  640B  100%  0.62B/s 
]
+ OF stdout device is: /vdevice/vty@30000000initrd  55.89MiB  100%  958.95KiB/s 
]
  Preparing to boot Linux version 4.15.0-30-generic (buildd@bos02-ppc64el-011) 
(gcc version 7.3.0 (Ubuntu $
- .3.0-16ubuntu3)) #32-Ubuntu SMP Thu Jul 26 17:43:11 UTC 2018 (Ubuntu 
4.15.0-30.32-generic 4.15.18)       
- Detected machine type: 0000000000000101                                       
                           
+ .3.0-16ubuntu3)) #32-Ubuntu SMP Thu Jul 26 17:43:11 UTC 2018 (Ubuntu 
4.15.0-30.32-generic 4.15.18)
+ Detected machine type: 0000000000000101
  command line: BOOT_IMAGE=ubuntu/ppc64el/generic/bionic/daily/boot-kernel 
nomodeset ro root=squash:http:/$
  10.245.136.6:5248/images/ubuntu/ppc64el/generic/bionic/daily/squashfs 
ip=::::fast-cow:BOOTIF ip6=off ove$
  layroot=tmpfs overlayroot_cfgdisk=disabled cc:{datasource_list: [MAAS]}end_cc 
cloud-config-url=http://10$
  
245-136-0--21.maas-internal:5248/MAAS/metadata/latest/by-id/4ysp63/?op=get_preseed
 apparmor=0 log_host=1$
- .245.136.6 log_port=514 rootdelay=60 BOOTIF=01-52:54:00:7f:83:62              
                           
+ .245.136.6 log_port=514 rootdelay=60 BOOTIF=01-52:54:00:7f:83:62
  Max number of cores passed to firmware: 2048 (NR_CPUS = 2048)

** Also affects: grub2 (Ubuntu Bionic)
   Importance: Undecided
       Status: New

** Changed in: grub2 (Ubuntu Bionic)
       Status: New => In Progress

** Changed in: grub2 (Ubuntu)
       Status: In Progress => Fix Committed

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

Title:
  [REGRESSION] ppc64el grub in bionic may be auto-generating MAC address
  instead of using the assigned to the VM.

To manage notifications about this bug go to:
https://bugs.launchpad.net/maas-images/+bug/1785859/+subscriptions

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

Reply via email to