Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7790077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:28:50+00:00 2026-06-01T21:28:50+00:00

So I have three installers for NVIDIA’s CUDA API — the first is a

  • 0

So I have three installers for NVIDIA’s CUDA API — the first is a driver and comes with nice silent install flag options (but you have to be root and have to have run level 3).

The second two follow are shown manually installing below (cut out the long mess of install afterwards for brevity)

[root]# sh cudatoolkit_4.1.28_linux_64_rhel5.x.run Verifying archive
integrity… All good. Uncompressing NVIDIA
CUDA……………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………
Enter install path (default /usr/local/cuda, ‘/cuda’ will be
appended):
A previous version of CUDA was found in /usr/local/cuda/bin
Would you like to uninstall? (yes/no/abort): yes

In other words, I need to recognize:
“Enter install path” and output a ‘\n’

Now the tricky part is the uninstall may not be always be there. If it’s not I need to simply wait for the install to finish, but if I see “Would you like to uninstall?” I need to output “yes” to complete.

The third and final installer’s output is shown below….

[root]# sh gpucomputingsdk_4.1.28_linux.run
Verifying archive
integrity… All good.
Uncompressing NVIDIA GPU Computing

SDK………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………

Enter install path (default ~/NVIDIA_GPU_Computing_SDK):
/usr/local/CUDA_SDK

Located CUDA at /usr/local/cuda
If
this is correct, choose the default below.
If it is not correct,
enter the correct path to CUDA

Enter CUDA install path
(default /usr/local/cuda):

For this one, there is no uninstall action so it’s seemingly a bit simpler.

I just need to detect “Enter install path” and output “/usr/local/CUDA_SDK\n” and then detect “Enter CUDA install path” and output “\n”

My idea was to use a pair of expect scripts — one for each installer — but due to the nesting within the double quotes of the command to switch to root, I’m having some difficulties with this. What I currently have is:

#!/bin/bash
CR="\"\n\""
YES="\"Yes\""
INSTALL_PATH_REQUEST="\"Enter install path\""
CUDA_PATH_REQUEST="\"Enter CUDA install path\""
UNINSTALL_REQUEST="\"Would you like to uninstall?\""
TOOLKIT=`ls -t cudatoolkit* | head -n 1`
TOOLKIT_EXPECT="sh $TOOLKIT"
SDK=`ls -t gpucomputingsdk* | head -n 1`
SDK_INSTALL_PATH="\"/usr/local/CUDA_SDK\n\""
SDK_EXPECT="sh $SDK"
/bin/su root -c "yum -q -y install expect expectk;
/sbin/init 3; sh `ls -t NVIDIA*|head -n 1` -s --update -a -X;
/usr/bin/expect <<EOF;
spawn $TOOLKIT_EXPECT
expect $INSTALL_PATH_REQUEST
send $CR
expect $UNINSTALL_REQUEST
send $YES
EOF
/usr/bin/expect <<EOF;
spawn $SDK_EXPECT
expect $INSTALL_PATH_REQUEST
send $SDK_INSTALL_PATH
expect $CUDA_PATH_REQUEST
send $CR
EOF
/sbin/init 5"

This switches to root properly (once the password is entered) and installs the driver with the built in options correctly. It then appears to spawn the second install process and enter the first argument (a carriage return), but seems to exit the second installer prematurely (e.g. I don’t see the “yes” option.).

I feel like I’m pretty close, hopefully somebody can point me to where I’m going wrong and suggest the correct syntax.

NOTES:
I added the yum install command, as some of the machines I’m installing on didn’t have expect (stock CentOS 6), so that saves me the trouble there….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:28:53+00:00Added an answer on June 1, 2026 at 9:28 pm

    Might be an issue with timeout here… not sure how long the installer takes.
    The default expect timeout is 10 seconds, if it doesn’t see the expected text in that time, it will proceed regardless, you could change the timeout values like so:

    expect -timeout 100 $INSTALL_PATH_REQUEST
    

    Also change your $YES from

    YES="\"Yes\""
    

    To:

    YES="\"Yes\r\""
    

    (Best to use \r instead of \n in $CR too)

    It’s also a good idea to expect some ‘safety string’ at the end of the install, for example:

     expect -timeout 320 "Install Complete."
    

    So the expect script doesn’t terminate before the spawned process is complete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code I have inherited is using the three Entity Framework installers from here:
I have installed SQL Server 2005 three times now on the same box. I
Have three classes User, Group and Field. Many to many relationship on User /
Have three divs in a container that I want to float over a large
I have three tables A: A.pID primary key, A.Name nvarchar(250) B: B.pID primary key,
I have three tables: videos, videos_categories, and categories. The tables look like this: videos:
I have three column in my datagridview .One is text ,one is Combo and
I have three computers on my LAN, one running ubuntu , one running openSuse
I have three files: one called sql.php witch has a class db that I
I have created MSI installers for programs compiled with Visual C++ 2008 Express edition

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.