Page 1 of 1

[Solved] Using changes= on already existing PXE server

Posted: 13 Oct 2013, 21:01
by MarcAngelo
Hi guys,

I was able to install Porteus on my already existing PXE server.
It is completely up-and-running using PXE/httpd/nfsd.

There is only 1 problem: I'm not able to write the changes to a folder on my existing PXE server.
If I want to write the changes on my existing PXE server in the folder: /srv/storage/pxe-clients (path is defined as rw in /etc/exports)
what do I write in the APPEND= line for changes= to actually worK?

Everything I tried sofar resulted in empty or invalid value...

Thanks!

Marc

Re: Using changes= on already existing PXE server

Posted: 14 Oct 2013, 06:28
by fanthom
Hi Marc,

please make sure that you have a filesystem which aufs_over_nfs can support mounted in /srv/storage/pxe-clients. it can be tmpfs or some native linux filesystem (ext*, xfs, reiserfs, etc). sample command:

Code: Select all

mount -o bind /mnt/sdXY/porteus-pxe-storage /srv/storage/pxe-clients
or

Code: Select all

mount -t tmpfs -o size=500M tmpfs /srv/storage/pxe-clients
now it should be enough if the clients boot with 'changes=/srv/pxe/storage' cheatcode.

Re: Using changes= on already existing PXE server

Posted: 14 Oct 2013, 11:11
by MarcAngelo
Hi Fanthom!

Thanks for your supply.
I tried both of your mount suggestions, but in APPEND= /srv/pxe/storage or /srv/storage/pxe-client both
result in "Couldn't find /srv/pxe/storage" and "Couldn't find /srv/storage/pxe-clients".

"Correct your cheatcodes if needed"

Thanks for your help sofar!

Marc

Re: Using changes= on already existing PXE server

Posted: 14 Oct 2013, 12:42
by fanthom
i'm sorry i wasn't correct.
changes for pxe clients must be saved in /srv/pxe/storage folder and can not in any other (like /srv/storage/pxe-clients). this is hardcoded into linuxrc.
here is the setup which works for me:

on the server side:

Code: Select all

cat /etc/exports
/srv/pxe/porteus 192.168.1.1/24(ro,fsid=0,no_subtree_check)
/srv/pxe/storage 192.168.1.1/24(rw,fsid=1,no_root_squash,no_subtree_check)

Code: Select all

grep storage /proc/mounts
tmpfs /srv/pxe/storage tmpfs rw,relatime,mode=755 0 0
on the client side you must boot with 'changes=/srv/pxe/storage' cheatcode.

Re: Using changes= on already existing PXE server

Posted: 14 Oct 2013, 13:10
by MarcAngelo
Hi Fanthom,

Thanks for your help!
After creating the folder /srv/pxe/storage and modifying the /etc/exports I was able to save the
changes.

This is so cool!!

Thanks again!

Marc

Re: [Solved] Using changes= on already existing PXE server

Posted: 14 Oct 2013, 13:45
by fanthom
glad to hear that finally someone found this feature useful :)
still experimental so please let us know in case of troubles.

Re: [Solved] Using changes= on already existing PXE server

Posted: 15 Oct 2013, 08:16
by MarcAngelo
Well...

It works great, but have 1 question left :D
Now it creates a new directory structure per client, with last 6 characters of the MAC-address.

Is it possible to be able to create 1 directory structure, based on USER-name, so that wherever the user logs in,
the settings/preferences keep the same? So... Make the user settings available no matter which client they login?


