Score:1

gsetting stopped working ubuntu 20.04

ro flag

I wrote a bash script to automate my settings and installations, however, after my script finish gsettings commands stopped working.

gsettings set org.gnome.settings-daemon.plugins.media-keys area-screenshot-clip "['<Ctrl>P']"
gsettings get org.gnome.settings-daemon.plugins.media-keys area-screenshot-clip
output: ['<Ctrl>P'] #correct!

the terminal output is correct, however, my keybindings does not change and checking my setting using dconf-editor show there had been no change. Running any gsettings command result in the same behavior.

enter image description here

The following is my full bash script

##################Update Drivers##################

sudo tee /etc/sudoers.d/$USER <<END
$USER $(hostname) = NOPASSWD: ALL
END

sudo apt-get remove --purge '^nvidia-.*' -y
sudo ubuntu-drivers autoinstall -y


##################Wake on Wifi (wowl)##################
sudo iw phy0 wowlan enable magic-packet

##################SSH server##################
sudo apt install openssh-server -y
    
##################Language Format##################
FILE=/etc/default/locale
sudo echo LC_ALL="en_US.UTF-8" >> $FILE
##################Download Files##################
FILE=./Anaconda3-2021.11-Linux-x86_64.sh
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading Anaconda3-2021.11"
    wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
fi


FILE=./google-chrome-stable_current_amd64.deb
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading google-chrome-stable_current_amd64"
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
fi



FILE=./teamviewer_amd64.deb
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading teamviewer_amd64"
    wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
fi

FILE=./teams_1.4.00.26453_amd64.deb
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading teams_1.4.00.26453_amd64.deb"
    wget https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams/teams_1.4.00.26453_amd64.deb
fi

##################Install Favourite apps##################

#Chrome
sudo dpkg -i google-chrome-stable_current_amd64.deb
#Discord
sudo snap install discord
#teamviewer
sudo apt install ./teamviewer_amd64.deb -y
#Microsoft teams
sudo apt install ./teams_1.4.00.26453_amd64.deb -y
#signal
sudo snap install signal-desktop
#whatsapp
sudo snap install whatsapp-for-linux
#unetbootin
sudo add-apt-repository ppa:gezakovacs/ppa -y
sudo apt-get update
sudo apt-get install unetbootin -y
#timeshaft
sudo add-apt-repository -y ppa:teejee2008/ppa
sudo apt install timeshift -y
#pycharm
sudo snap install pycharm-community --classic

#Anaconda pre-requisites
sudo apt-get update -y
sudo apt-get install curl -y
sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 -y

##################Uninstall Games/firefox##################
sudo apt remove aisleriot gnome-mahjongg gnome-mines gnome-sudoku -y
sudo apt-get remove firefox -y

# then, remove the sudo access
sudo /bin/rm /etc/sudoers.d/$USER
sudo -k

##################Install Anaconda##################



bash Anaconda3-2021.11-Linux-x86_64.sh -b -p $HOME/anaconda3
source ~/.bashrc
eval "$($HOME/anaconda3/bin/conda shell.bash hook)"
conda init

###add anaconda-navigator to menue####
FILE=$HOME/anaconda.sh
echo export CONDA_PYTHON_EXE=$HOME/anaconda3/bin/python > $FILE
echo export PATH=$HOME/anaconda3/bin:$PATH >> $FILE
echo python $HOME/anaconda3/bin/anaconda-navigator >> $FILE

FILE=$HOME/anaconda.desktop

echo [Desktop Entry] > $FILE
echo Version=1.0 >> $FILE
echo Type=Application >> $FILE
echo Name=Anaconda-Navigator >> $FILE
echo GenericName=Anaconda >> $FILE
echo Exec=/bin/bash "$HOME/bin/anaconda.sh" >> $FILE
echo Icon=$HOME/anaconda3/lib/python3.9/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png >> $FILE
echo Terminal=false >> $FILE
echo StartupNotify=true >> $FILE    
conda update -n base -c defaults conda -y
###Create conda basic virtual environments####
conda create cudatoolkit=10.2 -n cuda -c conda-forge -y
#conda install -c anaconda cudnn -y
conda create --name torch --clone cuda
conda install pytorch torchvision torchaudio -n torch -c pytorch -y



#DOESN"T WORK??!
##################Key Bindings##################
gsettings set org.gnome.settings-daemon.plugins.media-keys area-screenshot-clip "['<Ctrl>P']"

##################Favourite Apps##################
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'google-chrome.desktop', 'pycharm-community_pycharm-community.desktop', 'anaconda.desktop', 'discord_discord.desktop', 'signal-desktop_signal-desktop.desktop', 'whatsapp-for-linux_whatsapp-for-linux.desktop', 'snap-store_ubuntu-software.desktop']"
vanadium avatar
cn flag
You are running that script as your user after you have logged in, I suppose?
kk96kk avatar
ro flag
yes, I'm running it in terminal with bash script.sh without sudo. I then give my password for the sudo part in the script
Score:0
in flag

The problem might be the Anaconda install/initialization. Make sure you explicitly run /usr/bin/gsettings, otherwise you might be running ~/anaconda3/bin/gsettings, which doesn't seem to have any effect on GNOME settings.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.