Porteus USB always mounted as /mnt/porteus

Technical issues/questions of an intermediate or advanced nature.
rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Porteus USB always mounted as /mnt/porteus

Post#1 by rych » 06 Feb 2022, 02:02

I asked a similar question before: Permanent device/mount name for a USB disk

But now simple: how can I have the porteus USB to always mount on /mnt/porteus, and not on a random /mnt/sda1, /mnt/sdb1 etc.?
Last edited by rych on 06 Feb 2022, 06:00, edited 4 times in total.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Porteus USB always mounted as /mnt/porteus

Post#2 by Ed_P » 06 Feb 2022, 04:18

Good question. My Porteus USB normally mounts as /mnt/sdb1 on my Dell Inspiron 13 notebook, which has an SSD hardrive, and as /mnt/sda1 on my new Dell Inspiron 14 notebook, which has a M.2 SSD harddrive.
Ed

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Porteus USB always mounted as /mnt/porteus

Post#3 by rych » 07 Feb 2022, 08:33

I'll explain why I need this. I carry an ext3/4 file system, labeled Porteus5, on my porteus USB and install some programs into a folder there, say /mnt/sda2/frugal (can I use the term frugal for this?), -- because some apps are too much work to make into xzm modules, either because they update too frequently or are too huge, like 10GB.

Now imagine the path changing between /mnt/sda2/frugal and /mnt/sdb2/frugal and so on. Even Firefox installed there considers itself a new installation each time on a physically different path after resolving any invariant symbolic link I may have created for it, making a new empty profile etc. -- such a nuisance. Another example: Conda installs its own python and then all scripts in that system hardcode the location of the python executable as e.g. /mnt/sda2/frugal/miniconda/bin/python but that sda2 will be wrong on a different machine.

The booting FAT32 partition on the same USB successfully finds the porteus base partition by reading the porteus.cfg

Code: Select all

KERNEL /boot/syslinux/vmlinuz
INITRD /boot/syslinux/initrd.xz
APPEND changes=/porteus from=LABEL:Porteus5
Now that it's found, let it be mounted into a universally persistent name, for example, /mnt/porteus, please?

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Porteus USB always mounted as /mnt/porteus

Post#4 by Ed_P » 07 Feb 2022, 17:19

rych wrote:
07 Feb 2022, 08:33
The booting FAT32 partition on the same USB successfully finds the porteus base partition by reading the porteus.cfg
I'm pretty sure the system's boot menu does a search for a Porteus file name and sets root to it's find before booting the drive.

An option that might work, if not already available, is a system parm set at boot time to the drive being booted. Something like the $PWD parm. Then scripts and alike could use /mnt/$DRV/frugal to access folders.

I have a feeling as these M.2 SSD drives gain in popularity for Porteus the problem will grow. :happy62:
Ed

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Porteus USB always mounted as /mnt/porteus

Post#5 by rych » 08 Feb 2022, 11:54

I'm trying to work out a method I suggested in Permanent device/mount name for a USB disk, but it works only for hotplugging after boot, not during boot. I need to find out who mounts my partitions during boot.

Probably it's done
fanthom wrote:
06 Jan 2011, 05:37
in linuxrc (inside initrd)
Fixed mount paths for other partitions than root

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Porteus USB always mounted as /mnt/porteus

Post#6 by babam » 09 Feb 2022, 13:30

It's possible by modifying initrd ( linuxrc and finit )
Sorry, my English is bad.

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Porteus USB always mounted as /mnt/porteus

Post#7 by rych » 11 Feb 2022, 07:01

babam wrote:
09 Feb 2022, 13:30
It's possible by modifying initrd ( linuxrc and finit )
Thanks, that's digging too deep for my level. I've decided on an extra bind mount which gives me an invariant path every boot.

I seem to have to do it manually after boot because adding the following line into /etc/rc.d/rc.local has no effect

Code: Select all

mount --bind $BASEDIR/portable /P
perhaps the $BASEDIR is not known at that stage? (Empty folder-mount point /P pre-exists of course). Should I try etc/rc.d/rc.4 instead? Anyway executing the same command manually after fully booted works.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Porteus USB always mounted as /mnt/porteus

Post#8 by Ed_P » 11 Feb 2022, 17:17

