View topic - How to add passwd command support to QNX OS image?

Page 1 of 1

How to add passwd command support to QNX OS image?

PostPosted: Sun Oct 23, 2016 2:46 pm
by midlevel
I am working on a system builder project where I am building an OS image for a PPC 440EP device. What is the correct way of adding passwd or any other command that enables setting password for root user? My current project status is as following.
I have added passwd binary to the project (/bin). Also /etc/passwd file exists. When I try to set root password for QNX with passwd root command, I get the following error:

unable to lock password database (No such file or directory)

After creating the image, adding files or folders to /etc is not doable (I think because it is read-only). Please provide step by step instructions for adding passwd from the beginning. I think I have not been doing it correctly until now.

Re: How to add passwd command support to QNX OS image?

PostPosted: Sun Oct 23, 2016 10:44 pm
by denkelly
The /etc/ directory must be read/write so /etc/passwd can be saved. If you create /etc/passwd in the ifs, you can never change password.

One option is to mount a devb-ram instance at /etc and copy passwd file there. You will be able to change the password - but of course it will only last until you reboot.

Re: How to add passwd command support to QNX OS image?

PostPosted: Mon Oct 24, 2016 6:22 am
by midlevel
denkelly wrote:The /etc/ directory must be read/write so /etc/passwd can be saved. If you create /etc/passwd in the ifs, you can never change password.

One option is to mount a devb-ram instance at /etc and copy passwd file there. You will be able to change the password - but of course it will only last until you reboot.


Could you give more details on how to do this? Do you mean if I set password by this method, I will lose it after a reboot or I won't be able to set it again?
When I run these commands it has no effect.
Code: Select all
# cd /etc
# df
/dev/fs0p1                100096        79    100016       1%  /fs0p1         
# devb-ram ram capacity=2000 &
[1] 155663
# Path=0 -
 target=0 lun=0     Direct-Access(0) - ram  Rev:


[1] + Done                 devb-ram ram capacity=20
# df
/dev/fs0p1                100096        79    100016       1%  /fs0p1         
#

Re: How to add passwd command support to QNX OS image?

PostPosted: Mon Oct 24, 2016 5:34 pm
by Tim
You lose it after a reboot.

You've created the Ram drive. You now have to mount it. You need something like:

devb-ram ram capacity=2000 &
waitfor /dev/hd1t77 2 (wait 2 second for Ram drive to appear)
mount -t qnx4 /dev/hd1t77 /etc (where you want to mount it)

Note: The output from your 'df' command doesn't look right (I don't see the Ram drive listed by 'df' so I wonder if the command failed in some manner).

Tim

Re: How to add passwd command support to QNX OS image?

PostPosted: Tue Nov 01, 2016 9:59 am
by Thunderblade
If you want persistent file storage, naturally you need to add a filesystem like fs-qnx4 or fs-qnx6 to your system (for block devices).Or a devf driver (for NOR flash) or fs-etfs (for NAND flash). Is one of the three part of your BSP? If so, start the corresponding driver and filesystem, create a partition, and in there you can then create directories and files, like /etc/, and so on, and change them.

Cheers,

- Malte