Installation

How to solve this Splunk upgrade error?

myskyvideo
Explorer

Received the below error after answering "y" to Perform migration and upgrade without previewing configuration changes? [y/n] y.

 

-- Migration information is being logged to '/opt/splunk/var/log/splunk/migration.log.2022-07-06.23-37-40' --

Migrating to:
VERSION=9.0.0
BUILD=6818ac46f2ec
PRODUCT=splunk
PLATFORM=Linux-x86_64

Copying '/opt/splunk/etc/myinstall/splunkd.xml' to '/opt/splunk/etc/myinstall/splunkd.xml-migrate.bak'.

An unforeseen error occurred:

Exception: <class 'PermissionError'>, Value: [Errno 13] Permission denied: '/opt/splunk/etc/myinstall/splunkd.xml-migrate.bak'

Traceback (most recent call last):
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/cli.py", line 1359, in <module>
sys.exit(main(sys.argv))
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/cli.py", line 1212, in main
parseAndRun(argsList)
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/cli.py", line 1067, in parseAndRun
retVal = cList.getCmd(command, subCmd).call(argList, fromCLI = True)
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/cli.py", line 293, in call
return self.func(args, fromCLI)
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/control_api.py", line 35, in wrapperFunc
return func(dictCopy, fromCLI)
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/_internal.py", line 189, in firstTimeRun
migration.autoMigrate(args[ARG_LOGFILE], isDryRun)
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/migration.py", line 3158, in autoMigrate
comm.copyItem(PATH_SPLUNKD_XML, PATH_SPLUNKD_XML_BAK, dryRun)
File "/opt/splunk/lib/python3.7/site-packages/splunk/clilib/cli_common.py", line 1086, in copyItem
shutil.copy(src, dst)
File "/opt/splunk/lib/python3.7/shutil.py", line 248, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/opt/splunk/lib/python3.7/shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/opt/splunk/etc/myinstall/splunkd.xml-migrate.bak'

Labels (1)
0 Karma
1 Solution

VatsalJagani
SplunkTrust
SplunkTrust

@myskyvideo - Very likely permission issue. 

The <user> does not have ownership of the to /opt/splunk directory.

  • You can use chown -R <user>:<user-group> /opt/splunk command to achieve that.

 

Here <user> refers to the Linux username you are using to run Splunk service and splunk commands.

 

I hope this helps!!!

View solution in original post

myskyvideo
Explorer

Correct, it was permission issue. I did change the ownership, restarted Splunk  and the upgrade worked.

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Typically permission issues come from inconsistency in launching splunk and/or editing splunk files. If you switch between root and your $SPLUNK_USER a lot you're bound to sooner or later run the service with wrong user and have it create files/dirs with wrong ownership. Especially if you don't use systemd.

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@myskyvideo - Very likely permission issue. 

The <user> does not have ownership of the to /opt/splunk directory.

  • You can use chown -R <user>:<user-group> /opt/splunk command to achieve that.

 

Here <user> refers to the Linux username you are using to run Splunk service and splunk commands.

 

I hope this helps!!!

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Laser Bananas and Edge Hubs: Exploring Operational Technology (OT) Data Through a ...

  OT is a different environment to traditional IT and can have interesting challenges when interfacing the ...

Event Series: Mastering AI Tokenomics and Splunk Agent Observability

Beyond the Black Box: Correlating AI Performance and Tokenomics with Splunk Agent Observability   As ...

span_metrics: The OpenTelemetry-Idiomatic Way to See Inside Your Services

You open a trace in Splunk Observability Cloud and everything looks fine. One root span, order-pipeline, with ...