This posting might interest you rych. Ravas coding goodies (Post by ncmprhnsbl #86943)
Ed

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Porteus USB always mounted as /mnt/porteus

Post#9 by rych » 15 Feb 2022, 06:15

To make those vars known I needed an extra line in /etc/rc.d/rc.local

Code: Select all

source /etc/profile.d/porteus.sh
mount --bind $BASEDIR/portable /P
Now I can install my frugal-USB-portable programs into the invariant path /P/ which always points to the right folder on my porteus USB. Thank you.

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Porteus USB always mounted as /mnt/porteus

Post#10 by rych » 19 Nov 2022, 03:42


User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus USB always mounted as /mnt/porteus

Post#11 by Rava » 20 Nov 2022, 03:11

rych wrote:
15 Feb 2022, 06:15
To make those vars known I needed an extra line in /etc/rc.d/rc.local

Code: Select all

source /etc/profile.d/porteus.sh
mount --bind $BASEDIR/portable /P
Now I can install my frugal-USB-portable programs into the invariant path /P/ which always points to the right folder on my porteus USB. Thank you.
Good to know that approach works for you.
The issue is, when you edit your initrd you can completely break your system when there happens a minor editing error, because initrd is the INITial Ram Disk .
While it is good that Gele posted his findings in Re: Fixed mount paths for other partitions than root (Post by Gele #27281) - when you find an approach that works without having a custom edited initrd I would go with the other approach.

I myself have on all my Porteus setups some code via /etc/rc.d/rc.local that creates some symlinks based on where certain external harddrive partitions are mounted - regardless if the mount point in itself is /mnt/sda1 or /mnt/sdb1 or /mnt/sdc1 … making my own code resulting in invariant paths via symlinks created by /etc/rc.d/rc.local .
Cheers!
Yours Rava

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

Porteus USB always mounted as /mnt/porteus

Post#12 by rych » 20 Nov 2022, 12:53

Rava wrote:
20 Nov 2022, 03:11
have on all my Porteus setups some code via /etc/rc.d/rc.local that creates some symlinks based on where certain external harddrive partitions are mounted - regardless if the mount point in itself is /mnt/sda1 or /mnt/sdb1 or /mnt/sdc1 … making my own code resulting in invariant paths via symlinks created by /etc/rc.d/rc.local
Yes I do the same! Only I had to make some links hardlinks (mount --bind) because some software resolve symlinks back to /mnt/sd{a,b,c,...}, and break when booting on a different machine: for example conda derivatives.

I've recently edited initrd just to remove guest ownership of some windows FS mounts. I'm still considering modifying it to add an extra (host) repository folder where to activate modules from: a special folder on the host system's fast SSD has some of my larger modules. I'm injecting them into aufs later in the /etc/rc.d/rc.local -- but it slows down the booting process quite a bit probably because it then have to update indexes, databases, etc.... Initial module activation inside initrd seems faster ... and conceptually the right stage to do it. I heard for example overlayfs doesn't even allow delayed modules injection.
Rava wrote:
20 Nov 2022, 03:11
can completely break your system when there happens a minor editing error, because initrd is the INITial Ram Disk
Well, one can always just roll back and reboot using the old initrd

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus USB always mounted as /mnt/porteus

Post#13 by Rava » 20 Nov 2022, 14:52

rych wrote:
20 Nov 2022, 12:53
Well, one can always just roll back and reboot using the old initrd
Sure, someone who managed to find a way of editing the initrd (even when there is a GUI way of doing the extraction of the cpio image and putting it back together into a new cpio image [not that I know of a GUI based tool that assists in that regard, and IMHO there should be none, a user who cannot handle simply terminal tasks should have no business editing any initrd]) should be clever enough to have at least one backup config that uses a standard known-to-work initrd.

Added in 5 hours 52 minutes 32 seconds:
And rych, just my 2 cents on that matter but I recommend you altering initrd.xz's entry in /etc/porteus/ as well.
Example, you use 20220928 as base for your initrd.xz and you keep it like so and post the info

Code: Select all

guest@porteus:~$ cat /etc/porteus/initrd.ver 
initrd.xz:20220928
people would assume you have a regular initrd.

It is also better for yourself to keep track on your own changes. And you also see when booting and asking the entry in /etc/porteus/initrd.ver what version you are running. One minor edit but it gives you much advantage in keeping track especially when debugging your initrd, you would not want to boot an outdated edited one by mistake and not realizing it cause all your initrd's give the very same info in /etc/porteus/initrd.ver …
Cheers!
Yours Rava

Post Reply