Or..
Do I rename the original directory structure and use symbolic links for each client, so they have the same settings
(haven't tested this yet).

Thanks for your time and effort!


Marc

Re: [Solved] Using changes= on already existing PXE server

Posted: 15 Oct 2013, 09:14
by fanthom
default implementation forces users to use the same PC's all time.
probably you could create separate folder like /srv/pxe/home and bind it to /srv/pxe/storage/client-MAC/changes/home for every client you have. this way user settings will be available on every PC while all other files (network/Xorg settings, log files, etc) remain unique to each PC.

Re: [Solved] Using changes= on already existing PXE server

Posted: 15 Oct 2013, 11:16
by MarcAngelo
Hi Fanthom,

Would you use a symbolic link to link /srv/pxe/home and /srv/pxe/storage/client-MAC/changes/home together, or would you use mount for that?

If you would suggest mount, could you give an example how to mount it?
I only am familiar with mount for mounting drives and shares :D
I tried to google it, but didn't find a useful example yet.

Thanks!

Marc

Re: [Solved] Using changes= on already existing PXE server

Posted: 15 Oct 2013, 15:35
by fanthom
binding is done this way:

Code: Select all

mount -o bind /path/folder1 /path/folder2
but this setup does not work as aufs is complaining about multiple level mounts (one fs mounted on top of another). have seen a fix for that but i have better idea: let's do the job client side instead.

please export another share on the server:

Code: Select all

/srv/pxe/home 192.168.1.1/24(rw,fsid=1,no_root_squash,no_subtree_check)
then on the client side create /porteus/rootcopy/etc/rc.d/rc.local (must be executable) with following content:

Code: Select all

mount -t nfs $SERVER_IP:/srv/pxe/home /home -o rw,nolock
of if you are using nfsv4 then:

Code: Select all

mount -t nfs4 $SERVER_IP:/srv/pxe/home /home -o rw,nolock
this way exported share will be mounted under /home during every boot (and you can avoid binding for every client on the server).

should work without problems.

Re: [Solved] Using changes= on already existing PXE server

Posted: 16 Oct 2013, 11:44
by MarcAngelo
Hi fanthom,


I created folder /srv/pxe/home (chmod 777).


added to /etc/exports:
/srv/pxe/home 192.168.178.1/24(rw,fsid=1,no_root_squash,no_subtree_check)


added to /srv/pxe/porteus/rootcopy/etc/rc.d/rc.local
/sbin/mount -t nfs 192.168.178.1:/srv/pxe/home /home -o rw,nolock

Whenever I create a new user in Porteus, (for example 'marc') a folder is created
in /srv/pxe/storage/marc instead of /srv/pxe/home/marc :shock:, which is in the same
subdirectory as were the client-configs are saved :o.

So the created folder /srv/pxe/home stays empty.


Thanks!

Marc

Re: [Solved] Using changes= on already existing PXE server

Posted: 16 Oct 2013, 12:42
by fanthom
tested and works perfectly here.
are you sure you have /srv/pxe/porteus/rootcopy/etc/rc.d/rc.local executable? please run 'cat /proc/mounts' command on the client side and confirm that /srv/pxe/home is really mounted under /home.
if not then mount this share manually (as root) and check for error messages. i'm sure it's something wrong with your /etc/exports on the server (did you run 'exportfs -a' after updating this config?).

you probably know this but writing just in case: you have to create all users on one PC and then copy relevant files (/etc/passwd, /etc/shadow, /etc/group, etc) to /srv/pxe/porteus/rootcopy (or create pxe-settings module) so UIDs/GIDs will remain the same across all clients. if you create 'john' on client-A and 'jenny' on client-B then their UID/GID will be the same (1001:1001) in /srv/pxe/home which brings a security concern (they will be able to access their home folders without restrictions).

Re: [Solved] Using changes= on already existing PXE server

Posted: 16 Oct 2013, 22:53
by MarcAngelo
Hi Fanthom,

I guess I've done everything as you explained, but homedirs are still created in /srv/pxe/storage instead of /srv/pxe/home. :shock:
My server has IP-address 192.168.178.5.

This is what I have done on my server (which also is used for storage):

/etc/exports:
/media/Verbatim 192.168.178.0/24(rw,sync,no_subtree_check)
/srv/pxe/porteus 192.168.178.0/24(ro,fsid=0,no_subtree_check)
/srv/pxe/storage 192.168.178.0/24(rw,fsid=1,no_root_squash,no_subtree_check)
/srv/pxe/home 192.168.178.0/24(rw,fsid=1,no_root_squash,no_subtree_check)


Created directories witch chmod 777:
/srv/pxe/home
/srv/pxe/porteus
/srv/pxe/storage

On /srv/pxe/porteus/rootcopy/etc/rc.d/rc.local (chmodded 777)
/sbin/mount -t nfs 192.168.178.5:/srv/pxe/home /home -o rw,nolock

I have a virtualhost running on Apache on port 8000 to serve the files:
000-kernel.xzm
001-core.xzm
002-xorg.xzm
003-kde.xzm
04-chrome.xzm
05-devel.xzm
08-skype.xzm


On tftpboot I use the following APPEND= parameters:
APPEND initrd=porteus/initrd.xz timezone=Europe/Amsterdam ip=0.0.0.0:192.168.178.5:192.168.178.1:255.255.255.0:8000 changes=/srv/pxe/storage
login=

The ip= parameter defines that the needed files can be found on the http server on port 8000 (this works like a charm).
The changes= parameter defines where the changes can be stored as you described
The login= parameter makes sure a user needs to be manually selected to login, instead of autologin user "guest".


Whenever I boot a client (as a test, running from VMware workstation with IP-address 192.168.178.233 and MAC-address 00:0C:29:DB:02:71.
It creates file-structure : /srv/pxe/storage/client-DB0271

I logged in as user : root

From terminal on the CLIENT (logged in as root): cat /proc/mounts | grep home
192.168.178.5:/srv/pxe/home /home nfs rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,nolock,proto=tcp,
timeo=600,retrans=2,sec=sys,mountaddr=192.168.178.5,mountvers=3,mountport=49341,mountproto=udp,local_lock=all,addr=192.168.178.5 0 0

When I add a user "marctest" by : adduser marctest
and fill in the questions : home directory is default set as /home/marctest

When I execute the following on the CLIENT: ls /home
It shows the following result: :o
client-DB0271
marctest


When I check /srv/pxe/home on the SERVER, it shows an empty folder

When I check /srv/pxe/storage on the SERVER, it shows:
client-DB0271
marctest


So client configs even as user homedirs are both stored on /srv/pxe/storage. :%)


What am I doing wrong? :(


Thanks for your help sofar!! :Yahoo!:

Marc

Re: [Solved] Using changes= on already existing PXE server

Posted: 17 Oct 2013, 00:06
by fanthom
When I execute the following on the CLIENT: ls /home
It shows the following result: :o
client-DB0271
marctest
looks like rc.local is mounting wrong share: /srv/pxe/storage instead of /srv/pxe/home. please edit /etc/exports and change to:

Code: Select all

/srv/pxe/home 192.168.178.0/24(rw,fsid=2,no_root_squash,no_subtree_check)
then run 'exportfs -a'

now you can debug the problem manually:
- unmount /home on the client
- on the server create some random file in /srv/pxe/home
- create /tmp/test folder on the client
- run 'mount -t nfs 192.168.178.5:/srv/pxe/home /tmp/test -o rw,nolock' on the client and check if your random file is in /tmp/test

if you still get content of /srv/pxe/storage under /tmp/test then it must be something wrong with your /etc/exports which is confusing /srv/pxe/storage instead and /srv/pxe/home shares.