Run a script automatically when booting a live version of Ubuntu form a USB stick

5,063

Solution 1

You can use mkusb to create a persistent live bootable ubuntu usb. After that, just add your script under Startup Applications.

It will remember these changes at your next boot.

Solution 2

Here is a good page about LiveCD Customization, which is what you probably want.

When building the new LiveCD, you can treat the startup issue like you would a normal install, and edit your /etc/rc.local to include the commands you want to run on every boot. Make sure that you don't include sudo commands, and it has to exit successfully.

Share:
5,063

Related videos on Youtube

Forivin
Author by

Forivin

For-loops are cool. :)

Updated on September 18, 2022

Comments

  • Forivin
    Forivin over 1 year

    I have a Ubuntu install USB stick. I never use it to actually install Ubuntu, I always select the live option (no install). Now there are multiple commands that I always have to run once it has completely booted up. I'm looking for a sort of .bashrc file on the USB stick that always gets executed once the system is up and ready. I read a lot about preseed files, but from what I understand, all that stuff only applies if you're actually installing Ubuntu. https://help.ubuntu.com/community/InstallCDCustomization

    Any ideas?

    • Robby1212
      Robby1212 almost 7 years
      Another option would be to leave space on your Live disk for installed apps, then install crontab and have it run scripts upon startup.
  • Forivin
    Forivin almost 7 years
    There doesn't seem to be an /etc directory on the USB stick.
  • Grayson Kent
    Grayson Kent almost 7 years
    If you follow the steps in that link, the etc dir will be under the edit/etc dir of the downloaded iso.