Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

7 votes
1 answers
3461 views
How to run start up scripts on Amazon linux?
I'm trying to create some script that should run on start. Now I've created some myScript file under the /etc/init.d/ and then run `sudo chkconfig --add myScript;` `chkconfig --list myScript` output is: myScript 0:off 1:off 2:on 3:on 4:on 5:on 6:off **myScript:** #!/bin/sh # chkconfig: 2345 98 02 #...
I'm trying to create some script that should run on start. Now I've created some myScript file under the /etc/init.d/ and then run sudo chkconfig --add myScript; chkconfig --list myScript output is:
myScript 0:off 1:off 2:on 3:on 4:on 5:on 6:off **myScript:** #!/bin/sh # chkconfig: 2345 98 02 # description: # processname: # Source function library. if [ -f /etc/init.d/functions ] ; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else exit 0 fi KIND="_" start() { echo starting date >> ~/myScript.log } stop() { echo stopping myScript } restart() { echo restarting } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $? Now I can successfully run service myScript start and log record will be appended. But if I run sudo reboot or restart the instance with AWS UI console it doesn't work as was expected. Although runlevel output is:
N 3 Need some help.
Silk0vsky (213 rep)
Nov 15, 2016, 11:19 AM • Last activity: Aug 4, 2025, 09:09 PM
4 votes
1 answers
4277 views
How to debug systemd "init" freeze during boot?
I'm trying to get my own `init` script running on [some ARM hardware](http://www.acmesystems.it/terra) and Debian Jessie with systemd. The overall boot concept and `init` script is almost identical to a x86 variant, which works fine. For both hardwares the whole SD card image is pre-built on a x86 h...
I'm trying to get my own init script running on [some ARM hardware](http://www.acmesystems.it/terra) and Debian Jessie with systemd. The overall boot concept and init script is almost identical to a x86 variant, which works fine. For both hardwares the whole SD card image is pre-built on a x86 host. When running on the ARM hardware, having **serial console access** I see that my init script runs fine up to the point where switch_root is called:
exec switch_root -c /dev/console /newroot /sbin/init
Nothing happens after that. No error message is printed - which makes it difficult to find the problem. The kernel command line is...
ro root=LABEL=IM_BOOT1 panic=10 mem=256M console=ttyS0,115200 systemd.log_level=debug
...and AFAIK this should make systemd print maximum debug messages. Unfortunately nothing is printed. **Any idea/hint what I could do to understand what could be causing the freeze, or with other words - understand what is going on?** ---- The only strange detail are some warnings in the kernel log *before* calling switch_root:
ext4: Unknown symbol jbd2_journal_errno (err 0)
ext4: Unknown symbol jbd2_journal_begin_ordered_truncate (err 0)
ext4: Unknown symbol jbd2_journal_flush (err 0)
ext4: Unknown symbol mb_cache_entry_find_next (err 0)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
aufs 3.16-20150928
usbhid: Unknown symbol hid_output_report (err 0)
usbhid: Unknown symbol hidinput_count_leds (err 0)
usbhid: Unknown symbol hid_allocate_device (err 0)
usbhid: Unknown symbol hid_destroy_device (err 0)
usbhid: Unknown symbol hid_alloc_report_buf (err 0)
usbhid: Unknown symbol hid_set_field (err 0)
usbhid: Unknown symbol hid_check_keys_pressed (err 0)
usbhid: Unknown symbol hid_input_report (err 0)
usbhid: Unknown symbol hid_debug (err 0)
usbhid: Unknown symbol __hid_request (err 0)
usbhid: Unknown symbol hid_parse_report (err 0)
usbhid: Unknown symbol hid_add_device (err 0)
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
usb_storage: Unknown symbol scsi_report_device_reset (err 0)
usb_storage: Unknown symbol scsi_remove_host (err 0)
usb_storage: Unknown symbol scsi_report_bus_reset (err 0)
usb_storage: Unknown symbol scsi_sense_desc_find (err 0)
usb_storage: Unknown symbol scsi_eh_prep_cmnd (err 0)
usb_storage: Unknown symbol scsi_host_put (err 0)
usb_storage: Unknown symbol scsi_scan_host (err 0)
usb_storage: Unknown symbol scsi_is_host_device (err 0)
...however these modules *appear* to work fine anyway. I don't know if that is related. Some additional details: - Debian installation is prepared using debootstrap (same method works perfectly with x86) - Custom built Kernel: Linux (none) 3.16.7 #1 Mon Nov 16 08:32:55 UTC 2015 armv5tejl GNU/Linux, patched with AUFS and hardware-specific device tree - both Kernel and root fs are built with help of QEMU on a x86 host - initramfs boots with **BusyBox**, sets up the AUFS final root fs and finally invokes switch_root. The same method (nearly 100% identical init script) works fine on x86 - I can run an interactive shell just before running switch_root and I can't find anything that isn't working as expected at that point
Udo G (1143 rep)
Nov 16, 2015, 11:00 AM • Last activity: Jul 4, 2025, 08:04 AM
2 votes
2 answers
19237 views
Default-Start contains no runlevels
I am trying to make my custom made daemon run at startup and when I call `update-rc.d ydcd enable` I get the error update-rc.d: using dependency based boot sequencing update-rc.d: error: MyDaemon Default-Start contains no runlevels, aborting. I'm running Debian wheezy, init is SysVinit. Googling it...
I am trying to make my custom made daemon run at startup and when I call update-rc.d ydcd enable I get the error update-rc.d: using dependency based boot sequencing update-rc.d: error: MyDaemon Default-Start contains no runlevels, aborting. I'm running Debian wheezy, init is SysVinit. Googling it does not give me any valuable info, so I come here as a last resort. What's going on here? What do I need to change in my init.d script in order to make this work? Edit: Here's the script: #!/bin/bash # #ydcd.daemon # # chkconfig: 2345 85 15 # description: MyServiceName # processname: MyServiceName # source function library . /lib/lsb/init-functions RETVAL=0 NAME=ydcd.daemon # YOU CAN SET ANY PATH BUT IS RECOMENDED TO USE THE DISTRO'S STANDARD ONE. DAEMON=/home/debian/yd_cd/$NAME prog=$(basename $DAEMON) lockfile=/var/lock/$NAM SVC_FILE=$DAEMON start() { if [ -f $SVC_FILE ]; then #reset echo -n "Starting "$SVC_FILE": " RETVALS=$(start-stop-daemon -S -b -x $SVC_FILE -- -r) Count=${#RETVALS[@]} RETVAL="[FAIL]" if [ $Count -eq 0 ]; then RETVAL="[OK]" elif [ $Count -eq 1 ]; then if [ ${#RETVALS} -eq 0 ]; then RETVAL="[OK]" else iStart=${#SVC_FILE} iLength=${#RETVALS} Response=${RETVALS:(iStart+1):7} RETVAL=$Response if [ "$Response" == "already" ]; then RETVAL="[OK]" fi fi fi echo $RETVAL return 0 else echo $SVC_ALIAS" not installed" $SVC_DIR exit 2; fi } stop() { echo -n "Shutting down "$SVC_FILE":" RETVALS=$(start-stop-daemon -K -x $SVC_FILE -- s) #additional PROCKILLS=$(killall -w -q -e $SVC_PROCESS_NAME $SVC_FILENAME) Count=${#RETVALS[@]} Index=0 RETVAL="[FAIL]" if [ $Count -eq 1 ]; then if [ ${#RETVALS} -eq 0 ]; then RETVAL="[OK]" else Response=${RETVALS:0:2} RETVAL=$Response if [ "$Response" == "No" ]; then RETVAL="[OK]" fi fi else RETVAL="[OK]" fi echo $RETVAL return 0 } case "$1" in start) start ;; stop) stop ;; status) status $SVC_SERVICE_SCRIPT ;; restart) stop start ;; *) echo $SVC_ALIAS" [Invalid Startup Parameters]" echo "Usage: {start|stop|status|restart}" exit 1 ;; esac exit $?
vaid (129 rep)
Jan 24, 2016, 02:17 AM • Last activity: Jun 26, 2025, 12:04 AM
49 votes
3 answers
120674 views
The rc0.d,rc1.d,... directories in /etc
I'm running Ubuntu where I have the directories `/etc/rc0.d`, `/etc/rc1.d`, `/etc/rc2.d`, ..., `/etc/rc6.d`. Example files from my machine: directory example symlinks in the dir ------------------------------------------ /etc/rc1.d: K76dovecot, K77ntp /etc/rc2.d: S23ntp, S24dovecot /etc/rc3.d: S23nt...
I'm running Ubuntu where I have the directories /etc/rc0.d, /etc/rc1.d, /etc/rc2.d, ..., /etc/rc6.d. Example files from my machine: directory example symlinks in the dir ------------------------------------------ /etc/rc1.d: K76dovecot, K77ntp /etc/rc2.d: S23ntp, S24dovecot /etc/rc3.d: S23ntp, S24dovecot /etc/rc4.d: S23ntp, S24dovecot /etc/rc5.d: S23ntp, S24dovecot Questions: 1. What's the purpose of the multiple "rc" directories? 2. Why did Ubuntu install duplicates of dovecot and ntp into all the directories except rc0.d and rc6.d? 3. If they are specified multiple times like above, are they actually executed multiple times? 4. Can you tell from the above in what order dovecot and ntp will execute at startup? 5. What is the proper way to tell Ubuntu to always execute ntp before dovecot at startup?
roger.james (605 rep)
Jul 20, 2013, 01:06 PM • Last activity: Jun 21, 2025, 07:54 AM
3 votes
1 answers
4650 views
Linux Mint: How to enable cryptswap with custom password?
When you want to use hibernation and you care for security, you'd like to have the swap encrypted. But not with the random password, chosen for you at startup, but with a fixed one, supplied by you at the boot time, so the hibernated state would be available for resuming upon next boot. There was a...
When you want to use hibernation and you care for security, you'd like to have the swap encrypted. But not with the random password, chosen for you at startup, but with a fixed one, supplied by you at the boot time, so the hibernated state would be available for resuming upon next boot. There was a cool way to do this, that worked up until Mint 15: How to: get the whole system encrypted This doesn't work anymore on Petra. Can anyone help me with working it out? The main culprit, the /usr/share/initramfs-tools/scripts/local-top script didn't change, so I guess it has something to do with the kernel. It looks like the recent kernel just ignores all the scirpt, or at least the part that asks for a password for swap. Oh, and I was able to get the password prompt, when I accidentally booted the Mint 16 with the kernel from Mint 15. See also a related question: https://unix.stackexchange.com/questions/117629/how-to-ask-for-a-password-to-mount-crypted-swap-at-boot-time-on-linux-mint-16-wi ------ Some debug info ---------------- After opening the swap device with sudo cryptsetup luksOpen /dev/sda5 cryptswap: **sudo lsblk -o name,uuid** NAME UUID sda ├─sda1 F251-38C0 ├─sda2 c66b8e51-dd1b-4d92-8605-a3ba7df6af83 ├─sda3 77af32db-038d-4c10-b302-039634cf943a ├─sda4 7a3cde35-ab80-4618-ad76-7aa064d55f56 ├─sda5 fc068dd2-759c-4779-b521-c73cc5499e86 │ └─cryptswap (dm-1) 964eafeb-c88b-49c8-8b5e-6f8395e040b4 ├─sda6 926fa7cc-6f97-4672-85a7-a1ed8f5bd842 ├─sda7 804b9c88-907b-43d9-b23f-964c32ecc2ac └─sda8 ce2cd926-133f-4e20-86f8-45bc4844271c └─adama-docs (dm-0) 61a32b98-3b65-4af6-81ff-da090cae039f sr0 **cat /etc/crypttab** #cryptswap1 /dev/sda5 /dev/urandom swap,cipher=aes-cbc-essiv:sha256 swap UUID=fc068dd2-759c-4779-b521-c73cc5499e86 none luks **cat /etc/fstab** UUID=926fa7cc-6f97-4672-85a7-a1ed8f5bd842 / btrfs defaults,subvol=@,compress,autodefrag 0 1 # /boot was on /dev/sda2 during installation UUID=c66b8e51-dd1b-4d92-8605-a3ba7df6af83 /boot ext3 defaults 0 2 # /boot/efi was on /dev/sda1 during installation UUID=F251-38C0 /boot/efi vfat defaults 0 1 # /home was on /dev/sda6 during installation UUID=926fa7cc-6f97-4672-85a7-a1ed8f5bd842 /home btrfs defaults,subvol=@home 0 2 # /mnt/ext4 was on /dev/sda7 during installation UUID=804b9c88-907b-43d9-b23f-964c32ecc2ac /mnt/ext4 ext4 defaults 0 0 # swap was on /dev/sda5 during installation UUID=964eafeb-c88b-49c8-8b5e-6f8395e040b4 none swap sw 0 0 **/etc/initramfs-tools/conf.d/resume** RESUME=/dev/disk/by-uuid/964eafeb-c88b-49c8-8b5e-6f8395e040b4 ----- update: ------ When I setup everything like above, the system does display the familiar password prompt. It doesn't do that every time, and if it does, it is a fraction of second before the login screen (Linux Mint uses mdm for login). I guess there is racing condition; the mounting of swap is done parallel with the system booting; I expect the system to wait booting until the swap is mounted, and do it as early as possible. Otherwise how could it resume the hibernated state? There is a similar question for Ubuntu: https://askubuntu.com/questions/396136/encrypted-home-partition-encrypted-swap-working-hibernate It seems, that it worked for someone if he encrypted the root as well.
Adam Ryczkowski (5859 rep)
Jan 12, 2014, 08:53 AM • Last activity: May 14, 2025, 09:06 AM
2 votes
1 answers
901 views
What do programs use to read their environment?
I'm on Fedora, where all preinstalled shells apparently support bashisms: `bash --posix` does, and even `sh`. Still, when I used [this function][1], ~~~ pathprepend () { if [[ ":$PATH:" != *":$1:"* ]]; then PATH="$1${PATH:+":$PATH"}" fi } ~~~ to add a directory to `PATH` from `~/.profile`, Git didn'...
I'm on Fedora, where all preinstalled shells apparently support bashisms: bash --posix does, and even sh. Still, when I used this function , ~~~ pathprepend () { if [[ ":$PATH:" != *":$1:"* ]]; then PATH="$1${PATH:+":$PATH"}" fi } ~~~ to add a directory to PATH from ~/.profile, Git didn't pick it up. Note that echo $PATH in the bash session from which I was using Git did list my directory, I noticed just because I use diff-highlight , symlinked in that directory, and after I started using the above pathprepend function Git complained that diff-highlight was missing. After restoring a POSIX compliant PATH setting, it went back to working as usual. This left me wondering what do programs use to read their environment. Do each one of them ship with their own mechanism to do it? Do they leave the job to some system shell or library? --- **Edit** @Bodo, this is what I used to do: in ~/.profile, ~~~ pathprepend () { if [[ ":$PATH:" != *":$1:"* ]]; then PATH="$1${PATH:+":$PATH"}" fi } pathprepend "$HOME/.local/bin" ~~~ By "POSIX compliant" I mean without any bashism. This is what I have now in ~/.profile: ~~~ pathprepend () { case ":$PATH:" in *":$1:"*) :;; *) PATH="$1${PATH:+":$PATH"}";; esac } pathprepend "$HOME/.local/bin" ~~~ In both cases ~/.profile is sourced from ~/.bash_profile, which contains ~~~ # Load the configuration for login sessions of any shell if [[ -f "$HOME/.profile" ]]; then source "$HOME/.profile" else echo >&2 "$HOME/.bash_profile: $HOME/.profile not found" fi # Load the configuration for interactive non-login Bash sessions case "$-" in *i*) if [[ -f "$HOME/.bashrc" ]]; then source "$HOME/.bashrc" else echo >&2 "$HOME/.bash_profile: $HOME/.bashrc not found" fi;; esac ~~~ I did not export PATH because Gordon Davisson explains in the answer from which I copied the function that "PATH should already be marked as exported, so reexporting is not needed." In fact, I still don't export it but with the case version of pathprepend everything works alright. By the way, what is the Git process' parent process, is it the Bash process from which I use git?
Arch Stanton (355 rep)
Mar 16, 2025, 10:52 AM • Last activity: Mar 16, 2025, 05:56 PM
1 votes
3 answers
9866 views
Understand the /etc/inittab
I am using the following `/etc/inittab` file (systemv): ``` # /etc/inittab: init(8) configuration. # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $ # The default runlevel. id:5:initdefault: # Boot-time system configuration/initialization script. # This is run first except when booting in emer...
I am using the following /etc/inittab file (systemv):
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

# The default runlevel.
id:5:initdefault:

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.

si::sysinit:/etc/init.d/rcS

# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
S0:12345:respawn:/sbin/getty -L 115200 ttyS0
In order to understand how things really work I'll appreciate if your answers to 1-3 you'll distinguish between two situations: 1. I'm connected to my system using a serial port. 2. I have a "regular" desktop pc. Questions: 1. If I'll add another getty line, once linux startup I will see two separate terminals? 2. If I open several getty lines, how I assigned which getty will run my si::sysinit:/etc/init.d/rcS command and which getty will run the other script's commands? (the ones who run scripts according to the system run level) in other words: in the /etc/inittab file - can i assign different commands to different gettys? (i mean to the terminals which will open by these gettys) 3. the last script in /etc/init.d/rc5 folder run the following command:
su nobody -c /bin/sh
and the output is:
sh: cannot set terminal process group (1618): Inappropriate ioctl for device
    sh: no job control in this shell
    sh-4.3$ whoami
    nobody
So I verified that i am nobody but why it writes the first two lines? also why the prompt is sh-4.3$ and not nobody@... 4. I'm using serial connection. Can I change the /etc/inittab file and the last script that will run by init in order to: 1. run a program before login as low privileged user (init process will wait for termination) 2. once the program exits get the regular login prompt to my system 3. what is the best way to create a low privileged user and let him run this program during init process (if I don't want to use the nobody user)
hutcruchi (399 rep)
Nov 5, 2019, 07:58 AM • Last activity: Feb 13, 2025, 05:02 AM
12 votes
1 answers
6513 views
What is the meaning/purpose of *.pid files in /var/run
I'm quite new in Linux world, and now I'm trying to understand [FHS][1] principles. In `/var/run` I found about ten `*.pid` files like `crond.pid` which contain just PIDs. There are more than ten processes running in the system and just ten files. So what is their purpose and what generated them? [1...
I'm quite new in Linux world, and now I'm trying to understand FHS principles. In /var/run I found about ten *.pid files like crond.pid which contain just PIDs. There are more than ten processes running in the system and just ten files. So what is their purpose and what generated them?
Alex Silkovsky (263 rep)
Sep 12, 2015, 09:32 PM • Last activity: Nov 12, 2024, 08:46 PM
0 votes
0 answers
70 views
Shell-init errors when starting the system with pivot_root
I am using sysvinit and I can start the system directly by these kernel options: ``` root=/dev/sda1 rootfstype=ext4 init=/sbin/init ``` And it works perfectly. But if I add a middle filesystem like with this: (a simplified example) ``` root=/dev/sdb2 rootfstype=squashfs init=/myscript ``` Where `/my...
I am using sysvinit and I can start the system directly by these kernel options:
root=/dev/sda1 rootfstype=ext4 init=/sbin/init
And it works perfectly. But if I add a middle filesystem like with this: (a simplified example)
root=/dev/sdb2 rootfstype=squashfs init=/myscript
Where /myscript is a BusyBox script like this:
#!/busybox sh
echo Welcome
mount /dev/sda1 /newroot
cd /newroot/mnt
pivot_root /newroot .
exec /sbin/init
Then it also starts up, but during the SysVInit boot after pivot_root and exec, I see many messages in console like this:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
What is the issue?
melonfsck - she her (150 rep)
Oct 21, 2024, 01:09 PM
3 votes
0 answers
2162 views
How do I put a splash screen during shutdown?
I'm able to put a splash screen on startup. As soon as powered on, a splash screen is shown till `startx` command is run. I edited the script to put the same image (for now) while rebooting/halting. I want it to be shown from right after `reboot` command is given, to the time that PC is exactly powe...
I'm able to put a splash screen on startup. As soon as powered on, a splash screen is shown till startx command is run. I edited the script to put the same image (for now) while rebooting/halting. I want it to be shown from right after reboot command is given, to the time that PC is exactly powered off. Right now, image is shown right after reboot command is given, displayed for a few seconds, then a tty is displayed, and the following is written on the screen: map: vt01 => fb0 raspbian ... Raspberry login: map: vt01 => fb0 Oops: Terminated Here is the /etc/init.d/asplashscreen script: #! /bin/sh ### BEGIN INIT INFO # Provides: asplashscreen # Required-Start: # Required-Stop: $all # Should-Start: # Default-Start: S # Default-Stop: 0 6 # Short-Description: Show custom splashscreen # Description: Show custom splashscreen ### END INIT INFO do_start () { /usr/bin/fbi -T 1 -noverbose -a /etc/splash.png exit 0 } do_stop () { /usr/bin/fbi -T 1 -noverbose -a /etc/splash.png exit 0 } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) do_stop ;; status) exit 0 ;; *) echo "Usage: asplashscreen [start|stop]" >&2 exit 3 ;; esac : I installed this script via sudo insserv asplashscreen command. >How can I make this script run very first on reboot and stay till power off?
ceremcem (2451 rep)
Aug 16, 2015, 03:57 PM • Last activity: Jun 25, 2024, 08:49 AM
0 votes
3 answers
4615 views
Startup script needs root permissions
I have a script that I need to run at startup. I have it in init.d. I need to execute one of the commands within the script with root permissions. How do I go about doing this? Edit 1: For reference, this is a ClearCase/ClearQuest RHEL 6.7 server. There looks to be an issue relating to CC starting b...
I have a script that I need to run at startup. I have it in init.d. I need to execute one of the commands within the script with root permissions. How do I go about doing this? Edit 1: For reference, this is a ClearCase/ClearQuest RHEL 6.7 server. There looks to be an issue relating to CC starting before the license manager. So, I want to run the following (all requiring root permissions): /path/to/atria_start stop # stop CC /path/to/start_lmgrd start # start license manager (flexlm) /path/to/atria_start start # restart CC These don't happend. I have them in a simple script "cc_startup.sh" in /etc/init.d
basil (153 rep)
Jan 27, 2016, 07:47 PM • Last activity: Jun 11, 2024, 10:17 AM
177 votes
2 answers
241419 views
How does systemd use /etc/init.d scripts?
I just switched to debian jessie, and most things run okay, including my graphical display manager `wdm`. The thing is, I just don't understand how this works. Obviously my `/etc/init.d/wdm` script is called, because when I put an early `exit` in there, wdm is not started. But when I alternatively r...
I just switched to debian jessie, and most things run okay, including my graphical display manager wdm. The thing is, I just don't understand how this works. Obviously my /etc/init.d/wdm script is called, because when I put an early exit in there, wdm is not started. But when I alternatively rename the /etc/rc3.d directory (my default runlevel used to be 3), then wdm is still started. I could not find out how systemd finds this script and I do not understand what it does to all the other init.d scripts. - When and how does systemd run init.d scrips? - In the long run, should I get rid of all init.d scripts?
Martin Drautzburg (2538 rep)
Oct 2, 2015, 10:46 AM • Last activity: Jun 11, 2024, 10:09 AM
127 votes
4 answers
533521 views
How can I make a script in /etc/init.d start at boot?
I think I read something a while back about this, but I can't remember how it's done. Essentially, I have a service in `/etc/init.d` which I'd like to start automatically at boot time. I remember it has something to do with symlinking the script into the `/etc/rc.d` directory, but I can't remember a...
I think I read something a while back about this, but I can't remember how it's done. Essentially, I have a service in /etc/init.d which I'd like to start automatically at boot time. I remember it has something to do with symlinking the script into the /etc/rc.d directory, but I can't remember at the present. What is the command for this? I believe I'm on a Fedora/CentOS derivative.
Naftuli Kay (41346 rep)
Sep 8, 2011, 11:21 PM • Last activity: May 30, 2024, 01:04 PM
21 votes
8 answers
41021 views
/etc/rc.d vs /etc/init.d
Is ubuntu's `/etc/init.d` directory exactly equivalent (functionally) to what I presume to be the more standard `/etc/rc.d/` (at least on arch)? Is there any particular reason canonical used init.d instead of rc.d for startup scripts?
Is ubuntu's /etc/init.d directory exactly equivalent (functionally) to what I presume to be the more standard /etc/rc.d/ (at least on arch)? Is there any particular reason canonical used init.d instead of rc.d for startup scripts?
Falmarri (13507 rep)
Oct 26, 2010, 06:22 PM • Last activity: May 16, 2024, 05:58 PM
3 votes
1 answers
3358 views
Nessus 8.13 Install on Kali or Ubuntu: /etc/init.d/nessusd: command not found
I really need some help with this issue I am having. I am trying to install Nessus scanner on either my Kali 2020.2 or Ubuntu 20.04 LTS VMs on Virtual Box. Granted I have tried this install on both Kali and Ubuntu with the same outcome. I complete the following steps per the instructions: **STEP 3 i...
I really need some help with this issue I am having. I am trying to install Nessus scanner on either my Kali 2020.2 or Ubuntu 20.04 LTS VMs on Virtual Box. Granted I have tried this install on both Kali and Ubuntu with the same outcome. I complete the following steps per the instructions: **STEP 3 is where my problem exists** 1. Access & retrieve the Activation Code 2. Download & Install Nessus per instructions using the command
sudo dpkg -i Nessus-8.13.1-debian6_amd64.deb
3. Start the service with command
/etc/init.d/nessusd start
After trying to start the service I get the following error message >sudo: /etc/init.d/nessusd: command not found **Troubleshooting steps** - Tried looking for Nessusd under /etc/init.d/ and there is nothing related to Nessus - Ran command
cat -v /etc/init.d/nessusd
with the following results: >cat: /etc/init.d/nessusd: No such file or directory - I have run the command dpkg-query -l which I do see Nessus there - I have logged out of the user account and logged into Root account to check if nessusd would be listed there under /etc/init.d location, and again it is not. - I have tried rebooting and also re-installing to see if I get a different outcome and no difference. I am lost on how to fix this issue. I have spent the last several hours trying to find a remedy. If anyone knows how to fix this issue I would be very grateful. I am trying to get through the TryHackMe lessons and I am currently on the Nessus lesson and would like to finish it. Again, I have tried this on both Kali and Ubuntu and I keep getting the same results so curious if maybe this is a known issue or bug? Thanks in advance for any help! **Happy New Year!! 2021!!**
SYNACK21 (31 rep)
Jan 2, 2021, 07:41 AM • Last activity: Feb 5, 2024, 05:19 AM
1 votes
3 answers
3845 views
How to start a script on boot in Debian?
I have a script inside of `/etc/init.d/wifi` and I want to start it on boot. I first gave it permissions by running `sudo chmod 755 wifi`, then I ran `sudo update-rc.d wifi defaults`. Finally, I enabled it with `wifi enable` and it worked perfectly. However, when I did a reboot, the service wasn't a...
I have a script inside of /etc/init.d/wifi and I want to start it on boot. I first gave it permissions by running sudo chmod 755 wifi, then I ran sudo update-rc.d wifi defaults. Finally, I enabled it with wifi enable and it worked perfectly. However, when I did a reboot, the service wasn't active. Why? What am I missing? I'm using Debian 9.
Hugo Zárate (11 rep)
Apr 30, 2020, 03:54 PM • Last activity: Feb 2, 2024, 01:00 PM
0 votes
1 answers
2926 views
Startup / shutdown script for RedHat
I'm trying to create startup / shutdown script for my application, but I do not have experience with that, so I wanted to start with screen (I'll refer to it as "test_screen"). Firstly I thought I'll create script in /etc/init.d only. And I got inspiration from here - https://unix.stackexchange.com/...
I'm trying to create startup / shutdown script for my application, but I do not have experience with that, so I wanted to start with screen (I'll refer to it as "test_screen"). Firstly I thought I'll create script in /etc/init.d only. And I got inspiration from here - https://unix.stackexchange.com/a/20361/29677 . Basic idea to simuate my appplication is to use - screen -d -m -S test_screen to startup - screen -S test_screen -X quit for shutdown - and screen –list for status (kind of) But when I tried /etc/init.d/test_screen start I got Reloading systemd: [ OK ] Starting test_screen (via systemctl): Failed to start test_screen.service: Unit not found. [FAILED] So it seems I have to create unit. I tried with https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html , so I have my unit file in /etc/systemd/system: # cat test_screen.service [Unit] Description=Testing screen service [Service] Type=simple ExecStart=/bin/screen -d -m -S test_screen ExecStop=/bin/screen -S test_screen -X quit Environment= Restart=always [Install] WantedBy=default.target First question is, should I have /etc/init.d/test_screen start as ExecStart or not? Definitely it won't be one liner... Anyway, it is not running. In /var/log/messages I see Sep 19 10:54:58 somehostname systemd: Started Testing screen service. Sep 19 10:54:58 somehostname systemd: Starting Testing screen service... Sep 19 10:54:58 somehostname systemd: test_screen.service holdoff time over, scheduling restart. Sep 19 10:54:58 somehostname systemd: Started Testing screen service. Sep 19 10:54:58 somehostname systemd: Starting Testing screen service... Sep 19 10:54:58 somehostname systemd: test_screen.service holdoff time over, scheduling restart. Sep 19 10:54:58 somehostname systemd: Started Testing screen service. Sep 19 10:54:58 somehostname systemd: Starting Testing screen service... Sep 19 10:54:59 somehostname systemd: test_screen.service holdoff time over, scheduling restart. Sep 19 10:54:59 somehostname systemd: Started Testing screen service. Sep 19 10:54:59 somehostname systemd: Starting Testing screen service... Sep 19 10:54:59 somehostname systemd: test_screen.service holdoff time over, scheduling restart. Sep 19 10:54:59 somehostname systemd: Started Testing screen service. Sep 19 10:54:59 somehostname systemd: Starting Testing screen service... Sep 19 10:54:59 somehostname systemd: test_screen.service holdoff time over, scheduling restart. Sep 19 10:54:59 somehostname systemd: start request repeated too quickly for test_screen.service Sep 19 10:54:59 somehostname systemd: Failed to start Testing screen service. Sep 19 10:54:59 somehostname systemd: Unit test_screen.service entered failed state. Sep 19 10:54:59 somehostname systemd: test_screen.service failed. How can I find the reason, why it is entering failed state? All suggestions are welcome.
Betlista (165 rep)
Sep 19, 2017, 08:53 AM • Last activity: Dec 27, 2023, 04:10 AM
0 votes
1 answers
1781 views
Disabling the autostart of a service from /etc/init.d without disabling the service?
I have a service that gets started via /etc/init.d at boot and that cause the final steps of the boot processes to be delayed long enough that it's possible to log in via the graphic display manager before everything is set up properly. The culprit is netatalk which is a service that I don't need th...
I have a service that gets started via /etc/init.d at boot and that cause the final steps of the boot processes to be delayed long enough that it's possible to log in via the graphic display manager before everything is set up properly. The culprit is netatalk which is a service that I don't need that often. Does init support a multi-tier approach to have certain services started in a second round (and how)? Or will I have to disable the auto-starting-at-boot and launch the service manually or at the end of rc.local (/etc/init.d/netatalk start)? As far as I know it's possible only to disable the service via /etc/default/netatalk but maybe I'm missing something (outside of changing the netatalk init script itself)? FWIW, I'm not running the legacy atalkd daemon which could be launched in the background (option in /etc/default/netatalk). EDIT: I forgot to mention a crucial detail. This is Kubuntu 14.04.6 LTS. I know it's no longer in support but that's not the point here and I have my reasons not to upgrade to a completely new version. I keep the kernels updated, X, Mesa, DRM drivers are all updated to give optimum performance but most of the core OS is still Ubuntu 14.04 with its somewhat strange combination of upstart (provides /sbin/init) and parts of systemd which play only a minor role as far as I can tell. Many of the scripts in /etc/init.d have corresponding entries in /etc/init which is definitely used by upstart. As mentioned in the discussion below I have tweaked the netatalk init script so it starts all services in the background if the backgrounding option is set in /etc/default/netatalk. That aside think my main "problem" is that I do things in /etc/rc.local that should be finished before anyone logs into a desktop session. That script is always executed last as far as I understand so it seems my best option is not to rely on the init system for deferring slowly-starting services but to prevent them from being started automatically and the start them "manually" in a post-amble section of /etc/rc.local . So my question becomes: does upstart provide a way to do disable autostart without disabling the service altogether?
RJVB (254 rep)
Nov 1, 2023, 02:00 PM • Last activity: Nov 2, 2023, 11:38 AM
0 votes
1 answers
250 views
kernel ignores append init=/bin/bash
``` qemu-system-x86_64 -m 2G -accel kvm -kernel kernel6.1 -append "init=/bin/bash" -initrd myinitrd.gz ``` Supposed to run bash as init, but kernel still prints: ``` [ 1.400577] Run /init as init process ``` Why?
qemu-system-x86_64 -m 2G -accel kvm -kernel kernel6.1 -append "init=/bin/bash" -initrd myinitrd.gz
Supposed to run bash as init, but kernel still prints:
[    1.400577] Run /init as init process
Why?
exebook (202 rep)
Jan 6, 2023, 04:29 PM • Last activity: Oct 25, 2023, 05:39 PM
0 votes
1 answers
113 views
Apache refuses to start claiming a wrong PID
I'm facing an odd problem on a Buildroot environment for RPi3. I have this init.d service to start `apache2` (version 2.4.57): # cat /etc/init.d/S50apache #!/bin/sh case "$1" in start|restart|graceful|graceful-stop|stop) apachectl -k $1 ;; reload) apachectl -k restart ;; *) echo "Usage: $0 {start|re...
I'm facing an odd problem on a Buildroot environment for RPi3. I have this init.d service to start apache2 (version 2.4.57): # cat /etc/init.d/S50apache #!/bin/sh case "$1" in start|restart|graceful|graceful-stop|stop) apachectl -k $1 ;; reload) apachectl -k restart ;; *) echo "Usage: $0 {start|restart|reload|graceful|graceful-stop|stop}" exit 1 esac exit $? Often, when I power up the RPi3 I notice the web server is not running. If I try to run the very same command, i.e.: # apachectl -k start I get: httpd (pid 288) already running but: # ps aux | grep httpd 477 root grep httpd and: # ps aux | grep 288 288 root /usr/sbin/wpa_supplicant -u 457 root grep 288 It seems obvious (unless I'm missing something) that apache2 is not running and the PID 288 is about a completely different service. In order to start the webserver I have to: 1. apachectl -k stop -> this actually stops the wpa_supplicant service! 2. restart the wpa_supplicant service 3. now apachectl -k start works and the apache2 service runs Of course this is not acceptable. Furthermore, the machine will be unattended hence I need to fix this issue. But I first have to understand why it happens. How is it possible it thinks it has a different PID?
Mark (815 rep)
Oct 25, 2023, 07:21 AM • Last activity: Oct 25, 2023, 08:00 AM
Showing page 1 of 20 total questions