adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.08k stars 1.2k forks source link

File system readonly on ubuntu #5521

Closed LovelyA72 closed 1 week ago

LovelyA72 commented 2 years ago

CircuitPython version

Adafruit CircuitPython 7.0.0-513-g65ffcf146 on 2021-10-22; SparkFun MicroMod RP2040 Processor with rp2040
Board ID:sparkfun_micromod_rp2040

Code/REPL

N/A

Behavior

The file system will appear as a read-only(write-protected) file system on ubuntu 20.04. This is happening on the nRF52840 and RP2040 Micromods. Not tested with AdaFruit RP2040 Feather yet.

The RPI-RP2 bootloader is not read-only. This is only happening on the CircuitPython managed drive.

Description

import storage
storage.remount('/', readonly=False)

in boot.py does not do the job.

Additional information

No response

dhalbert commented 2 years ago

I cannot reproduce this on an Adafruit Feather nRF52840, on Ubuntu 20.04.

Do you mean it is read-only to the host or read-only to CircuitPython code? If you do the storage.remount(), does it become read-write to CircuitPython?

Please try

import storage
storage.erase_filesystem()

to make sure the filesystem is not corrupted.

The SparkFun MicroMod boards use the W25Q128JVxM flash chip definition, which is only used on one other board we have builds for. It's possible there is something wrong with the flash definition.

LovelyA72 commented 2 years ago

After I wiped the file system, the drive is accessible again! How do I prevent such a thing from happening again? Because the issue is ubuntu only. Such an issue does not affect Windows.

dhalbert commented 2 years ago

To avoid filesystem corruption, if you are copying data to CIRCUITPY, do a sync afterwards. Linux eventually writes all the metadata to the drive, but it can take a few tens of seconds.

Many editors, but not all, do a "flush" after writing code. This section of the Welcome to CircuitPython guide discusses this issue in more detail: https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code#editing-code-2977443-13

schaefer01 commented 2 weeks ago

Hi, dhalbert,

Could I re-open this? I know how to reliably replicate the problem.

Reboot the host but don't log in at the terminal and display, log in by ssh as a remote user.

The login path of scripts run of a physical user vs login path of remote user are different and CIRCUITPY as a drive isn't by default mounted by ssh (but is by physical log in).

When you mount by mount command over an ssh, the default mount action is read only.

The problem is, if you have multiple remote devices all far away, it will be a pain to physcially go to the location to recover.

So, its a linux problem but I'm not enough of a linux person to figure out the solution.

Any help/pointers/etc?

bob s

bablokb commented 2 weeks ago

When you mount by mount command over an ssh, the default mount action is read only.

This is strange and certainly not "default" for Linux. I work with ssh on all kinds of Linux boxes and I never experienced this issue. It does not mean that there is not some voodoo added by Ubuntu that triggers this behavior.

Can you reproduce the issue on Ubuntu installations without graphical environment ("Ubuntu server")? If your boxes are remote, you should not need the graphical environment after all.

Do you mount with root or using sudo? Can you see anything in the logs (e.g. sudo journalctl -b)?

What I always recommend: add the following line to your /etc/fstab:

LABEL=CIRCUITPY      /whatever             auto       defaults,noauto,user,exec,utf8,noatime,sync     0 0

This will add the "sync"-option to the mount (very important!) and should also prevent auto-mounts (not because of the "noauto" - this prevents auto-mount during boot, but usually the automounters skip all drives that have an entry in the fstab). With this line in place, you can mount with mount -L CIRCUITPY (no need for sudo anymore because of the "user" option).

schaefer01 commented 2 weeks ago

hi, bablokb My IT person disagrees with you on the default setting. I'm just the middle-man app developer (please don't shoot the piano player :-). I have not tried this on a system without the GUI, we are not using that type of system, all our remote boxes are full-up linux boxes (whether for GPUs (jetson based) or low price rasbperry pi based (onlogic)). Mount has to be by sudo. My IT guy is hesitant to edit the /etc/fstab and I've asked/told him several times previous to this that this is the way to go. In fact he pointed me to this URL that I am replying to, suggesting that I erase my CIRCUTYPY drive and start over, which is counter factual that physically logging in at the console clears the problem.

I will relay what you say and push him a bit harder on /etc/fstab. Thank you.

dhalbert commented 2 weeks ago

@schaefer01 Which version of Linux and which desktop environment are you using?

bablokb commented 2 weeks ago

Just to clarify: are you using ssh and then mount locally on the remote machine, or do you use sshfs to locally mount a remote filesystem (a "share" in windows-speak) on your local machine?

schaefer01 commented 2 weeks ago

