Mount issues with external USB drive in /etc/fstab

Here is info on my Raspberry Pi 3 installation of Kolibri 0.13.
Kolibri Info
Version: 0.13.1
OS: Linux-4.19.97-v7±armv7l-with-debian-10.3
Python: 3.7.3
Installer: kolibri(apt) with kolibri-server Version: 0.3.6-0ubuntu1
Server: nginx/1.14.2
Database: /home/pi/.kolibri/db.sqlite3
Device name: kolibri
Free disk space: 1 GB
Server time: Wed Apr 15 2020 16:19:49 GMT-0500 (Central Daylight Time)

I creaded a new user ‘aamin’ from the Kolibri web browser after connecting with 10.10.10.10:8080.
I had used a USB (SD card reader) with content of several channels on a Windows 10 installation. I plugged this USB to the Raspberry Pi 3 and I could see the content directory. However, I am not able to find home directory for ‘aamin’ on the default /dev SD card. There is only ‘pi’ directory for the super use admin ‘pi’ which was created when I installed Kolibri 0.13 image. What am I missing? I don’t see any clear error message.

Another issue I have noticed is that when I reboot the system with my USB already plugged in it hangs during the mount of /media/sdb. I am foreced to remove this USB for a successful reboot. After that I can plug the USB and can see it mounted as expected and .kolibri directory, etc.
I hope you can help to resolve this issue. My objective is the place this USB content directory under the /home/aamin or wherever the admin directory is hidden.

Thanks.

@aamin49tx Thanks for sharing your concern.

User ‘aamin’ is just a Kolibri user and not created in Raspian.

Assuming that you have exported the content from your Windows 10 installation using this export process, you next need to import the content using this import process.

The Kolibri data and configurtion will be located at /home/pi/.kolibri but copying the .kolibri folder’s contents directly from the Windows installation is not recommended.

Eventually you may like to do this to avail more storage for your setup.

As for the reboot issue, I don’t have any inputs as yet.

1 Like

Hi @aamin49tx

I understand that your objective is to locate Kolibri content on a larger, external drive attached to your Raspberry Pi. That’s a very normal objective, and following the guide that @shrenik just pointed to should get you there, and please ask if you need help with those steps :slight_smile:

There can be many origins for this cause. How have you added the partition of the USB drive as a partition to be mounted during boot? Is it listed in /etc/fstab?

Benjamin,
I did not have any entry for the USB drive. So I followed some documentation to insert an entry in /etc/fstab. Here what I did:

pi@kolibri:/media/Kolibri $ df -l
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/root        3546944  1834840   1527832  55% /
devtmpfs          469540        0    469540   0% /dev
tmpfs             474148        0    474148   0% /dev/shm
tmpfs             474148    12328    461820   3% /run
tmpfs               5120        4      5116   1% /run/lock
tmpfs             474148        0    474148   0% /sys/fs/cgroup
/dev/mmcblk0p1    258095    53465    204630  21% /boot
tmpfs              94828        0     94828   0% /run/user/1000
/dev/sda1       62366716 34112544  28254172  55% /media/Kolibri

pi@kolibri:/media $ lsblk -f
NAME        FSTYPE LABEL   UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda
└─sda1      ntfs   Kolibri 52F47707F476ED1B                         27G    55% /media/Kolibri
mmcblk0
├─mmcblk0p1 vfat   boot    8A14-B324                             199.9M    21% /boot
└─mmcblk0p2 ext4   rootfs  221abe1d-58b7-47d3-87e0-af7a6678ada3    1.5G    52% /

I edited (with vi) /etc/fstab to insert the last line shown below.

pi@kolibri:/media $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=b8f07ed9-01  /boot           vfat    defaults          0       2
PARTUUID=b8f07ed9-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
UUID=52F47707F476ED1B /media/Kolibri ntfs defaults 0 0
pi@kolibri:/media $ sudo reboot -f

Well, I now cannot do anything.It is giving me the following message on the attached monitor.

You are in emergency mode...
Cannot open access to console, the root account is locked.
Press Enter to continue
Reloading system manager configuration.
Starting default target
You are in emergency mode.

It is in the above loop. I turned off the power and tried with and without the USB plugged in.

Hope there is a way to correct any mistakes!

Thanks.

It seems that your /etc/fstab is invalid. When you log into emergency mode, try to edit it by commenting out the added line. You can also take out the SD card and edit it on another computer?

