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!!!

Get Updates on the Splunk Community!

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...