hi, Haven't checked journalctl, will do an experiment sometime today, my IT guy shows up later in the day too.

I'm running the bespoke dev board against a linux DELL laptop, basically pretesting because once the app is copied into the box, and the box is closed and placed, everything gets way more difficult to test. The remote lboxes will be the same linux version but there will be to-be-discovered differences because of differences that are related to the processor unit vendor choices (which is a different problem)

the first, ssh then sudo mount, NOT sshfs

GNOME 3.36.8

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal

schaefer01 commented 2 weeks ago

thank you all, I truly appreciate the help!

bablokb commented 2 weeks ago

This is definitely not a CircuitPython problem, but a problem of your system configuration. I just logged into a remote Pi system running a GUI, and mounted a Pico-W running CircuitPython without any problems:

The first command sudo lsblk... lists all the drives and you can see /dev/sdb1 as the Pico-W with CIRCUITPY. The second command sudo mount ... does the mount without any special options (and the device is not in /etc/fstab either). The third command sudo findmnt ... shows all the mount options and you can see the "rw" right at the beginning.

What you can also see is the option errors=remount-ro at the very end. This is the default and might be triggered by some errors on your systems. One other thing your IT guy should check: /etc/security/pam_mount.conf.xml.

What you could also run (if possible) is the equivalent of my mount command with an added strace: sudo strace mount /dev/sdb1 /mnt. Now this produces very much output and is hard to interpret unless you know what your are looking for, but that is the reason you have IT guys.

[bablokb@canopus:~] > ssh pi5
Linux pi5 6.6.31+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Sep 26 14:42:39 2024 from 10.xxx.xxx.xxx

