UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    fstab getting overwritten?

    Scheduled Pinned Locked Moved Unsolved Support
    14 Posts 5 Posters 1.6k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • C Offline
        crackulator
        last edited by

        I'm setting up my device to map permanent shares on an smb server to folders in my home directory. I have it working, but it requires changes to /etc/fstab, and every time I reboot my system, my fstab changes disappear, so I must remake them.

        I've already made the system r/w (as in https://ubports.com/nl/blog/ubports-blogs-nieuws-1/post/terminal-chapter-3-3073), did not appear to matter.

        What is the solution here? Is there something else I must do to make the fstab persistent, somewhere upstream I should make my changes, or some other approach I should be taking?

        AppLeeA 1 Reply Last reply Reply Quote 0
        • AppLeeA Offline
          AppLee @crackulator
          last edited by

          Hi @crackulator ,

          You probably need another approach here I guess.
          Setting the system partition to RW is rarely a good idea.

          What do you try to achieve here by modifying the fstab file ?
          I don't see a use case where I would need it. 🤔

          C 1 Reply Last reply Reply Quote 0
          • C Offline
            crackulator @AppLee
            last edited by

            @applee

            All my documents are on an SMB server on my network. I'd like to mount them to folders in my home directory so that I have convenient access to the files. I believe the usual way to do this in Linux would be to modify the fstab file, at least that's what I usually do.

            Is there some other way to do this in UBPorts?

            AppLeeA 1 Reply Last reply Reply Quote -1
            • BollyB Offline
              Bolly
              last edited by Bolly

              You can make a script that starts every time the system boots.

              If you share what you do, it may be useful to someone now or in the future. 😜

              2015-Now (Daily use) : BQ Aquaris E4.5 Ubuntu edition
              2016-Now (Daily use) : BQ Aquaris M10 FHD Betatester

              2020-Now : PinePhone Braveheart & CE UBports
              2020-Now (Family/Daily use): Vollaphone Xenial
              2022-Now (Family/Daily use): Vollaphone 22 Focal

              1 Reply Last reply Reply Quote 0
              • AppLeeA Offline
                AppLee @crackulator
                last edited by

                @crackulator
                I thought there were apps in the open store to access SMB servers. But I couldn't find any.
                I think you can create an app in order to mount the SMB folder, but I'm not sure if everything needed is in the OS.

                I don't have my Nexus5 anymore and I'll have to wait a bit to get another UT device 😞
                Sorry I cannot help more.

                C 1 Reply Last reply Reply Quote 0
                • C Offline
                  crackulator @AppLee
                  last edited by

                  Anybody know why my fstab is getting overwritten, or how I can accomplish this task?

                  Note: I don't have any trouble accessing SMB shares, I'm just trying to map some shares into my home directory for easy access. In fact, the workaround is just to copy up a new fstab and then mount the shares, works perfectly. It just seems like a rather grubby workaround. On most Linux installs, one just edits fstab to map the shares, and then it's done for good.

                  N 1 Reply Last reply Reply Quote 1
                  • N Online
                    nogoogle @crackulator
                    last edited by

                    @crackulator if you only want to access shares from filemanager then this solution may work

                    https://forums.ubports.com/post/31279

                    I believe fstab is overwritten because /etc is on the system partition which is overwritten with every OTA because of image based updates.

                    AppLeeA 1 Reply Last reply Reply Quote 0
                    • AppLeeA Offline
                      AppLee @nogoogle
                      last edited by

                      @nogoogle said in fstab getting overwritten?:

                      I believe fstab is overwritten because /etc is on the system partition which is overwritten with every OTA because of image based updates.

                      Yes that is correct.
                      That's why modifying the rootfs is deprecated by UBports.

                      How do you mount your SMB partition, there might be a way. I don't modify my fstab on my desktop to mount a partition wherever I want...

                      C 1 Reply Last reply Reply Quote 0
                      • C Offline
                        crackulator @AppLee
                        last edited by

                        @applee It's not just overwriting it during an update, it's overwriting it every boot. So maybe there is an upstream source of it that I could edit instead.

                        On a desktop system, it would make no sense to overwrite fstab during an update or reboot; it maps the UUIDs of all your drives and partitions to locations within your directory tree. Your install usually sets it up for you, and if you put your home folder on a different partition or drive than the root system, those details would be in fstab. You'd have to modify it manually if, for example, you put several distros on different partitions and have them all share a Documents folder. Mapping SMB shares is just the same, it's just that the for-example Documents folder is on a network server, which is what I'm doing. I believe this is all quite normal, expected Linux behavior.

                        UBPorts seems to be doing quite a bit of remapping in fstab, from a glance looks like it's mapping the android parts of the tree to the linux parts, and otherwise bringing parts of the tree to places that linux expects. So it makes sense that it would want to update it, as it's a pretty complex mapping. It looks like the UBPorts system doesn't need to map the UUIDs as desktop linux does, as the android blob takes care of that.

                        But I believe brutally overwriting fstab is subverting part of its purpose. Perhaps less important in a portable context, as you don't have partitions, and wouldn't usually have permanent servers available, but there are use cases.

                        I have documents and music and videos on my servers which I'd like to access from my devices, when I'm on my home network. To use these with anything besides File Manager, they need to be mapped somewhere in the root tree. I can hack fstab with a script as I'm doing, but that subverts UBPorts in that I have to make the root system r/w. Perhaps there is another way to mount SMB shares dynamically without putting them in fstab, I just don't know it. Obviously the system can do this with pluggable devices. If anybody can point me in that direction, I'd like to learn about it.

                        AppLeeA 1 Reply Last reply Reply Quote 0
                        • AppLeeA Offline
                          AppLee @crackulator
                          last edited by

                          @crackulator I don't have an Ubuntu Touch device at the moment to test.
                          Have you tried smbmount ?
                          This is for me the "normal" way of mounting a remote SMB partition. Modifying fstab is interesting if you want to mount it at each boot and if the SMB server is always reachable. That's a pretty specific use case in my opinion but there is no such thing as the right method to do things and if it works for you than that's fine.

                          C 2 Replies Last reply Reply Quote 0
                          • C Offline
                            crackulator @AppLee
                            last edited by crackulator

                            @applee Well, that's a good point. fstab is probably not doing anything besides automatically mounting shares that could as easily be dynamically mounted by a script. smbmount seems to be obsolete but it looks like one can do it with mount.cifs in just the same way as with fstab. I'll work that out and report back.

                            1 Reply Last reply Reply Quote 1
                            • C Offline
                              crackulator @AppLee
                              last edited by

                              @applee so yeah, my swapping-out of fstab isn't really bringing anything to the dynamic-mounting party. One can do it just as easily with:

                              sudo mount -t cifs -o username=<username>,password=<password>,rw,uid=32011,gid=32011,sec=ntlmssp //<server>/<share> <mount path>
                              

                              (With appropriate replacements for <these fields>). The uid and gid numbers are those for the phablet user that UBPorts gave, as shown with the "id" command).

                              However I still think that changing fstab is better in some ways, since the shares should mount automatically, that is, if UBPorts wasn't clobbering the fstab. It seems like it should be possible to share that function with UBPorts' remappings. Of course it would fail to mount automatically if the network or share is not available, but that seems to be ok on other distros, it just doesn't mount, and you mount it manually later. It also lets the admin set it up so a user can mount it without having the technicals. But again that's a bit different on UBPorts, since it isn't really multi-user.

                              It seems like there are other things in /etc/ that are generally necessary to modify, /etc/ssh/ssh_config comes to mind. Isn't that where any systemwide config would be? I'm not sure how that could be unmodifyable.

                              Maybe I'm just expecting too much Linux out of it...

                              AppLeeA 1 Reply Last reply Reply Quote 0
                              • AppLeeA Offline
                                AppLee @crackulator
                                last edited by

                                @crackulator said in fstab getting overwritten?:

                                Maybe I'm just expecting too much Linux out of it...

                                I understand your point of view but the way you put it is a bit sensitive here.
                                Ubuntu Touch is Linux but not for desktop PC and so has specific constraints (bootloader, firmware, partitioning, power saving, ...)

                                To fit Ubuntu Touch in the partitions made for android is not an easy task. I'm no expert here, but I guess the partitioning is source of a lot of non standard solution found to overcome these constraints.
                                I don't have an explanation for the fstab file but I suspect it has something to do with how the partitions are made.

                                At least you have a working solution for your need and if you wish to dig deeper to understand what is at play here, I'll be happy to understand it.

                                1 Reply Last reply Reply Quote 0
                                • K Offline
                                  kuzmi4
                                  last edited by

                                  Hi all,
                                  Has anyone succeeded in finding the fstab "generator"?

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post