rmarques
Posts: 19
Joined: Sun Jan 29, 2017 12:46 pm

No space left after booting ubuntu from USB stick

Sat May 15, 2021 11:23 pm

Hello, I have a raspberry pi 4, 4GB of RAM that I have been using for hosting a development server running ubuntu on a SD card.
In the past 4 months or so, the card was corrupted two times beyond repair and I started looking into booting from a USB stick.
From my understanding, newer versions of the RPi4 board already ship with a bootloader in the firmware that takes care of checking if there are USB bootable sticks plugged in and I bought the raspberry in the beginning of the year 2021.

Regardless, I followed https://www.raspberrypi.org/documentati ... this guide to update the bootloader to the most recent version, using raspberry pi imager. In summary, I flashed an SD card with a program which sole purpose was to update the bootloader firmware and eeprom configurations, plugged it into the Pi and turned it on, waited 30 seconds and unplugged it.

I then did the same thing with a USB stick, using raspberry pi imager, but this time flashed ubuntu server 21.04 64-bit on a USB stick and plugged it into the Pi, removed the card and turned it on again. After checking the IP in my router, I could connect to it using SSH. Still, when trying to make a directory in my home using mkdir, I got

ubuntu@ubuntu:~$ mkdir test
mkdir: cannot create directory ‘test’: No space left on device

Did I understand something wrong? Here is the output of fdisk:

ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/loop0: 48.91 MiB, 51286016 bytes, 100168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 28.05 MiB, 29413376 bytes, 57448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 60.59 MiB, 63537152 bytes, 124096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 57.75 GiB, 62008590336 bytes, 121110528 sectors
Disk model: DataTraveler 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb59eb0cd

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/sda2 526336 121110494 120584159 57.5G 83 Linux

I appreciate the help of all the staff of the raspberry pi foundation in the forums and all the friendly volunteers answering these questions. A big thumbs up to you!

User avatar
kerry_s
Posts: 2090
Joined: Thu Jan 30, 2020 7:14 pm

Re: No space left after booting ubuntu from USB stick

Sun May 16, 2021 12:29 am

i think you connected to soon.
first boot it expands, then reboots.

KeithMck
Posts: 235
Joined: Thu Dec 31, 2020 10:58 am

Re: No space left after booting ubuntu from USB stick

Sun May 16, 2021 8:57 am

As above, most distros for the RPi will resize your filesystem on the first boot, then reboot into the expanded filesystem - it only happens the once, when you use a newly flashed drive.

rmarques
Posts: 19
Joined: Sun Jan 29, 2017 12:46 pm

Re: No space left after booting ubuntu from USB stick

Sun May 16, 2021 6:51 pm

I retried flashing ubuntu on a USB stick and plugging it into the Pi. It has been refusing connection when I try to ssh into it for ~30 minutes, is this normal? How much time does it normally take to expand a usb3 64gb USB stick?

cleverca22
Posts: 3744
Joined: Sat Aug 18, 2012 2:33 pm

Re: No space left after booting ubuntu from USB stick

Sun May 16, 2021 7:36 pm

rmarques wrote:
Sun May 16, 2021 6:51 pm
I retried flashing ubuntu on a USB stick and plugging it into the Pi. It has been refusing connection when I try to ssh into it for ~30 minutes, is this normal? How much time does it normally take to expand a usb3 64gb USB stick?
did you enable ssh yet?

rmarques
Posts: 19
Joined: Sun Jan 29, 2017 12:46 pm

Re: No space left after booting ubuntu from USB stick

Mon May 17, 2021 7:38 am

Initially I was putting an SSH file, no content and no extension, in the boot partition of the USB stick, but I read somewhere that ubuntu did not need that, only raspbian. Is that correct? If it is and I should enable SSH some other way in ubuntu, how do I do it?

User avatar
B.Goode
Posts: 12059
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: No space left after booting ubuntu from USB stick

Mon May 17, 2021 9:32 am

rmarques wrote:
Mon May 17, 2021 7:38 am
Initially I was putting an SSH file, no content and no extension, in the boot partition of the USB stick, but I read somewhere that ubuntu did not need that, only raspbian. Is that correct? If it is and I should enable SSH some other way in ubuntu, how do I do it?


Perhaps the company responsible for developing and supporting that Operating System might know -

Canonical/Ubuntu Developer Contact information here -
viewtopic.php?f=131&t=254649&p=1556639& ... l#p1556639
This is probably the wrong place to discuss a lot of this; there's absolutely no point complaining to the fine folks at the Pi Foundation about Ubuntu. Bug me instead (see below for more information on how to bug Dave)!
As already mentioned by others, https://ubuntuforums.org/ and https://askubuntu.com/ are good places to ask about things like this.

blade777
Posts: 23
Joined: Thu Oct 29, 2020 2:49 am

Re: No space left after booting ubuntu from USB stick

Tue May 18, 2021 4:44 am

have you programed the boot loader eeprom correctly..

depending on the size of your stick and the type/make and usb type will all be factors of the performance outcome...to factor into the equation...

64 gig tend to take some time on initial resizing of the root file system...if you have a old stick then all-round performance will be lacking

tip

Code: Select all

lsusb

Code: Select all

lsusb -t
find the device id and add it into the cmdline.txt file browse how to do it it`s quite simple and may/prolly help a great deal of difference...
"how to boot from usb ssd M-2 on an rpi-4.
.etc..etc..read below...the code is the same for most storage devices...

EDIT:if you have used etcher before either on a Linux box or a win box .. then its quite simple dwnld the Ubuntu image ..
you can write an "ntfs " partition on to the usb stick beforehand if you like... with a windows machine and flash the image with etcher..or use gparted in linux to write a partition to it does not sound like your having much luck with fdisk...
but etcher does not discriminate in most cases will erase and or just write over what ever is on the flash drive..

the boot code i use is simple all i do is add this line whilst editing the eeprom file.... i put it at the top of the code list....

Code: Select all

BOOT_ORDER=0x4
save the file then write it to the eeprom next it most likely tell you that the machine needs to reboot if not after saving the file reboot it.....then it will write it to the rom during the reboot. you should have the ubuntu or whatever op sys you had on the sd-card in the machine. ...

once it reboots power it of remove sd-card and plug in your flashed usb stick..power it up..it should now boot from the usb drive ..
the rpi wont discriminate as to what op sys is on the stick for the most part all you will have set is the boot order.....the eeprom just tells the machine the boot order...+etc..etc.. .... whether you have Debian or linaro or even libre elec.. it does not make any difference it just tells the machine to look at the usb ports for bootable media...firstly..if it does not find any it will look next at the sd-card..


:::as i stated earlier it may boot faster off the usb 2 ports ..or it may not boot off the usb 3 ports.. ...the line added to the cmdline.txt file is now rather imperative...just browse how to boot from ssd on an rpi-4 ..basically there you will find a page that will tell all ..it will take me a while to look up the reference i used.. once i find it i shall add it to this thread..

the page may have used debian or the rpi op sys to rewrite the eeeprm.. depends what page you read and which instruction set you followed.. there are other op sys`s that can perform the eeprom rewrite..but no matter what software you had initially used it will all be command line work that needs to be coded..

Return to “Ubuntu”