[bablokb@pi5:~] > sudo lsblk -i -o NAME,FSTYPE,FSVER,LABEL
NAME        FSTYPE FSVER LABEL
sda                      
|-sda1      vfat   FAT32 alt-Boot
...
sdb                      
`-sdb1      vfat   FAT12 CIRCUITPY
mmcblk0                  
|-mmcblk0p1 vfat   FAT32 bootfs
...

[bablokb@pi5:~] > sudo mount /dev/sdb1 /mnt
[bablokb@pi5:~] > findmnt /mnt
TARGET SOURCE    FSTYPE OPTIONS
/mnt   /dev/sdb1 vfat   rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro
samblenny commented 2 weeks ago

@schaefer01 The permissions problem you describe sounds similar to trouble I had mounting CIRCUITPY over SSH with Debian 12. Debian and Ubuntu are similar enough that it might be the same problem. In my case, the solution was to use pmount and pumount.

I handled mounting and unmounting of CIRCUITPY with a Makefile including these rules:

# Path to CIRCUITPY on Debian
D_CPY=/media/CIRCUITPY

# Mount CIRCUITPY from Debian command line (works over ssh).
# You might need to do `sudo apt install pmount` before using this.
mount:
    @if [ ! -d ${D_CPY} ] ; then \
        pmount `readlink -f /dev/disk/by-label/CIRCUITPY` CIRCUITPY; else \
        echo "${D_CPY} was already mounted"; fi

# Unmount CIRCUITPY from Debian command line.
# You might need to do `sudo apt install pmount` before using this.
umount:
    @if [ -d ${D_CPY} ] ; then pumount CIRCUITPY; else \
        echo "${D_CPY} wasn't mounted"; fi

As best I could make out, the key difference between mounting removable media with R/W permissions for a non-root user over SSH vs. logged in locally to a GUI session has to do wwith polkit. When you log in for a local GUI session, you automatically get the necessary magic with dbus and whatever else so that you can get removable media permissions through polkit. Over SSH, using plain mount, the necessary polkit stuff doesn't get invoked. But, you can use pmount.

bablokb commented 2 weeks ago

This really boils down to the policy you have. You said "mount has to be by sudo". If this is true, then pmount won't help either, because this tool does not need sudo.

Another solution: since you have GUI boxes, why not use a vncviewer to connect? From a system perspective, this should then be a local login.

Anyway, there are multiple solutions to your problem. Your IT guy just has to pick one. Installing programs, changing polkit-configurations, adding a line to fstab, keep you walking around ...

schaefer01 commented 2 weeks ago

thank you all, I need to block out some time to try each. The "has to be by sudo" this is what I said but not exactly what I meant - not IT admin policy but OS response as in, "or else I get a permissions error message."

schaefer01 commented 1 week ago

two entries/comments, the first I tried everything but strace:

  1. journalctl -b | grep mount returns: Sep 30 08:29:41 nebula udisksd[1751]: mountpoint /media/rps/CIRCUITPY is invalid, cannot recover the canonical path Sep 30 08:29:41 nebula udisksd[1751]: Cleaning up mount point /media/rps/CIRCUITPY (device 8:1 is not mounted)

  2. pmount -w -s /dev/sda1 CIRCUITPY no errrors but mounted read only

  3. fstab I was unsupervised and put my laptop into a state where IT had to fix my computer by manually mounting the hard drive and commenting out my fstab entry

  4. strace wth pmount next entry

schaefer01 commented 1 week ago

strace pmount -w -s /dev/sda1 CIRCUITPY execve("/usr/bin/pmount", ["pmount", "-w", "-s", "/dev/sda1", "CIRCUITPY"], 0x7fff91b69410 / 30 vars /) = 0 access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory) brk(NULL) = 0x562c720ef000 archprctl(0x3001 /* ARCH??? */, 0x7fffee359e70) = -1 EINVAL (Invalid argument) fcntl(0, F_GETFD) = 0 fcntl(1, F_GETFD) = 0 fcntl(2, F_GETFD) = 0 access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory) access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=88292, ...}) = 0 mmap(NULL, 88292, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a30f000 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\266\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=351352, ...}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8b1a30d000 mmap(NULL, 354088, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8b1a2b6000 mprotect(0x7f8b1a2c0000, 290816, PROT_NONE) = 0 mmap(0x7f8b1a2c0000, 221184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f8b1a2c0000 mmap(0x7f8b1a2f6000, 65536, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x40000) = 0x7f8b1a2f6000 mmap(0x7f8b1a307000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x50000) = 0x7f8b1a307000 close(3) = 0 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|OCLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300A\2\0\0\0\0\0"..., 832) = 832 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\7\2C\n\357\243\335\2449\206V>\237\374\304"..., 68, 880) = 68 fstat(3, {st_mode=S_IFREG|0755, stsize=2029592, ...}) = 0 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\7\2C\n\357\243\335\2449\206V>\237\374\304"..., 68, 880) = 68 mmap(NULL, 2037344, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8b1a0c4000 mmap(0x7f8b1a0e6000, 1540096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f8b1a0e6000 mmap(0x7f8b1a25e000, 319488, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19a000) = 0x7f8b1a25e000 mmap(0x7f8b1a2ac000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f8b1a2ac000 mmap(0x7f8b1a2b2000, 13920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f8b1a2b2000 close(3) = 0 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8b1a0c1000 arch_prctl(ARCH_SET_FS, 0x7f8b1a0c1740) = 0 mprotect(0x7f8b1a2ac000, 16384, PROT_READ) = 0 mprotect(0x7f8b1a307000, 20480, PROT_READ) = 0 mprotect(0x562c71e0a000, 4096, PROT_READ) = 0 mprotect(0x7f8b1a352000, 4096, PROT_READ) = 0 munmap(0x7f8b1a30f000, 88292) = 0 brk(NULL) = 0x562c720ef000 brk(0x562c72110000) = 0x562c72110000 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=2996, ...}) = 0 read(3, "# Locale name alias data base.\n#"..., 4096) = 2996 read(3, "", 4096) = 0 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=369, ...}) = 0 mmap(NULL, 369, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a351000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=27002, ...}) = 0 mmap(NULL, 27002, PROT_READ, MAP_SHARED, 3, 0) = 0x7f8b1a31e000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_MEASUREMENT", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_MEASUREMENT", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=23, ...}) = 0 mmap(NULL, 23, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a31d000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_TELEPHONE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_TELEPHONE", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=59, ...}) = 0 mmap(NULL, 59, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a31c000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_ADDRESS", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_ADDRESS", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=167, ...}) = 0 mmap(NULL, 167, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a31b000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_NAME", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_NAME", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=77, ...}) = 0 mmap(NULL, 77, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a31a000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_PAPER", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_PAPER", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=34, ...}) = 0 mmap(NULL, 34, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a319000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=57, ...}) = 0 mmap(NULL, 57, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a318000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_MONETARY", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_MONETARY", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=286, ...}) = 0 mmap(NULL, 286, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a317000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_COLLATE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_COLLATE", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=2586930, ...}) = 0 mmap(NULL, 2586930, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b19e49000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_TIME", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_TIME", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=3284, ...}) = 0 mmap(NULL, 3284, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a316000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=54, ...}) = 0 mmap(NULL, 54, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a315000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=340640, ...}) = 0 mmap(NULL, 340640, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b19df5000 close(3) = 0 geteuid() = 1151 openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/pmount.mo", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=450, ...}) = 0 mmap(NULL, 450, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b1a314000 close(3) = 0 openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/pmount.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "Error: this program needs to be "..., 52Error: this program needs to be installed suid root ) = 52 exit_group(100)

bablokb commented 1 week ago

Ok, the pmount problem is evident from the end of the trace: pmount must be able to run as root (at least part-time), so it needs the suid bit set. Normally, the installation should take care of that.

But let's look at the very first error:

  1. journalctl -b | grep mount returns: Sep 30 08:29:41 nebula udisksd[1751]: mountpoint /media/rps/CIRCUITPY is invalid, cannot recover the canonical path

Do you know which command triggered this log-entry? AFAIK, mounts below /media/<userid> are created dynamically by the automounter. But maybe the directory /media/<userid> (in your case /media/rps) does not exist?!

schaefer01 commented 1 week ago

my first guess is on power cycle of my laptop root is following some script that sends a command to the udisksd daemon

my second guess is the startup script has a timing issue, trying to mount the raspberru before the raspberry pi board has connected via the usb (this might be the real problem)

my new problem is something I ran on my laptop now connects to the raspberry pi twice (or thinks it does), I have two different CIRCUITPY drives on /media/rps/ CIRCUITPY and /media/rps/ CIRCUITPY1, one is the correct one, but readonly and I can connect to it by minicom, the other is readwrite but isn't the directory the raspberry pi is sharing with me but not the same drive as the raspberry pi. I need to talk to IT, I really hosed my laptop.

schaefer01 commented 1 week ago

clarification, the 2nd CIRCUITPY was a co-worker with a 2nd board connected to my laptop (my laptop has so many usb cables going in, I missed this) I unplugged that board's power and am back to just not being able to ssh and mount.

schaefer01 commented 1 week ago

more information, I did an strace udisksctl mount and although there's too much information to copy and paste but the relevant information is that /dev/sda1 is mounted RD_ONLY, i.e. mounted readonly by default, and googling seems to find others with similar issues but no solution. $ strace udisksctl mount -b /dev/sda1 -t vfat

Is there any way to determine what generated the original udiskd / udisksctl command that resulted in the journal results: nebula udisksd[1751]: mountpoint /media/rps/CIRCUITPY is invalid, ?

schaefer01 commented 1 week ago

I think an unpower/repower the rp2040 board also plays a part, but there are so many permutations to try

schaefer01 commented 1 week ago

logging in causes something to change

I have to be (by not logging in first) missing a parameter to udisksd or to systemd

Here's logging in first, then running journalctl $ journalctl -b | grep CIRCUITPY Oct 02 09:27:09 nebula udisksd[1734]: mountpoint /media/rps/CIRCUITPY is invalid, cannot recover the canonical path Oct 02 09:27:09 nebula udisksd[1734]: Cleaning up mount point /media/rps/CIRCUITPY (device 8:1 is not mounted) Oct 02 09:28:08 nebula systemd[1]: Finished Clean the /media/rps/CIRCUITPY mount point. Oct 02 09:28:08 nebula udisksd[1734]: Mounted /dev/sda1 at /media/rps/CIRCUITPY on behalf of uid 1151 Oct 02 09:28:49 nebula udisksd[1734]: Cleaning up mount point /media/rps/CIRCUITPY (device 8:1 no longer exists) Oct 02 09:28:49 nebula systemd[1]: media-rps-CIRCUITPY.mount: Succeeded. Oct 02 09:28:49 nebula systemd[2827]: media-rps-CIRCUITPY.mount: Succeeded. Oct 02 09:28:49 nebula systemd[3879]: media-rps-CIRCUITPY.mount: Succeeded. Oct 02 09:28:49 nebula systemd[1]: Stopping Clean the /media/rps/CIRCUITPY mount point... Oct 02 09:28:49 nebula systemd[1]: clean-mount-point@media-rps-CIRCUITPY.service: Succeeded. Oct 02 09:28:49 nebula systemd[1]: Stopped Clean the /media/rps/CIRCUITPY mount point. Oct 02 09:30:40 nebula systemd[1]: Finished Clean the /media/rps/CIRCUITPY mount point. Oct 02 09:30:40 nebula udisksd[1734]: Mounted /dev/sda1 at /media/rps/CIRCUITPY on behalf of uid 1151

CIRCUITPY/ is now read write

schaefer01 commented 1 week ago

solved

after udisksctl mount I need to cycle power on the rp2040 and then it will change from read only to read/write

thank you all for your pointers/hints, the strace is a new tool in my toolbox

dhalbert commented 1 week ago

Glad you got it working. I'm still not sure why it's an issue on your particular setup but not on most others. But maybe this issue will help others in the future.

schaefer01 commented 1 week ago

dhalbert, I hope so too, again thank you for giving me the forum to work through issues publicly