Sample Header Ad - 728x90

Unix & Linux Stack Exchange

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

Latest Questions

3 votes
3 answers
2487 views
Applying mouse settings on startup
linux learner here. (Running on a `Debian`-derived distro) My mouse sensitivity was too high so I was able to change it, but can't seem to get it to apply on startup. I made `/etc/init.d/mouse` When I run `sudo /etc/init.d/mouse start`, the script works fine and the mouse settings are updated. But I...
linux learner here. (Running on a Debian-derived distro) My mouse sensitivity was too high so I was able to change it, but can't seem to get it to apply on startup. I made /etc/init.d/mouse When I run sudo /etc/init.d/mouse start, the script works fine and the mouse settings are updated. But I can't get it to run on startup. I tried running sudo update-rc.d mouse defaults, but it still doesn't update when I log out and back in again. Not sure what else I'm missing in order to make it run on startup. Related question: Is /etc/init.d even the right place to be putting it? Or is there some other startup folder that's better for configuration type changes? (As I read init.d is a folder for applications to be run on startup)
Tiberiu (131 rep)
Nov 23, 2014, 12:42 AM • Last activity: Aug 6, 2025, 05:05 PM
5 votes
1 answers
3519 views
Maintain ip link settings across reboot
Every time I turn on my computer, I have to manually set `# ip link set wlp5s0 up` in order to use my wireless card. Is there a way to maintain this setting across reboots? So if I set the interface `up` it stays up until I turn it off. I'd like to avoid using a 3rd-party network manager if at all p...
Every time I turn on my computer, I have to manually set # ip link set wlp5s0 up in order to use my wireless card. Is there a way to maintain this setting across reboots? So if I set the interface up it stays up until I turn it off. I'd like to avoid using a 3rd-party network manager if at all possible. Using Arch.
Canyon (151 rep)
Aug 30, 2016, 03:52 AM • Last activity: Jul 13, 2025, 07:06 AM
4 votes
2 answers
2255 views
Ubuntu 18.04 VM in emergency/maintenance mode due to failed corrupted raided disk
I have a VM which has an attached raided device with fstab entry: /dev/md127 /mnt/blah ext4 nofail 0 2 The raided disks are corrupted and during startup the unit entered emergency/maintence mode, which means only the local host user could exit this mode and start it up normally. During normal startu...
I have a VM which has an attached raided device with fstab entry: /dev/md127 /mnt/blah ext4 nofail 0 2 The raided disks are corrupted and during startup the unit entered emergency/maintence mode, which means only the local host user could exit this mode and start it up normally. During normal startup the following occurred in syslog: systemd-fsck: /dev/md127 contains a file system with errors, check forced. systemd-fsck: /dev/md127: Inodes that were part of a corrupted orphan linked list found. systemd-fsck: /dev/md127: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. systemd-fsck: #011(i.e., without -a or -p options) systemd-fsck: fsck failed with exit status 4. systemd-fsck: Running request emergency.target/start/replace systemdReferenced image: systemd-fsck@dev-md127.service: Main process exited, code=exited, status=1/FAILURE systemdReferenced image: systemd-fsck@dev-md127.service: Failed with result 'exit-code'. systemdReferenced image: Failed to start File System Check on /dev/md127. systemdReferenced image: Dependency failed for /mnt/blah. systemdReferenced image: Dependency failed for Provisioner client daemon. My guess is that the OS goes to emergency/maintenance mode because of the corrupt raided disks: systemctl --state=failed UNIT LOAD ACTIVE SUB DESCRIPTION ● systemd-fsck@dev-md127.service loaded failed failed File System Check on /dev/md127 What i want is for the VM to startup regardless of whether the raided drives are corrupt/unmountable, so it shouldn't go to emergency/maintenance mode. I followed these posts to attempt at disabling emergency/maintenance mode: - https://unix.stackexchange.com/questions/416640/how-to-disable-systemd-agressive-emergency-shell-behaviour - https://unix.stackexchange.com/questions/326493/how-to-determine-exactly-why-systemd-enters-emergency-mode/393711#393711 - https://unix.stackexchange.com/questions/422319/emergency-mode-and-local-disk I had to first create the directory local-fs.target.d in /etc/systemd/system/, which felt wrong. I then created a nofail.conf in /etc/systemd/system/local-fs.target.d/nofail.conf containing: [Unit] OnFailure= After loading that drop file, I was able to confirm that the drop file was found by local-fs.target: sudo systemctl status local-fs.target ● local-fs.target - Local File Systems Loaded: loaded (/lib/systemd/system/local-fs.target; static; vendor preset: enabled) Drop-In: /etc/systemd/system/local-fs.target.d └─nofail.conf Active: active since Tue 2019-01-08 12:36:41 UTC; 3h 55min ago Docs: man:systemd.special(7) BUT, after rebooting, the VM still ended up in emergency/maintenance mode. Have i missed something? Does the nofail.conf solution not work with raided disks? ---------- EDIT: I was able to get a print out of the logs when the system booted to emergency mode (sorry it's a screenshot since i don't have access to the host and had to ask the owner for it): enter image description here Here's the output from systemctl for systemd-fsck@dev-md127:
sudo systemctl status --no-pager --full systemd-fsck@dev-md127
 ● systemd-fsck@dev-md127.service - File System Check on /dev/md127
    Loaded: loaded (/lib/systemd/system/systemd-fsck@.service; static; vendor preset: enabled)
    Active: failed (Result: exit-code) since Thu 2019-01-10 12:05:44 UTC; 2h 57min ago
      Docs: man:systemd-fsck@.service(8)
   Process: 1025 ExecStart=/lib/systemd/systemd-fsck /dev/md127 (code=exited, status=1/FAILURE)
  Main PID: 1025 (code=exited, status=1/FAILURE)

 systemdReferenced image: Starting File System Check on /dev/md127...
 systemd-fsck: /dev/md127 contains a file system with errors, check forced.
 systemd-fsck: /dev/md127: Inodes that were part of a corrupted orphan linked list found.
 systemd-fsck: /dev/md127: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
 systemd-fsck:         (i.e., without -a or -p options)
 systemd-fsck: fsck failed with exit status 4.
 systemd-fsck: Running request emergency.target/start/replace
 systemdReferenced image: systemd-fsck@dev-md127.service: Main process exited, code=exited, status=1/FAILURE
 systemdReferenced image: systemd-fsck@dev-md127.service: Failed with result 'exit-code'.
 systemdReferenced image: Failed to start File System Check on /dev/md127.