When editing /etc/fstab, it’s dangerous to reboot! Instead, run sudo mount -a to verify the syntax of /etc/fstab and mount any unmounted partitions.

From the above procedure, I would guess that one error could be that /media/Kolibri did not exist when the system had rebooted. That folder is created by udev when it auto-mounts your USB drive. Try replacing /media/Kolibri with /mnt/kolibri and create /mnt/kolibri on disk. It’s more normal to have permanently mounted disks in /mnt. To create that directory, run:

sudo mkdir -p /mnt/kolibri

After this, edit your /etc/fstab and try running sudo mount -a to see if there are errors?

I edited your first post to fix the syntax - you can use triple backticks ``` to start and end literal blocks (code blocks) or use the shortcut button “</>” in the toolbar above the input field. No worries about not getting that right the first time :slight_smile:

But, how do I get control of the keyboard? In the current situation, I am unable to interrupt to boot process and get access at any stage of the system. Are there any special keys I need to use during the boot process?
Thanks.

Try this resource regarding the emergency console: emergency mode after editing fstab - Raspberry Pi Forums

As I said, you can also mount the SD card on another computer as a quicker method?

You can also take out the SD card and edit it on another computer

Well, I decided to reinstall the Kolibri 0.13 image. This time I did not try to auto-mount the USB. It is just inconvenient to unplug the USB prior to reboot and them plug. I believe; this is a bug in the system software. Also, I used a larger SD card (64 GB) to allow enough space to install a few channels without the use of an external USB. I am in the process of downloading a few of the channels directly from internet. It will be nice to share channel content between two installations without the need to export or import. May be this can be added as an enhancement for future Kolibri.

I will keep posted if I encounter issues.

Thanks!

Benjamin,
I tried to follow your suggestion and modified the /etc/fstab as shown below after verifying manual mount. See the details below. Once again, I got stuck in the emergency loop. I am unable to recover.
Is there a way to interrupt the boot and get control of the system and fix the /etc/fstab? I would appreciate any pointers. We need to have an option on how to recover regardless of the underlying changes. Thanks.

pi@kolibri:/etc $ sudo lsblk -f
NAME        FSTYPE LABEL   UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda
└─sda1      ntfs   Kolibri 52F47707F476ED1B                         27G    55% /mnt/Kolibri
mmcblk0
├─mmcblk0p1 vfat   boot    8A14-B324                             199.9M    21% /boot
└─mmcblk0p2 ext4   rootfs  221abe1d-58b7-47d3-87e0-af7a6678ada3   42.1G    24% /
pi@kolibri:/etc $ sudo vi fstab
pi@kolibri:/etc $ !ca
cat fstab
proc            /proc           proc    defaults          0       0
PARTUUID=b8f07ed9-01  /boot           vfat    defaults          0       2
PARTUUID=b8f07ed9-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
UUID=52F47707F476ED1B /mnt/Kolibri ntfs defaults 0 0
pi@kolibri:/etc $ ls -la /mnt/Kolibri
total 12
drwxrwxrwx 1 root root 4096 Apr 16 20:38  .
drwxr-xr-x 3 root root 4096 Apr 25 15:50  ..
drwxrwxrwx 1 root root    0 Apr 16 09:35  .gnupg
drwxrwxrwx 1 root root 4096 Apr 17 07:03  .kolibri
drwxrwxrwx 1 root root    0 Apr 20 16:43  KOLIBRI_DATA
drwxrwxrwx 1 root root    0 Apr 16 07:42 'System Volume Information'
pi@kolibri:/etc $ sudo reboot -f

Hi @aamin49tx

So far so good! I’m wondering if this is because of the NTFS filesystem: This filesystem is a bit sensitive for external storage media. For instance, it often indicates that it’s been unmounted uncleanly and refuses to mount. There are also issues with write permissions being off by default.

If you can consider using FAT or EXT, those are far better options.

There are reported issues very similar to yours here: https://www.raspberrypi.org/forums/viewtopic.php?t=116834 – you might be able to fix your issue by switching to ntfs-3g.

I can’t really help anymore with this particular NTFS filesystem issue, I think it’s better to raise this in a Raspberry Pi forum.

If you find yourself installing a different version of Raspbian or starting from scratch, there is a tutorial for installing Kolibri on Raspberry Pi here: https://kolibri.readthedocs.io/en/latest/install/raspberry_pi_manual.html

Thanks Benjamin!
Well, I am still at loss about how to recover from a faulty boot going in a emergency mode loop. Meanwhile, I managed to workaround the problem. I had a original NOOBs sd card to boot the system. Then I used the kolibri boot card as a USB drive. This allowed me to edit the /etc/fstab to comment out the USB mount command.
Following your suggestion I used FAT format for the USB drive and edited the /etc/fstab appropriately as shown here:

pi@kolibri:/mnt/Kolibri/test $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=b8f07ed9-01  /boot           vfat    defaults          0       2
PARTUUID=b8f07ed9-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
UUID=28EC-0083 /mnt/Kolibri vfat defaults 0 0
pi@kolibri:/mnt/Kolibri/test $ lsblk -f
NAME        FSTYPE LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sdb
└─sdb1      vfat          28EC-0083                              59.5G     0% /mnt/Kolibri
mmcblk0
├─mmcblk0p1 vfat   boot   8A14-B324                             199.9M    21% /boot
└─mmcblk0p2 ext4   rootfs 221abe1d-58b7-47d3-87e0-af7a6678ada3    9.8G    79% /
pi@kolibri:/mnt/Kolibri/test $

I run into the same exact problem once again. So, the issue seems to be beyond the USB format.Perhaps, you can escalate these issues to the right developer. Note that I am identifing two different issues.

  1. How to correctly mount USB drive using /etc/fstab entry.
  2. How to interrupt the emergency mode loop and get control of the system to edit files triggering boot fault.
    For now, I will manage manual USB auto-mount option.
    Thanks.

Hi @aamin49tx

It’s great to hear that the emergency mode is no longer stopping you completely from working with the system.

I wonder a bit why the UUIDs of your SD card differ in /etc/fstab and lsblk -f output.

Could you try running ls -lha /dev/disk/by-uuid to see if you get different UUID entries and try the one for /etc/sdb1?

You could also entirely replace UUID=28EC-0083 with /dev/sdb1 in /etc/fstab, but this solution may break if you attach more USB storage during boot (as the device entry may change).

They do match for the external USB drive which I am focusing on. The Linux documentation also requires the use of UUID.

pi@kolibri:/mnt/Kolibri/test $ cat /etc/fstab
UUID=28EC-0083 /mnt/Kolibri vfat defaults 0 0
pi@kolibri:/mnt/Kolibri/test $ lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sdb
└─sdb1 vfat 28EC-0083 59.5G 0% /mnt/Kolibri
mmcblk0

I have spent so much time on these experiments that it is time that an expert looks at this issue.
Hope you have a way to find the right person to work on the issues I am highlighting. Thanks again!

Hi @aamin49tx

It is true that /mnt/Kolibri has the UUID of lsblk, but look at the UUID of /boot and / – that’s not the same as what you get in lsblk.

What is the output of ls -lha /dev/disk/by-uuid ?

Hope you have a way to find the right person to work on the issues I am highlighting.

I suggest that you check out the Raspberry Pi forums: Raspberry Pi Forums - Index page

OK. I will checkout the Raspberry forumm. Here is the requested information:
pi@kolibri:~ $ ls -lha /dev/disk/by-uuid
total 0
drwxr-xr-x 2 root root 100 Apr 27 05:39 .
drwxr-xr-x 7 root root 140 Apr 26 19:17 …
lrwxrwxrwx 1 root root 15 Apr 26 19:17 221abe1d-58b7-47d3-87e0-af7a6678ada3 -> …/…/mmcblk0p2
lrwxrwxrwx 1 root root 10 Apr 27 05:39 28EC-0083 -> …/…/sda1
lrwxrwxrwx 1 root root 15 Apr 26 19:17 8A14-B324 -> …/…/mmcblk0p1
pi@kolibri:~ $ lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
└─sda1 vfat 28EC-0083 59.5G 0% /media/sda1
mmcblk0
├─mmcblk0p1 vfat boot 8A14-B324 199.9M 21% /boot
└─mmcblk0p2 ext4 rootfs 221abe1d-58b7-47d3-87e0-af7a6678ada3 9.8G 79% /
pi@kolibri:~ $ df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 61080124 48346680 10211928 83% /
devtmpfs 469540 0 469540 0% /dev
tmpfs 474148 0 474148 0% /dev/shm
tmpfs 474148 12296 461852 3% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 474148 0 474148 0% /sys/fs/cgroup
/dev/mmcblk0p1 258095 53466 204629 21% /boot
tmpfs 94828 0 94828 0% /run/user/1000
/dev/sda1 62351456 160 62351296 1% /media/sda1