Page MenuHomeVyOS Platform

"add system image" fails when appending XX to image name
Closed, ResolvedPublicBUG

Description

When calling add system image and upgrading from any version and decide to not use the suggested image name but rather append -XX to the image name GNU sed gets totally confused and the system won't boot next time.

[email protected]:~$ add sys im http://172.16.10.30/vyos-1.2.6-amd64.iso
Trying to fetch ISO file from http://172.16.10.30/vyos-1.2.6-amd64.iso
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  409M  100  409M    0     0  46.2M      0  0:00:08  0:00:08 --:--:-- 46.7M
ISO download succeeded.
Checking for digital signature file...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   833  100   833    0     0    98k      0 --:--:-- --:--:-- --:--:--  101k
Found it.  Checking digital signature...
gpg: assuming signed data in `/var/tmp/install-image.2122/vyos-1.2.6-amd64.iso'
gpg: Signature made Fri 11 Sep 2020 11:49:32 AM CEST using RSA key ID A0FE6D7E
gpg: Good signature from "VyOS Maintainers (VyOS Release) <[email protected]>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 0694 A923 0F51 39BF 834B  A458 FD22 0285 A0FE 6D7E
Digital signature is valid.
Checking MD5 checksums of files on the ISO image...OK.
Done!
What would you like to name this image? [1.2.6]: 1.2.6-XX
OK.  This image will be named: 1.2.6-XX
Installing "1.2.6-XX" image.
Copying new release files...
Would you like to save the current configuration
directory and config file? (Yes/No) [Yes]:
Copying current configuration...
Would you like to save the SSH host keys from your
current configuration? (Yes/No) [Yes]:
Copying SSH keys...
Running post-install script...
Setting up grub configuration...
sed: -e expression #1, char 39: unknown option to `s'
Done.

The more problematic side effect is that you can not delete the faulty installation, as it will remove your /config folder and on the next boot we no longer have /config

[email protected]:~$ delete system image
The following image(s) can be deleted:

   1: Old-non-image-installation (default boot)
   2: 1.2.5 (running image)

Select the image to delete: 1

Are you sure you want to delete the
"Old-non-image-installation" image? (Yes/No) [No]: y
Deleting the "Old-non-image-installation" image...
Skipping /lib/live/mount/persistence/boot.
Deleting /lib/live/mount/persistence/lost+found...
Deleting /lib/live/mount/persistence/persistence.conf...
Done
The default image has been changed to the currently running image:
1.2.5

Details

Difficulty level
Unknown (require assessment)
Version
1.3-rolling 1.2.5
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

c-po updated the task description. (Show Details)

The problem with that expression
https://github.com/vyos/vyatta-cfg-system/blob/current/scripts/install/install-image-existing#L271

sed -i "sX/boot/[A-Za-z0-9\.\-]*X/boot/${NEWNAME}Xg" $def_grub_vers

${NEWNAME}Xg" that X mixed with new name.

So I was super lucky to pick the wrong characters!

PR https://github.com/vyos/vyatta-cfg-system/pull/129

Propose to use spec symbols in regex, which cannot be contained in the image name.

[email protected]:~$ add system image https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso
Trying to fetch ISO file from https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  309M  100  309M    0     0  20.6M      0  0:00:14  0:00:14 --:--:-- 23.1M
ISO download succeeded.
Checking for digital signature file...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
Unable to fetch digital signature file.
Do you want to continue without signature check? (yes/no) [yes] 
Checking MD5 checksums of files on the ISO image...OK.
Done!
What would you like to name this image? [1.3-rolling-202009251444]: 1.3-XX
OK.  This image will be named: 1.3-XX
Installing "1.3-XX" image.
Copying new release files...
Would you like to save the current configuration 
directory and config file? (Yes/No) [Yes]: 
Copying current configuration...
Would you like to save the SSH host keys from your 
current configuration? (Yes/No) [Yes]: 
Copying SSH keys...
Running post-install script...
Setting up grub configuration...
Done.
[email protected]:~$

reboot fine

[email protected]:~$ reboot now

[email protected]:~$ Connection to 192.168.122.14 closed by remote host.
Connection to 192.168.122.14 closed.
...
[email protected]:~$ show system image 
The system currently has the following image(s) installed:

   1: 1.3-XX (default boot) (running image)
   2: 1.3-rolling-202009230118

[email protected]:~$
Viacheslav changed the task status from Open to Backport candidate.Sep 26 2020, 2:33 PM

Testing on crux

[email protected]:~$ show version 
Version:          VyOS 1.2.5

[email protected]:~$ add system image https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso
Trying to fetch ISO file from https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  309M  100  309M    0     0  5664k      0  0:00:55  0:00:55 --:--:-- 7157k
ISO download succeeded.
Checking for digital signature file...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (22) The requested URL returned error: 404 Not Found
Unable to fetch digital signature file.
Do you want to continue without signature check? (yes/no) [yes] 
Checking MD5 checksums of files on the ISO image...OK.
Done!
What would you like to name this image? [1.3-rolling-202009261346]: 1.3-XX
OK.  This image will be named: 1.3-XX
Installing "1.3-XX" image.
Copying new release files...
Would you like to save the current configuration 
directory and config file? (Yes/No) [Yes]: 
Copying current configuration...
Would you like to save the SSH host keys from your 
current configuration? (Yes/No) [Yes]: 
Copying SSH keys...
Running post-install script...
Setting up grub configuration...
Done.
[email protected]:~$ reboot now
Connection to 192.168.122.33 closed by remote host.

After upgrade

[email protected]:~$ show version 

Version:          VyOS 1.3-rolling-202009261346
Release Train:    equuleus

[email protected]:~$ show system image 
The system currently has the following image(s) installed:

   1: 1.3-XX (default boot)
   2: "1.2.5"

[email protected]:~$

I can't set to boot image 1.2.5

[email protected]:~$ set system image default-boot 
Possible completions:
  <Enter>       Execute the current command
  "1.2.5"       Default boot image name
  1.3-XX


[email protected]:~$ set system image default-boot 1.2.5
Version 1.2.5 not found.

[email protected]:~$ set system image default-boot "1.2.5"
Version 1.2.5 not found.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.