As i pointed out earlier, i have nofail set in /etc/fstab. Now the questions are: 1. What is the dependency in the failed dependency in the screenshot? 2. If fsck fails on /dev/md127, why does it enter emergency mode and how do i disable that? EDIT 2: A couple of other things i can add are: 1. the vm is a kvm vm 2. it's a software raid Kind regards, Ankur
Ankur22 (41 rep)
Jan 8, 2019, 04:39 PM • Last activity: Jul 4, 2025, 11:09 AM
0 votes
1 answers
3477 views
Indicator-cpufreq doesn't start on login
If I run indicator-cpufreq in the console it will start up just like it is supposed to and appear in the panel. However, if I place the same command in the startup programs it doesn't appear on login. I'm using Mint Linux and the Cinnamon desktop. How can I run this program on login?
If I run indicator-cpufreq in the console it will start up just like it is supposed to and appear in the panel. However, if I place the same command in the startup programs it doesn't appear on login. I'm using Mint Linux and the Cinnamon desktop. How can I run this program on login?
Stein (312 rep)
Oct 14, 2014, 09:22 PM • Last activity: Jun 5, 2025, 05:02 PM
0 votes
2 answers
10273 views
OpenSuse Tumbleweed: How to run a bash script on startup?
I'm trying to a run a .sh file on startup of a rPi3B+ running openSuse Tumbleweed JeOS. The script is really simple and looks like this: `node /home/user_name/path/to/the/file.js` here are two links I tried to follow: https://forums.opensuse.org/showthread.php/428743-How-to-run-script-at-startup htt...
I'm trying to a run a .sh file on startup of a rPi3B+ running openSuse Tumbleweed JeOS. The script is really simple and looks like this: node /home/user_name/path/to/the/file.js here are two links I tried to follow: https://forums.opensuse.org/showthread.php/428743-How-to-run-script-at-startup https://www.suse.com/c/easy-running-scripts-boot-and-shutdown/ https://doc.opensuse.org/documentation/leap/startup/html/book.opensuse.startup/cha.adm.shell.html How how to go about this? Edit: I also just tried following along to this one without any luck either: https://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup#12973826 My startServer script in /etc/init.d looks like this: #!/bin/sh # ScriptName=startServer node /home/user-name/server.js &
AustinFoss (131 rep)
Feb 13, 2019, 10:32 PM • Last activity: Jun 4, 2025, 02:03 AM
534 votes
3 answers
353999 views
What should/shouldn't go in .zshenv, .zshrc, .zlogin, .zprofile, .zlogout?
I'm looking for guidelines on what one should and should not include in the various startup files for `zsh`. I understand the order of sourcing of these files, and the conditions under which they are sourced, but it is still not clear to me what should go in each.
I'm looking for guidelines on what one should and should not include in the various startup files for zsh. I understand the order of sourcing of these files, and the conditions under which they are sourced, but it is still not clear to me what should go in each.
kjo (16299 rep)
Apr 4, 2013, 11:42 PM • Last activity: May 25, 2025, 08:12 AM
3 votes
1 answers
6443 views
Cannot add startup service to openWRT from init.d
I have openWrt installed on a TP-Link TL-WA901N/ND v3. I don't have luci package installed because I don't have enough space, so I can only do thing via cli. What I'm trying to achieve is to create a mon0 interface at startup and run tcpdump on it. I've created a file in /etc/init.d and named it mon...
I have openWrt installed on a TP-Link TL-WA901N/ND v3. I don't have luci package installed because I don't have enough space, so I can only do thing via cli. What I'm trying to achieve is to create a mon0 interface at startup and run tcpdump on it. I've created a file in /etc/init.d and named it monitor. The monitor file contains the following #!/bin/sh /etc/rc.common #to start after /etc/init.d/network is started and stop after it stopped START=99 STOP=1 start(){ #tried with and without the following two lines include /lib/network scan_interfaces iw phy phy0 interface add mon0 type monitor ifconfig mon0 up echo "mon0 is up!" } stop(){ ifconfig mon0 down iw mon0 del echo "mon0 is down!" } then I run the following /etc/init.d/monitor enable and in /etc/rc.d I can see S99monitor and K1monitor but when I reboot, I can't see the mon0 interface created when I do ifconfig. This works if I manually start it with /etc/init.d/monitor start I've also tried adding the command above to /etc/rc.local but nothing changed. What am I doing wrong?
saccu (91 rep)
Nov 4, 2014, 11:55 AM • Last activity: May 8, 2025, 11:04 AM
7 votes
2 answers
10398 views
Explicit kernel module load at startup
I'm using grsecurity kernel which disallows automatic kernel load thus several systemd services don't work. After manually loading modules with `modprobe` and restarting module everything works correctly but it's quite dirty solution. I'd like to do it "properly" during startup.
I'm using grsecurity kernel which disallows automatic kernel load thus several systemd services don't work. After manually loading modules with modprobe and restarting module everything works correctly but it's quite dirty solution. I'd like to do it "properly" during startup.
Lapsio (1363 rep)
Feb 4, 2017, 04:07 AM • Last activity: May 7, 2025, 05:31 PM
94 votes
6 answers
202195 views
i3wm : start applications on specific workspaces when i3 starts
How can I start applications on specific workspaces in i3 when it starts? Why is this not working in my config file? : workspace 1; exec firefox; workspace 2; exec chromium; workspace 1
How can I start applications on specific workspaces in i3 when it starts? Why is this not working in my config file? : workspace 1; exec firefox; workspace 2; exec chromium; workspace 1
Gradient (3749 rep)
Oct 19, 2013, 10:27 PM • Last activity: May 5, 2025, 07:57 PM
3 votes
1 answers
3093 views
USB Live persistence issue in Kali Linux: Disappearing upper panel and GDBus error
I'm encountering issue with USB Live persistence Kali linux. I've installed it correctly and everything works fine initially. But after running it, the upper panel sometimes disappears. When opening the panel from `Application->Setting->Panel`, I encounter the following error: Failed to show the pre...
I'm encountering issue with USB Live persistence Kali linux. I've installed it correctly and everything works fine initially. But after running it, the upper panel sometimes disappears. When opening the panel from Application->Setting->Panel, I encounter the following error: Failed to show the preferences dialog GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.xfce.Panel was not provided by any .service files
Ajay (31 rep)
Mar 23, 2020, 03:16 PM • Last activity: May 4, 2025, 02:08 AM
49 votes
2 answers
107660 views
Configure kernel modules to load at boot
My distribution is Fedora 17 Gnome. Every time I reboot/restart my computer I need to run this command as root: modprobe rt2800usb How can I make it permanent and enable this module at boot ?
My distribution is Fedora 17 Gnome. Every time I reboot/restart my computer I need to run this command as root: modprobe rt2800usb How can I make it permanent and enable this module at boot ?
somethingSomething (6209 rep)
Apr 3, 2013, 07:41 PM • Last activity: May 3, 2025, 08:35 AM
54 votes
1 answers
17986 views
One systemctl command to both start and enable
Using one command to both start and enable `systemctl` managed software would be useful to spare a few lines in a few scripts, making them a bit more aesthetic (not really a problem but a nice thing to have). Is there one `systemctl` command to both `start` and `enable` a program controlled by `syst...
Using one command to both start and enable systemctl managed software would be useful to spare a few lines in a few scripts, making them a bit more aesthetic (not really a problem but a nice thing to have). Is there one systemctl command to both start and enable a program controlled by systemctl?
user149572
Jan 20, 2019, 10:00 PM • Last activity: Apr 9, 2025, 01:19 PM
0 votes
0 answers
40 views
How can I globally delay non-critical systemd services on Ubuntu without modifying each unit individually?
I'm trying to improve my boot performance on an Ubuntu system by ensuring that only essential services—like those required for the GNOME UI—start immediately at boot. All other (non-critical) services should be deferred until after the system has settled (for example, 1 minute after boot). My curren...
I'm trying to improve my boot performance on an Ubuntu system by ensuring that only essential services—like those required for the GNOME UI—start immediately at boot. All other (non-critical) services should be deferred until after the system has settled (for example, 1 minute after boot). My current method (creating individual timer units or adding sleep commands in each service's unit file) works but requires manual configuration for each service. I’d like a global or automated solution that, regardless of existing or future service units, delays the startup of any service that isn’t critical to the UI. Is there a way to configure systemd—perhaps using a generator or some global mechanism—to automatically inject a delay (or otherwise postpone startup) for non-essential services without me having to handle each unit by name? What strategies or best practices exist for categorizing essential versus non-essential services in systemd so that the boot process is optimized? Any insights or recommendations for an automated approach would be greatly appreciated.
Jan (121 rep)
Apr 4, 2025, 02:21 PM
22 votes
5 answers
38791 views
How can I run a script that starts before my login screen?
I was calibrating my touch screen, and saw that the best tool around was xinput_calibrator. So I used it. It have two options (one of which did not work), so I am here for the second. It says I should execute this command "in a script that starts with your X session": `xinput set-int-prop "3M 3M USB...
I was calibrating my touch screen, and saw that the best tool around was xinput_calibrator. So I used it. It have two options (one of which did not work), so I am here for the second. It says I should execute this command "in a script that starts with your X session": xinput set-int-prop "3M 3M USB Touchscreen - EX II" "Evdev Axis Calibration" 32 14410 2146 14574 2115 So I tried ~/.xinitrc, ~/.xsession and ~/.xsessionrc, all of which did not exist. So I created them and the exact content was this command. The first two files made my logins fail (after I login, I fall back to the login screen). With the last file, the calibration was functional, but only after logging in... I need that command to run **before** the login dialog shows up. I thought of adding this command to the end of /etc/X11/xinit/xinitrc with no result (nothing changed). Also, I tried to add it to the end of /etc/X11/Xsession.d/40x11-common_xsessionrc (after inspecting some of the files), but the result was exactly the same as adding it to ~/.xsessionrc. How can I make this command run before the login screen shows (is this before the window manager starts, or before the X session starts)? (I am running Kubuntu with the default window manager, if that matters) **UPDATE** As I am using Kubuntu, my display manager is kdm. As the accepted answer suggests, I edited the file /etc/kde4/kdm/Xsetup, and as mentioned [here](http://maketecheasier.com/run-startup-scripts-in-kdm-before-kde-starts/2011/12/15) I added the command before the command that is there by default. And it works like a charm :)
jadkik94 (1013 rep)
Jul 8, 2012, 08:53 PM • Last activity: Feb 12, 2025, 03:20 PM
17 votes
1 answers
23013 views
What's the difference of `/etc/modules-load.d` and `/etc/modules`?
I red the introduction of them and found that, they both deal with module loading during boot time. So, what's the difference of these two different configuation ways?
I red the introduction of them and found that, they both deal with module loading during boot time. So, what's the difference of these two different configuation ways?
nn0p (354 rep)
Mar 12, 2015, 07:19 AM • Last activity: Feb 7, 2025, 10:54 AM
19 votes
6 answers
21218 views
Using systemctl edit via bash script?
I install Debian a lot. To do this I have a fully-automated preseed.cfg; at the end of the preseed, it downloads and runs a postinstall.sh script from my TFTP server, which does some additional customization. I'm in the process of switching from GNOME to LXQTE, and using SDDM instead of GDM. However...
I install Debian a lot. To do this I have a fully-automated preseed.cfg; at the end of the preseed, it downloads and runs a postinstall.sh script from my TFTP server, which does some additional customization. I'm in the process of switching from GNOME to LXQTE, and using SDDM instead of GDM. However, SDDM tries to start too quickly for my hardware. To get around this, I've been using systemctl edit sddm to add the following: [Service] ExecStartPre=/bin/sleep 5 This works great, and I'd like to automate this process by adding it to the postinstall.sh script. However, I can't figure out how to pass the file contents to systemctl edit via a bash script. How can I do this?
user5104897 (851 rep)
Aug 1, 2018, 09:32 PM • Last activity: Jan 13, 2025, 06:45 PM
8 votes
1 answers
9666 views
Wait for mount before starting services
I have a Raspbian 9 system with an external hard disk, which gets mounted as `/srv/file` during boot. I am running PostgreSQL and BIND, both of which have data files residing on that disk. On startup, PostgreSQL routinely fails to start because the external disk filesystem is not mounted yet. BIND s...
I have a Raspbian 9 system with an external hard disk, which gets mounted as /srv/file during boot. I am running PostgreSQL and BIND, both of which have data files residing on that disk. On startup, PostgreSQL routinely fails to start because the external disk filesystem is not mounted yet. BIND starts but, for the same reason, name resolution fails for anything stored on the file system. systemctl list-units | grep mount tells me the systemd unit for the file system is srv-file.mount. I then went and added Requires=srv-file.mount to the [Unit] section of bind9.service and postgresql.service (neither has any other startup requirement), but still to no avail. What am I missing?
user149408 (1515 rep)
Jun 13, 2021, 04:24 PM • Last activity: Dec 20, 2024, 08:34 PM
1 votes
1 answers
48 views
I have made a startup script but it only can run as an user, not root, how can I make it work?
there are 4 scripts that should be started after reboot as user "appian": - `/opt/appian/appian_home/services/bin/start.sh -p Password -s all` - `/opt/appian/appian_home/data-server/bin/start.sh` - `/opt/appian/appian_home/search-server/bin/start.sh` - `/opt/appian/appian_home/tomcat/apache-tomcat/b...
there are 4 scripts that should be started after reboot as user "appian": - /opt/appian/appian_home/services/bin/start.sh -p Password -s all - /opt/appian/appian_home/data-server/bin/start.sh - /opt/appian/appian_home/search-server/bin/start.sh - /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh Here is some code
#!/bin/bash

# Log file for debugging
    LOG_FILE="/var/log/appian_services_start.log"

# Start services and log the process
    echo "Starting Appian services: $(date)" >> $LOG_FILE

# Script 1: Start services with credentials
    /opt/appian/appian_home/services/bin/start.sh -p Password -s all >> $LOG_FILE 2>&1
    echo "Service 1 started: services/bin/start.sh" >> $LOG_FILE

# Wait for 30 seconds
    sleep 30

# Script 2: Start data-server
    /opt/appian/appian_home/data-server/bin/start.sh >> $LOG_FILE 2>&1
    echo "Service 2 started: data-server/bin/start.sh" >> $LOG_FILE

# Wait for 10 seconds
    sleep 10

# Script 3: Start search-server
    /opt/appian/appian_home/search-server/bin/start.sh >> $LOG_FILE 2>&1
    echo "Service 3 started: search-server/bin/start.sh" >> $LOG_FILE

# Wait for 10 seconds
    sleep 10

# Script 4: Start Tomcat server
    /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh >> $LOG_FILE 2>&1
    echo "Service 4 started: tomcat/apache-tomcat/bin/start-appserver.sh" >> $LOG_FILE

    echo "All services started successfully: $(date)" >> $LOG_FILE
                                                                                 
# These are the manual steps what works 
    dzdo su - appian /opt/appian/appian_home/services/bin/start.sh -p Password -s all
    dzdo su - appian /opt/appian/appian_home/data-server/bin/start.sh
    dzdo su - appian /opt/appian/appian_home/search-server/bin/start.sh
    dzdo su - appian /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh`
How to arrange the startup script that after a reboot the scripts can be excecuted by the appian user?
Arjun S (11 rep)
Nov 26, 2024, 01:54 PM • Last activity: Dec 1, 2024, 04:21 PM
0 votes
1 answers
249 views
Startup script won't run on boot
I've been trying to get a very simple startup script but no matter what I try I can't get it to actually run on boot. For simplicity sake I while testing I just wanted to open my Browser, which works perfectly fine when manually executing the script. I'm using Ubuntu 22 LTS. The script itself looks...
I've been trying to get a very simple startup script but no matter what I try I can't get it to actually run on boot. For simplicity sake I while testing I just wanted to open my Browser, which works perfectly fine when manually executing the script. I'm using Ubuntu 22 LTS. The script itself looks the following and is named: #!/bin/bash google-chrome I tried everything, from placing the script under home/user and naming it startup.sh, trying to get it executed via a cronjob using @ Reboot or using init.d and later even trying to write up a systemd service. NOTHING WORKS. How can it take me multiple days of googling and nothing works? I've already tried the following tutorials and troubleshooting instructions: https://www.baeldung.com/linux/run-script-on-startup https://medium.com/@girishbhasinofficial/configuring-a-script-to-run-at-startup-on-ubuntu-22-04-ffe1f3e649d1 https://www.squash.io/executing-bash-script-at-startup-in-ubuntu-linux/ https://linuxconfig.org/how-to-run-script-on-startup-on-ubuntu-20-04-focal-fossa-server-desktop https://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup
DrDecane (1 rep)
Nov 16, 2024, 08:24 PM • Last activity: Nov 16, 2024, 09:10 PM
-1 votes
1 answers
24 views
Ubuntu 18.0.4 fails to start after manual reboot
I have rebooted my ubuntu manually, but it is failing to start again. It stays on the ubuntu logo: I tried the recovery mod and ran file disk check. Then choose resume to continue normal startup. But I ended up here: [![deamon reload connection timeout][1]][1] And it didn't continue to anywhere. So,...
I have rebooted my ubuntu manually, but it is failing to start again. It stays on the ubuntu logo: I tried the recovery mod and ran file disk check. Then choose resume to continue normal startup. But I ended up here: deamon reload connection timeout And it didn't continue to anywhere. So, I have to power off the laptop with power button. Now, this is the screen: reboot failure
Zeinab Abbasimazar (303 rep)
Nov 9, 2024, 05:18 PM • Last activity: Nov 9, 2024, 05:43 PM
Showing page 1 of 20 total questions