How can I save a file and/or print to PDF from Ubuntu running on usb?

I’m loading Ubuntu from a usb bootloader on my Windows 11 pc.

From that instance of Ubuntu I’m running an app that generates a file. I’m just trying to save it and/or print it to a pdf.

I tried saving it to the usb that I’m running Ubuntu from and creating a shared folder on my pc and neither of those worked.

This doesn’t seem like this should be that hard. Any ideas?

Thanks.

What app and what file type?

Check the USB is not in read-only mode.

From a terminal on the USB run this:
lsblk -o NAME,MOUNTPOINT,RO

If it shows RO=1 then it is read only.

Also check how much space there is with df -h

We need more details of exactly what you have done so far.
You can not save anything to the USB from which you are running the live system unless you have created a persistent live USB which you can only do when actually creating the live USB, not afterwards as far as I’m aware.

You should be able to save to your PC though if running Ubuntu on that you will have to make sure the permissions of the PC hard disk allow you to write.

Possibly the simplest method to do what you want may be to use another USB flash drive then use that to move the file wherever you want.

Ok so I tried multiple times running that command and I couldn’t get it to work. I’m clearly not formatting it right. Here is a screenshot after typing in lsblk.

It’s an app called Superbacked and since I can’t get the file to save, I don’t know the exact file type. It doesn’t show that as you are saving it. I know that sounds weird. I would also be happy if I could just send it to a printer as a pdf file.
Here is the program I am using:
https://superbacked.com/docs/how-to-run-superbacked-os-on-intel-computer#ubuntu-or-other-debian-based-os

Thanks.

I can’t even access my PC as I am running the program in Ubuntu.

I thought about that, but my PC only has 1 usb port.

Thanks.

The behavior you explain is expected with a typical Linux written to a usb which would generally be referred to as a ‘live’ system meaning read-only. Typically, software used to write a Linux iso to a USB/DVD will make it read-only. There is some software that will allow persistence as mentioned above. You can use a ‘live’ Linux on a USB/DVD, save files, make changes and keep them as long as you do NOT reboot the system. As a windows user, this would be an alien concept as nothing like that exists in windows.

There is no reason you should not be able to copy a file from the USB to a partition filesystem on your hard drive or print to pdf.

You might explain how you put Ubuntu on the USB, what software method you used since it is possible to do a complete install on a USB.

Ok that makes sense. First time ever trying this stuff so it is a bit confusing and new at first.

Here is the program/steps I used to create the Ubuntu on USB:
https://superbacked.com/docs/how-to-run-superbacked-os-on-intel-computer#ubuntu-or-other-debian-based-os

It’s a program that lets you encrypt information into a QR code. So I don’t know the native format file system that would be saved in. I can’t save the file so I can’t see the file type.

Thank You.
I’m open to any ideas on saving the file and/or gettting it to print to a PDF.

I’ve never heard of ‘Superbacked OS’ and never used a Raspberry PI. I see on their site they recommend removing all drives from the computer. Not sure what the purpose is as it refers to a particular type of camera.

It mentions enabling ‘Kanguru FlashTrust’ which would enable write protection which would not allow you to write to it. Did you do this? I expect you would have better luck with this by reading through the Docs and FAQ on their site.

1 Like

Yes that special flash drive and removing those components is optional and I know why they recommend it.

I did everything they say in those steps and program works perfectly. I just need to save or print the file. Pretty crazy how hard this is to achieve.

I’ve read all the docs and faqs. They don’t explain how to save or print.

Thanks.

But if you did what @yancek said above it means you explicitly disabled any possibility write to disk, so it sounds like this is exactly the expected and desired behavior …

You should really ask the providers of that software how you are supposed to save anything after you turned off all abilities to do so on a low level …

Ok yes I get what you saying, but all of that stuff is optional. I’ve seen them say you don’t have to do any of that.

But……even from them……they do suggest printing it out or printing to a pdf file.

Saving the file is secondary, but I still wanted to have a copy of it.

The program is looking for a printer when I click print. There has got to be a way to have it detect a printer somehow.

You mean the system print dialog does not detect a printer ? Or does the print dialog not come up at all when you click on “Print” in the app ?

(If it is the first, this might be caused by you making the drive read-only so that cups can not write temporary files, if it is the latter that smells like a bug in the app …)

If you often need to save files from live you can create a share partition on your PC that can be written by everyone

Screenshot From 2025-03-29 15-20-35

Only comes up asking me to choose a printer, but I don’t have one.

What is CUPS? Can I install that?

Ok I’m going to look into doing this. Thanks.

Cups is the system on your OS to manage printers, it is installed by default and is what shows you the printer dialog when you click a print button in any app…

The print dialog usually has an option to select “print to file” which will produce a PDF in the location you select after picking “print to file”, but when you made the whole USB key read only with the tools described above this will indeed not work…

OK I’ve never heard of it before. Yes it does not bring up “print to file”.

So if I had an actual printer in my room, then it would recognize it and connect more than likely because it is asking me where I want to print it to.

So if I don’t have a printer, can’t I use a second computer to act as a PDF printer?

Does this make sense as far as setting up that partition?

Steps to Set Up the Partition:

1. Prepare Your USB Drive

You’ll need:

  • A USB drive (at least 8GB recommended, 16GB+ is better).
  • The Ubuntu ISO (e.g., Ubuntu 24.04 LTS).
  • A partitioning tool like GParted.
  • A tool to create a bootable USB, like Rufus (Windows) or dd (Linux).

2. Create a Bootable USB Drive

Use a tool like Rufus (Windows) or Ventoy (if you want multiboot) to create a bootable Ubuntu USB.

Using Rufus (Windows)

  1. Insert your USB.
  2. Open Rufus, select the Ubuntu ISO.
  3. Choose Persistent partition size (if supported).
  4. Click Start to create the USB.

Using Linux (dd Command)

If using Linux, run:

bash

CopyEdit

sudo dd if=ubuntu-24.04.iso of=/dev/sdX bs=4M status=progress

(Replace /dev/sdX with your USB drive ID, e.g., /dev/sdb.)


3. Create a Persistent Storage Partition

Once your USB is bootable, add a partition for persistent storage.

Using GParted:

  1. Open GParted and select your USB drive (/dev/sdX).
  2. Shrink the main Ubuntu partition to make space for persistence (e.g., shrink it to 4GB if you have an 8GB USB).
  3. Create a new ext4 partition in the free space:
  • Label it “writable” (important!).
  • Set it as ext4 or ext3 (not NTFS/FAT).
  1. Apply changes and close GParted.

4. Enable Persistence

To make Ubuntu recognize the persistence partition:

  1. Mount the USB root partition and open /boot/grub/grub.cfg (for UEFI) or /syslinux/syslinux.cfg (for BIOS).
  2. Find the boot entry for Ubuntu and add this to the kernel line:

matlab

CopyEdit

persistent
  1. Save and close the file.

5. Boot with Persistence

  • Restart your PC and boot from the USB.
  • You should now be able to save files, install apps, and retain settings across reboots!

No, that describes how to make a live USB stick with persistent storage, I think what @corradoventu meant was to just make a partition of your PC disk available to the live OS and to use this to store the file …

If you go the persistent USB stick route the “Kanguru FlashTrust” protection will prevent you from writing to your persistent USB stick regardless so persistence will not help …

Regarding the print dialog, is this not what you are seeing ? (this is the default print dialog of the system):

Just out of curiosity, is the printer you are trying to use wireless?

Because if you followed all the steps to airgap the live environment, that means the device will not have access to the printer regardless of what you do now?