UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor ipush
Visitor
3,741 Views
Registered: ‎01-23-2014

Disable dropbear ssh server on Petalinux 2016

Jump to solution
I don't have network interface on my custom board, but have to wait during system startup about 6-8 seconds while dropbear ssh server generate key.. I disable all dropbear applications in rootfs:
petalinux-config -c rootfs (filesystem packages-console-network-dropbear) but it still started during start up..
How can I disable dropbear ssh server on Petalinux 2016.3?
0 Kudos
1 Solution

Accepted Solutions
Adventurer
Adventurer
6,490 Views
Registered: ‎04-23-2014

Re: Disable dropbear ssh server on Petalinux 2016

Jump to solution

I solved this myself by creating an application project that contains the following script in patch_config.sh

 

#!/bin/sh

# Prevent dropbear from starting for rc in 0 1 2 3 4 5 6 7; do rm /etc/rc${rc}.d/*dropbear done

I used the following .bb file for this recipe:

 

#
# This file is the patch-config recipe.
#

SUMMARY = "Simple patch-config application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://patch-config.sh"

S = "${WORKDIR}"

do_compile() {
}

do_install() {
	install -d ${D}${sysconfdir}/init.d
	install -d ${D}${sysconfdir}/rc1.d
	install -d ${D}${sysconfdir}/rc2.d
	install -d ${D}${sysconfdir}/rc3.d
	install -d ${D}${sysconfdir}/rc4.d
	install -d ${D}${sysconfdir}/rc5.d

	install -m 0755 patch-config.sh ${D}${sysconfdir}/init.d/patch-config

	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc1.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc2.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc3.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc4.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc5.d/S00patch-config
}

View solution in original post

0 Kudos
4 Replies
Adventurer
Adventurer
6,491 Views
Registered: ‎04-23-2014

Re: Disable dropbear ssh server on Petalinux 2016

Jump to solution

I solved this myself by creating an application project that contains the following script in patch_config.sh

 

#!/bin/sh

# Prevent dropbear from starting for rc in 0 1 2 3 4 5 6 7; do rm /etc/rc${rc}.d/*dropbear done

I used the following .bb file for this recipe:

 

#
# This file is the patch-config recipe.
#

SUMMARY = "Simple patch-config application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://patch-config.sh"

S = "${WORKDIR}"

do_compile() {
}

do_install() {
	install -d ${D}${sysconfdir}/init.d
	install -d ${D}${sysconfdir}/rc1.d
	install -d ${D}${sysconfdir}/rc2.d
	install -d ${D}${sysconfdir}/rc3.d
	install -d ${D}${sysconfdir}/rc4.d
	install -d ${D}${sysconfdir}/rc5.d

	install -m 0755 patch-config.sh ${D}${sysconfdir}/init.d/patch-config

	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc1.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc2.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc3.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc4.d/S00patch-config
	ln -sf ../init.d/patch-config ${D}${sysconfdir}/rc5.d/S00patch-config
}

View solution in original post

0 Kudos
Visitor ipush
Visitor
3,649 Views
Registered: ‎01-23-2014

Re: Disable dropbear ssh server on Petalinux 2016

Jump to solution

Hello! 

Thanks for your message. It really helps

0 Kudos
Visitor skidaddytn
Visitor
2,553 Views
Registered: ‎11-17-2017

Re: Disable dropbear ssh server on Petalinux 2016

Jump to solution

Interesting solution,   but

 

Can anyone explain further how it works?   I have a startup script that executes from "init.d" as well, but by the time it is executed, dropbear has already started...        In my case I'd like to keep dropbear in our build, but we wish to invoke manual startup when it is needed.   In this way, it would be possible to copy an existing dropbear_rsa_host_key from an SD card to the proper location "/etc/dropbear" before it starts (avoiding the need to recreate a key every boot)

0 Kudos
Visitor skidaddytn
Visitor
2,508 Views
Registered: ‎11-17-2017

Re: Disable dropbear ssh server on Petalinux 2016

Jump to solution

Following up to my own reply about how this trick works.   On my petalinux (2016.4) , there were no rc*.d/*dropbox scripts, so deleting these scripts would have done nothing.  However, I did learn something very important from this post:

My script was copying itself to the init.d location, but I did not use a symbolic link to make it run *first* at the beginning of run level 5.
After I used the symbolic link with a S00 prefix as shown above, I was able to get ahead of the dropbox startup, and insert a previously generated dropbox_rsa_host_key from an SD card into /etc/dropbear.   

 

Also, as an interesting note.  If you don't want dropbox to start automatically, you can put a corrupted key in /etc/dropbear.  It will try to start and fail instantly.   At any later time, you can delete the corrupted key and start dropbox manually, or copy in a valid key and run it.

 

 

0 Kudos